0

Eclipseで2つのプロジェクトを定義しています。1つはEJB(3.0)プロジェクトで、もう1つは動的Webプロジェクトです。

LoginAuthenticatorという名前のステートレスセッションBeanを定義し、ローカルとリモートの2つのインターフェイスを作成しました。私のEJBプロジェクトでは、JNDI.propertiesファイルを次のように定義しました。

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099

JBoss 5.0.0にjarファイルをデプロイできます。デプロイ後、コンソールに次の出力が表示されます。

LoginAuthenticator/remote - EJB3.x Default Remote Business Interface
LoginAuthenticator/remote-com.SR.enterprise.session.LoginAuthenticatorRemote - EJB3.x Remote Business Interface
LoginAuthenticator/local - EJB3.x Default Local Business Interface
LoginAuthenticator/local-com.SR.enterprise.session.LoginAuthenticatorLocal - EJB3.x Local Business Interface

別のWebプロジェクトから、セッションBeanの公開されたメソッドにアクセスするアクションクラスLoginActionを定義しました。初期コンテキストは次のように作成されます

props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(javax.naming.Context.PROVIDER_URL,"jnp://localhost:1099");
props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");

私はリモートメソッドを次のように呼び出しています

LoginAuthenticatorRemote loginAuthenticator = (LoginAuthenticatorRemote) context.lookup("LoginAuthenticator/remote");

Tomcat 6.0で2番目のプロジェクトを実行すると、次のエラーメッセージが表示されます。

javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.SocketException: Permission denied: connect]]]

service=Namingの下のjmx-consoleのポート値は1099ですservice=Namingの下のjmx-consoleのRmiPort値は1098ですservice=Nameingの下のjmx-consoleのRmiBindAddressとBindAddressは両方とも127.0.0.1です

私が得ているエラーの理由は何でしょうか?このために他に何を構成する必要がありますか?どんな助けでも大歓迎です。

4

1 に答える 1

0

私はこれに対する解決策を得ました。ファイアウォールがそのJNDIアドレスとポートでの要求をブロックしていましたが、無効にした後、接続が機能するようになりました。

于 2012-03-20T06:53:30.507 に答える