[jboss-user] [EJB/JBoss] - JNDI Lookup error after deploying EJB3 jar as a part of J2EE

irajeev do-not-reply at jboss.com
Mon Dec 31 17:16:30 EST 2007


hi,
     I have deployed the EJB3 jar(having 1 stateless session EJB) in the J2EE 1.4 EAR in JBOSS 4.0.4. The log file and the JNDI dump(from the JMX admin screen) show that the EJB has been deployed. But when I try to lookup the EJB from an external standalone java program I get the following exception,

javax.naming.NameNotFoundException: TestBean not bound
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
	at sun.rmi.transport.Transport$1.run(Transport.java:153)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
	at java.lang.Thread.run(Thread.java:595)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
	at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
	at javax.naming.InitialContext.lookup(Unknown Source)
	at com.test.test.TestClient123.main(TestClient123.java:35)
Exception in thread "main" java.lang.RuntimeException: javax.naming.NameNotFoundException: TestBean not bound
	at com.test.test.TestClient123.main(TestClient123.java:39)
Caused by: javax.naming.NameNotFoundException: TestBean not bound
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
	at sun.rmi.transport.Transport$1.run(Transport.java:153)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
	at java.lang.Thread.run(Thread.java:595)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
	at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
	at javax.naming.InitialContext.lookup(Unknown Source)
	at com.test.test.TestClient123.main(TestClient123.java:35)


My lookup code:

		Context context;
		try {
			context = new InitialContext();

			Test beanRemote = (Test)  context.lookup(TestBean.class.getSimpleName()+"/remote");

			beanRemote.test();

		} catch (NamingException e) {
			e.printStackTrace();
			throw e;
		}


And if I deploy the EJB jar separately instead of as a part of EAR then I am able to lookup. Does the lookup name change if I deploy it in an EAR file?

Thanks in advance...
Rajeev

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116209#4116209

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116209



More information about the jboss-user mailing list