This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I used pramati studip 3.0 and JBoss 3.0.4 PROBLEM: i am not able to do a llok up on the beans running on the server. SITUATION:: I have written a session bean which communicates with an entity bean. I deployed them on JBoss 3.0.4 and they were succesfully deployed. Here is the server console 14:30:45,015 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-3.0.4/ser ver/default/deploy/Meka.ear 14:30:45,171 INFO [EjbModule] Creating 14:30:45,171 INFO [EjbModule] Deploying Entity 14:30:45,328 INFO [EjbModule] Deploying Session 14:30:45,390 INFO [EjbModule] Created 14:30:45,390 INFO [EjbModule] Starting 14:30:46,765 INFO [Entity] Created table 'ENTITY' successfully. 14:30:46,781 INFO [EjbModule] Started 14:30:46,859 INFO [jbossweb] Registered jboss.web:Jetty=0,JBossWebApplicationCo ntext=2,context=/MekaWeb 14:30:46,906 INFO [jbossweb] Extract jar:file:/C:/jboss-3.0.4/server/default/tm p/deploy/server/default/deploy/Meka.ear/58.Meka.ear-contents/MekaWeb.war!/ to C: \DOCUME~1\ADMINI~1\LOCALS~1\Temp\Jetty_0_0_0_0_8080__MekaWeb\webapp 14:30:47,187 INFO [jbossweb] Started WebApplicationContext[/MekaWeb,MekaWeb] 14:30:47,203 INFO [jbossweb] successfully deployed file:/C:/jboss-3.0.4/server/ default/tmp/deploy/server/default/deploy/Meka.ear/58.Meka.ear-contents/MekaWeb.w ar to /MekaWeb 14:30:47,203 INFO [MainDeployer] Deployed package: file:/C:/jboss-3.0.4/server/ default/deploy/Meka.ear 14:30:47,218 INFO [URLDeploymentScanner] Started 14:30:47,218 INFO [MainDeployer] Deployed package: file:/C:/jboss-3.0.4/server/ default/conf/jboss-service.xml 14:30:47,218 INFO [Server] JBoss (MX MicroKernel) [3.0.4 Date:200211021607] Sta rted in 0m:18s:906ms Now i have written a client which looks up the session bean as below
Session_LocalHome session_lh = (Session_LocalHome) ctx.lookup("java:comp/env/Session_LocalHome"); Session_Local session_local = session_lh.create(); I am getting the following error javax.naming.NameNotFoundException: comp not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:495) at org.jnp.server.NamingServer.getBinding(NamingServer.java:503) at org.jnp.server.NamingServer.getObject(NamingServer.java:509) at org.jnp.server.NamingServer.lookup(NamingServer.java:253) at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4 60) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport .java:701) at java.lang.Thread.run(Thread.java:536) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream RemoteCall.java:247) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java: 223) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133) at org.jnp.server.NamingServer_Stub.lookup(Unknown Source) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:456) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:440) at javax.naming.InitialContext.lookup(InitialContext.java:347) at Client.<init>(Client.java:39) at Client.main(Client.java:87)
I have tried to look in the internet for a long time but could not get enough help. I have even looked a couple of books but i havent been able to get proper help. And yeah i am trying to look up beans on LocalHome interfaces because client and beans are on same JVM (same machine). Thank You Meka Toka
Unfortunately you won't be able to lookup a reference to a local EJB from outside of the JVM, regardless of whether the client and server are on the same machine. You have a couple of options... (1) You could make your session bean remote. (2) You could write a web (servlet/JSP) client that runs in the same JVM. Whichever you choose, you must also ensure that you are using the correct JNDI name (e.g. the one defined in the jboss.xml file). Hope that helps Simon
Joined: Dec 11, 2002
Hi, The earlier problem was because there was no name-to-object binding at location where i was doing a lookup. And also my client.jar was not properly done. I resolved the javax.naming.NameNotFoundException. Now i am doing a lookup on the remote interface of the session bean, but i am getting a javax.naming.CommunicationException. From what i gathered on the net, alot of people have said it might be because client.jar is not included in the classpath. But my client.jar is included in classpath. What is that i am missing here ? Thank You Meka Toka