1

こんにちは、これは私のシナリオです。

アプリケーションを JBoss5 から JBoss7 に移行しようとしています。

jboss-as-7.1.1.Final を使用しています。

私が得ているエラーは次のとおりです。

No EJB receiver available for handling [appName:,modulename:myapp-ejb,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@6b9bb4bb
     at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

同じエラー メッセージでいくつかのディスカッションを見てきましたが、何が間違っているのかわかりません。

deployments ディレクトリには、myapp.war が 1 つだけあります。.ear ファイルはデプロイしません。モジュールとしてデプロイされた依存関係 (myapp-ejb.jar) があります。

https://docs.jboss.org/author/display/AS71/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7セクション「Migrate EAP」の指示に従いましたAS 7 へのリモート呼び出しを行う 5 つのデプロイ済みアプリケーション」.

サーバー myapp-ejb.jar には、次のような JNDI 名がたくさんあります。

public static final String ACCOUNT_REMOTE = "ejb:/myapp-ejb//AccountBean!com.company.myapp.ejb.account.AccountRemote";

ルックアップは、myapp-ejb.jar で定義されている次の静的メソッドを呼び出すことによって、クライアントから実行されます。

public static AccountRemote getAccountRemote() throws NamingException {
  if (accountRemote == null){
        InitialContext ic = new InitialContext();
        Object ref = ic.lookup(JNDINames.ACCOUNT_REMOTE); 
        accountRemote = (AccountRemote) PortableRemoteObject.narrow(ref, AccountRemote.class); 
  }
  return accountRemote;
}

すべてのリモート インターフェイスは、次のようなステートレス EJB 用です。

@Stateless
@Remote(AccountRemote.class)
public class AccountBean implements AccountRemote {

クライアント myapp.war から、上記の静的メソッド getAccountRemote() を使用して、myapp-ejb.jar へのリモート呼び出しを行います。myapp.war/WEB-INF ディレクトリに、jndi.properties と jboss-ejb-client.properties を追加しました。

jndi.properties には、値が 1 つだけ含まれています。

java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

jboss-ejb-client.properties には以下が含まれます。

remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

remote.connections=default

remote.connection.default.host=localhost
remote.connection.default.port=4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

Standalone.xml からリモート処理のセキュリティ レルムを削除しました。

<subsystem xmlns="urn:jboss:domain:remoting:1.1">
          <connector name="remoting-connector" socket-binding="remoting" />
</subsystem>

JBOSS_HOME/bin/client/jboss-client.jar を myapp.war/WEB-INF/lib に追加しました。

アプリケーションはエラーなしで正常にデプロイされますが、localhost:8080/ を起動すると、No EJB receiver available for handling エラーが発生します。

誰かが私が逃したものを知っていますか? 助言がありますか?

4

2 に答える 2

0
"EJB client API approach" for remote EJB invocation from one node to another node in clustered JBOSS:
------------------------------------------------------------------------------------
1. To call EJB from remote location we need to enable "remoting-ejb-receiver" on server side.
    Please refer to “standalone_changes.xml” to know change details.
2. Also we need to register the "remoting-ejb-receiver" to the application, so that the application can receive remote EJB.
    Please refer to “jboss-ejb-client.xml” section.
3. Now we need to call remote EJB in "EJB client API approach" way, which needs to have JNDI name pattern as:
  ejb:<app-name>/<module-name>/<distinct-name>/<bean-name>!<fullclassname-of-the-remote-interface>
  In our case it will be: ejb:myapp-ejb//node1/AccountBean!com.company.myapp.ejb.account.AccountRemote
  Important to note that identification to remote location IP address is not based on InitialContext as InitialContext will not contain any IP address as normally happens with "remote://URL:Port".
  The remote location identification is based on <distinct-name> passed in JNDI. JBOSS will internally identify the remote IP based on <distinct-name>.
  Hence is required to provide unique <distinct-name> to the application running on different nodes.
  Add "<distinct-name>${jboss.node.name}</distinct-name>" to “jboss-app.xml”. Make sure that jboss.node.name property is always unique.
  But then jboss.node.name should be added as environmental property while server startup.
  For test purpose we can provide hardcoded value like: 
        For node1: "<distinct-name>node1</distinct-name>" to “jboss-app.xml”.
        For node2: "<distinct-name>node2</distinct-name>" to “jboss-app.xml”.


standalone_changes.xml:
------------------------------------------------------------------------------------
   <subsystem xmlns="urn:jboss:domain:remoting:1.1">
        <outbound-connections>
            <remote-outbound-connection name="remote-ejb-connection-host2" outbound-socket-binding-ref="remote-ejb-host2" username="xxx" security-realm="ejb-security-realm">
                <properties>
                    <property name="SASL_POLICY_NOANONYMOUS" value="false"/>
                    <property name="SSL_ENABLED" value="false"/>
                </properties>
            </remote-outbound-connection>
            ...........
            ...........
        </outbound-connections>
    </subsystem>
    ...........
    ...........
    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">   
        <outbound-socket-binding name="remote-ejb-host2">
            <remote-destination host="${jboss.ejb.host2}" port="${jboss.ejb.host2.port}"/>
        </outbound-socket-binding>
        ...........
        ...........
    </socket-binding-group>
    ...........
    ...........
    <management>
        <security-realms>
            <security-realm name="ejb-security-realm">
                <server-identities>
                    <secret value="${jboss.ejb.remoting.password}"/>
                </server-identities>
            </security-realm>
            ...........
            ...........         
        </security-realms>
    </management>

jboss-app.xml:
------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<jboss-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee">
    <distinct-name>node1</distinct-name>
    <security-domain>xyz</security-domain>
    <unauthenticated-principal>guest</unauthenticated-principal>
    <library-directory>lib</library-directory>
</jboss-app>

jboss-ejb-client.xml
------------------------------------------------------------------------------------
<jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">
    <client-context>
        <ejb-receivers>
            <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection-host2"/>
            <!-- <remoting-ejb-receiver outbound-connection-ref="${jboss.remote.outbound.connection.host3}"/> -->
        </ejb-receivers>
    </client-context>
</jboss-ejb-client>


For more details refer to:
"https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project" which tells us different way of remote EJB location.
于 2014-04-21T11:43:16.897 に答える
0

アプリケーション サーバーとして JBOSS を使用している場合、実際にはjboss-client.jarは必要ありません。次のプロパティを initialContext または jndi.propeties ファイルに追加してください。すべて問題ありません。

jboss.naming.client.ejb.context=true

また、Jboss 以外のスタンドアロン クライアントまたはサーバーから呼び出す場合を除き、プロパティを削除してください。

java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

これらの設定で試してください。

于 2014-04-24T12:22:37.497 に答える