Weining Qi writes:

> if you are running tomcat 3.x in the same window (tomcat run), look at the
> feedback from tomcat when call the ejb that way, you can see that tomcat 
> does not recognize the namespace "java:com/env/" for calling ejb as 
  The name is "java:comp/ejb"  NOT --------------.
  And yes tomcat does recognize it!!!!
  Because it is defined in web.xml as shown in the snip.

> the sun j2ee specification v1.3. you should call ejb directly by its jndi 
> name, which you gave when you deployed it.
I tried that, it does not work.  I get "NamingException".
Note: the EJB is deployed in a different machine than tomcat.  
When I try to open the context to that machine directly from a servlet in
tomcat, I get:
javax.naming.NoInitialContextException: Cannot instantiate class:
org.jnp.interfaces.NamingContextFactory.  Root exception is
java.lang.ClassCastException: org.jnp.interfaces.NamingContextFactory
    at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:659)
    at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250)
    at javax.naming.InitialContext.init(InitialContext.java:226)
    at javax.naming.InitialContext.<init>(InitialContext.java:202)
    at SimpleServlet.printContextInfo(SimpleServlet.java:168)
    at SimpleServlet.doIt(SimpleServlet.java:99)
    at SimpleServlet.doGet(SimpleServlet.java:30)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:573)
    at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:321)
    at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:236)
    at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:386)
    at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:144)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:140)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:180)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:140)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:180)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
    at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
    at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:464)
    at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
    at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
    at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
    at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
    at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
    at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
    at java.lang.Thread.run(Thread.java:484)

YET: this same code works when I run it from a standalone Java application.
I believe that tomcat's InitialContext() is preventing the remote
connection from being established.

> 
> Weining
> ================================
> Weining Qi
> RabobankICT and Info.nl, Amsterdam
> IPO, TU/e, Eindhoven, The Netherlands
> http://weining.n3.net/
> Tel: +31.628161183
> 
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, March 09, 2001 5:55 PM
> Subject: <ejb-ref> <ejb-link> Implementation in 4.0.b1
> 
> 
> >
> > I am trying to obtain a remote reference to an EJB in another machine.
> > I have set the ejb-ref in web.xml as follows:
> > <ejb-ref>
> >     <description>Sample bean generated by coolgen placed here for ease of
> >                      early testing</description>
> >     <ejb-ref-name>ejb/S_STRESS_32K</ejb-ref-name>
> >     <ejb-ref-type>Session</ejb-ref-type>
> >     <home>cool.models.coop07.java.S_STRESS_32KpsHome</home>
> >     <remote>cool.models.coop07.java.S_STRESS_32Kps</remote>
> >     <ejb-link>jndi:/ttt1.ca.com:1099/S_STRESS_32Kps</ejb-link>
> > </ejb-ref>
> > However, when I do ctx.lookup("java:/comp/ejb/S_STRESS_32K") I get a null
> > reference instead of the necessary remote reference to the home interface.
> > Is ejb-link implemented and documented?
> > Which code is involved in ejb-link lookup?
> > Is this fixed in the latest 4.0?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to