JBoss AS 7.1.0 and The invincible javax.naming.NameNotFoundException
randahl Mar 8, 2012 2:41 PMI am trying to connect to a stateless EJB from a desktop client application and it works partially – I can contact the server, but no matter how I try to name the EJB, I get a NameNotFoundException. If anyone could give me a hint to things I could try out, I would be grateful.
My environment:
Server Side
JBoss 7.1.0
My EAR: wefend-server.ear
My EJB archive: wefend-server-ejb
My bean: AuthenticationBean
My remote business interface: Authentication
JNDI bindings reported by JBoss 7.1.0 console log:
20:11:06,967 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-15) JNDI bindings for session bean named AuthenticationBean in deployment unit subdeployment "wefend-server-ejb.jar" of deployment "wefend-server.ear" are as follows:
java:global/wefend-server/wefend-server-ejb/AuthenticationBean!com.wefend.server.authentication.Authentication
java:app/wefend-server-ejb/AuthenticationBean!com.wefend.server.authentication.Authentication
java:module/AuthenticationBean!com.wefend.server.authentication.Authentication
java:jboss/exported/wefend-server/wefend-server-ejb/AuthenticationBean!com.wefend.server.authentication.Authentication
java:global/wefend-server/wefend-server-ejb/AuthenticationBean
java:app/wefend-server-ejb/AuthenticationBean
java:module/AuthenticationBean
Client Side
Maven dependencies:
<dependency> | |||
<groupId>org.jboss.as</groupId> | |||
<artifactId>jboss-as-ejb-client-bom</artifactId> | |||
<type>pom</type> | |||
<version>7.1.0.Final</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.jboss.as</groupId> | |||
<artifactId>jboss-as-jms-client-bom</artifactId> | |||
<type>pom</type> | |||
<version>7.1.0.Final</version> | |||
</dependency> |
jboss-ejb-client.properties:
remote.connections=default
endpoint.name=client-endpoint
remote.connection.default.port=4447
remote.connection.default.host=127.0.0.1
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
The lookup:
Properties properties = new Properties();
properties.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(javax.naming.Context.PROVIDER_URL, "remote://localhost:4447");
properties.put(javax.naming.Context.SECURITY_PRINCIPAL, "test");
properties.put(javax.naming.Context.SECURITY_CREDENTIALS, "1234");
javax.naming.Context context = new InitialContext(properties);
String viewClassName = Authentication.class.getName();
Authentication authentication =
(Authentication) context.lookup("ejb:/wefend-server/wefend-server-ejb//AuthenticationBean!" + viewClassName");
Exception
javax.naming.NameNotFoundException: ejb:/wefend-server/wefend-server-ejb//AuthenticationBean!com.wefend.server.authentication.Authentication -- service jboss.naming.context.java.jboss.exported.ejb:.wefend-server.wefend-server-ejb."AuthenticationBean!com.wefend.server.authentication.Authentication"
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:177)
at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:124)
at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:70)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)