Forums Register Login

problem doing a lookup

+Pie Number of slices to send: Send
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

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put("java.naming.factory.url.pkgs",
"org.jboss.naming rg.jnp.interfaces");



try {

Context ctx = new InitialContext(env);

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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
How do they get the deer to cross at the signs? Or to read this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 845 times.
Similar Threads
EJB already registered exception
mssqlds not bound and throws NameNotFoundException
Simple EJB3 session beans not deploying in JBOSS6
NameNotFoundException - but the jndi bound
Message driven beans are not bound into remote jndi
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 21:28:13.