prsubject
asked on
JNDI lookup issue for an ear file
I am getting a error of jndi lookup while trying to look for the error. I am really not able to get what the correct value I am supposed to pass for the look up. Here below is what I have done
This are the steps I followed.
I have written an ejb classes, ejb-jar.xml and jboss.xml in META-INF and creaed a jar file
I wrote a servlet , created a web.xml and jboss-web.xml in WEB-INFand created a war file
I copied the jar and war in a folder, created application.xml in META-INF and created a ear file
In the servlet I wrote as
InitialContext ctx = new InitialContext();
Object objRef = ctx.lookup("ejb/session/Sa yHello");
<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>session/sayHello </ejb-name >
<jndi-name>ejb/session/say Hello</jnd i-name>
</session>
</enterprise-beans>
</jboss>
In the jboss.xml as below which I have passed in the servlet. I am getting the following error. The code on line 23 of SayHelloServlet is
Object objRef = ctx.lookup("ejb/session/Sa yHello");
Could comeone guide me.
This are the steps I followed.
I have written an ejb classes, ejb-jar.xml and jboss.xml in META-INF and creaed a jar file
I wrote a servlet , created a web.xml and jboss-web.xml in WEB-INFand created a war file
I copied the jar and war in a folder, created application.xml in META-INF and created a ear file
In the servlet I wrote as
InitialContext ctx = new InitialContext();
Object objRef = ctx.lookup("ejb/session/Sa
<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>session/sayHello
<jndi-name>ejb/session/say
</session>
</enterprise-beans>
</jboss>
In the jboss.xml as below which I have passed in the servlet. I am getting the following error. The code on line 23 of SayHelloServlet is
Object objRef = ctx.lookup("ejb/session/Sa
Could comeone guide me.
javax.naming.NameNotFoundException: session not bound
16:07:09,001 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
16:07:09,001 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
16:07:09,001 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
16:07:09,001 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
16:07:09,001 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
16:07:09,001 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
16:07:09,001 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:392)
16:07:09,001 ERROR [STDERR] at org.servlet.SayHelloServlet.init(SayHelloServlet.java:23)
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I am bit confused or not being able to catch up to what you said. This is what I have done. Please rectify me if I am wrong. Could you please guide where exactly I am supposed to see
I opened jmx console http://localhost:8080/jmx-console
There was a heading "Object Name filter" as jboss.deplopyment, jboss.cache etc under which there are a list of jboss related (application/services/filt ers)
I couldnot find one with jndi clause.
Iclicked on jboss.j2ee. Here is what I found
jndiName=ejb/session/sayHe llo,plugin =pool,serv ice=EJB
jndiName=ejb/session/sayHe llo,servic e=EJB
module="sayhello.jar",serv ice=EjbMod ule,uid=20 707280
service=EARClassLoaderDepl oyer
service=EARDeployer
Under jboss.deployment
id="ejb/sayhello.jar#sessi on/sayHell o,uid69298 3",type=Co mponent
id="jboss.j2ee:module="say hello.jar" ,service=E jbModule,u id=2070728 0",type=Co mponent
id="jboss.jacc:id="vfszip: /home/rmvp rasad/jbos s-6.0.0.M1 /server/de fault/depl oy/sayhell o.ear/",se rvice=jacc ",type=Com ponent
id="jboss.jacc:id="vfszip: /home/rmvp rasad/jbos s-6.0.0.M1 /server/de fault/depl oy/sayhell o.ear/sayh ello.jar/" ,parent="s ayhello.ea r",service =jacc",typ e=Componen t
id="jboss.jacc:id="vfszip: /home/rmvp rasad/jbos s-6.0.0.M1 /server/de fault/depl oy/sayhell o.ear/sayh ello.war/" ,parent="s ayhello.ea r",service =jacc",typ e=Componen t
I opened jmx console http://localhost:8080/jmx-console
There was a heading "Object Name filter" as jboss.deplopyment, jboss.cache etc under which there are a list of jboss related (application/services/filt
I couldnot find one with jndi clause.
Iclicked on jboss.j2ee. Here is what I found
jndiName=ejb/session/sayHe
jndiName=ejb/session/sayHe
module="sayhello.jar",serv
service=EARClassLoaderDepl
service=EARDeployer
Under jboss.deployment
id="ejb/sayhello.jar#sessi
id="jboss.j2ee:module="say
id="jboss.jacc:id="vfszip:
id="jboss.jacc:id="vfszip:
id="jboss.jacc:id="vfszip:
ASKER
What do you mean by running the list method of the service. Could you please explain
ASKER
in the jboss.j2ee I found the jndi name as jndiName=ejb/session/sayHe llo,servic e=EJB, which is not the same in the servlet. sayHello was written as SayHello(S is Caps). I rectified it. Now as I say http://localhost:8080/sayHello, it says The requested resource (/sayhello/) is not available.
ASKER
Object objRef = ctx.lookup("ejb/session/Sa