0
私は、JBossサーバーと別のJBossサーバーの下で実行されているEJBステートレスを持っています。クライアント側でcontext.lookup(...)は、ejb3リモートオブジェクトインターフェイスにオブジェクトを返しました
、私は次のコードを使用しています:このコードを実行中
final Properties initialContextProperties = new Properties();
initialContextProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
initialContextProperties.put(Context.PROVIDER_URL, "remote://127.0.0.1:8083");
initialContextProperties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
initialContextProperties.put("jboss.naming.client.ejb.context", true);
final InitialContext contexte = new InitialContext(initialContextProperties);
Object remoteObj = contexte.lookup("ejb:my-web-app/MyEjbRemoteImpl!my.ejb.remote.MyEjbRemoteInterface");
MyEjbRemoteInterface myEjb = (my.ejb.remote.MyEjbRemoteInterface) remoteObj;
を、私はこの例外を持っている:
org.jboss.ejb.client.naming.ejb.EjbNamingContext cannot be cast to my.ejb.remote.MyEjbRemoteInterface
は、これらの依存関係は、クライアント側のクラスパスにあります:
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-remote-naming</artifactId>
<version>2.0.4.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-nio</artifactId>
<version>3.3.6.Final</version>
</dependency>
ご存知ですか?
問題は、ルックアップメソッドの文字列パラメータにあったあなたの助けをありがとう
+0
aribeiro
セクション[リモートアクセスJNDIオブジェクトの前提条件]で述べたように(https://docs.jboss.org/author/display/AS72/ JBossのドキュメンテーションの* Remote + EJB + invocations + + JNDI + - + EJB + client + API +または+ remote-naming + project)*リモートネーミングプロジェクトを使用しているときに使用されるJNDI名は常に** java: jboss/exported/**名前空間*。したがって、検索文字列から 'ejb:'を削除する必要があります。 –