I have been trying to figure out how to deal with an ejb reference:

It is my undertanding that:
1.  The ejb-jar.xml needs to have 
ejb-name defined.  In my case this  is
 <ejb-name>HelloWorld</ejb-name>
2. The jboss.xml (and I am not clear if this is necessary, though i want to 
support clustering in the future and so cannot guarantee that everything will 
be on the same server).

      
         <ejb-name>HelloWorld</ejb-name>
         <jndi-name>/tsm/HelloWorld</jndi-name>

        <method-attributes>
        </method-attributes>


3.  The web.xml entry
   <ejb-ref>
           <ejb-ref-name>ejb/HelloWorld</ejb-ref-name>
           <ejb-ref-type>Session</ejb-ref-type>
           com.aptsi.applications.tsm.ejb.HelloWorldHome
           com.aptsi.applications.tsm.ejb.HelloWorld
           <ejb-link>HelloWorld</ejb-link>
    </ejb-ref
4.  The jboss-web.xml entry

    <ejb-ref>
            <ejb-ref-name>ejb/HelloWorld</ejb-ref-name>
            <jndi-name>/tsm/HelloWorld</jndi-name>
    </ejb-ref>

5. The code:
                        
                        try
                        {
                                System.out.println("Testing ejb access - before 
context lookup");
                                Context ctx = new InitialContext(); 
                                ctx = (Context)ctx.lookup("java:comp/env/ejb"); 
                                Object o = ctx.lookup("HelloWorld"); 
                                System.out.println("Testing ejb access - after 
context lookup");
                                HelloWorldHome home = (HelloWorldHome) 
                                        PortableRemoteObject.narrow(o, 
HelloWorldHome.class);

                                System.out.println("Testing ejb access - jndi 
op complete");
                        // get the bean remote instance
                        // 
                                try
                                {
                                        System.out.println("Testing ejb access 
- before create");
                                        HelloWorld h = home.create();
                                        System.out.println("EJB created, Need 
to test ejb access");
                                        System.out.println(h.helloWorld());
                                } 
                                catch (javax.ejb.CreateException e)
                                {                               
                                        System.out.println(e.getMessage());
                                }
                                catch (java.rmi.RemoteException e)
                                {                               
                                        System.out.println(e.getMessage());
                                }
                        }
                        catch (javax.naming.NamingException e)
                        {
                                e.printStackTrace() ;
                        }


The stack trace is:
06:56:47,937 ERROR [STDERR] javax.naming.NamingException: Could not dereference 
object [Root exception is javax.naming.NameNotFoundE
xception: tsm not bound]
06:56:47,937 ERROR [STDERR]     at 
org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:970)
06:56:47,937 ERROR [STDERR]     at 
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:613)
06:56:47,937 ERROR [STDERR]     at 
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
06:56:47,937 ERROR [STDERR]     at 
com.aptsi.applications.tsm.web.servlets.frontcontroller.RegLogout.doProcess(Unknown
 Source)
06:56:47,937 ERROR [STDERR]     at 
com.aptsi.applications.tsm.web.servlets.frontcontroller.RegLogout.doGet(Unknown 
Source)
06:56:47,937 ERROR [STDERR]     at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
06:56:47,937 ERROR [STDERR]     at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
06:56:47,937 ERROR [STDERR]     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

06:56:47,937 ERROR [STDERR]     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
06:56:47,937 ERROR [STDERR]     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:643)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:643)
06:56:47,953 ERROR [STDERR]     at 
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:643)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:641)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
06:56:47,953 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipelin
e.java:643)
06:56:47,968 ERROR [STDERR]     at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
06:56:47,968 ERROR [STDERR]     at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
06:56:47,968 ERROR [STDERR]     at 
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
06:56:47,968 ERROR [STDERR]     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
06:56:47,968 ERROR [STDERR]     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.
java:549)
06:56:47,968 ERROR [STDERR]     at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
06:56:47,968 ERROR [STDERR]     at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
06:56:47,968 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:534)
06:56:47,968 ERROR [STDERR] Caused by: javax.naming.NameNotFoundException: tsm 
not bound
06:56:47,968 ERROR [STDERR]     at 
org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
06:56:47,968 ERROR [STDERR]     at 
org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
06:56:47,968 ERROR [STDERR]     at 
org.jnp.server.NamingServer.getObject(NamingServer.java:509)
06:56:47,968 ERROR [STDERR]     at 
org.jnp.server.NamingServer.lookup(NamingServer.java:253)
06:56:47,968 ERROR [STDERR]     at 
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
06:56:47,968 ERROR [STDERR]     at 
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
06:56:47,968 ERROR [STDERR]     at 
javax.naming.InitialContext.lookup(InitialContext.java:347)
06:56:47,968 ERROR [STDERR]     at 
org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:964)
06:56:47,968 ERROR [STDERR]     ... 47 more
06:56:49,718 INFO  [STDOUT]  the action is /logout.jsp

It looks like a JNDI naming issue.  What do I need to do to fix this!.
Help!. 
Nikhil

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to