This content has been marked as final.
Show 4 replies
-
1. Re: JNDI look up from ServletContextListener
nikita1828 Mar 2, 2009 12:46 PM (in response to nikita1828)I've created very simple test application to demonstrate issue.
It works fine when normal servlet calls EJB:InitialContext ctx = new InitialContext(); BPServerManagerHome home = (BPServerManagerHome) PortableRemoteObject .narrow(ctx.lookup("ejtest/BPServerManagerBean"), BPServerManagerHome.class); System.out.println("EJB call res: " + home.create().doit());
But the same code fails when it executed from Starter (ServletContextListener immplementation):20:16:48,622 ERROR [STDERR] javax.naming.NameNotFoundException: BPServerManagerBean not bound 20:16:48,622 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) 20:16:48,622 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) 20:16:48,622 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:785) 20:16:48,622 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:443) 20:16:48,622 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:399) 20:16:48,622 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713) 20:16:48,622 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673) 20:16:48,622 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351) 20:16:48,622 ERROR [STDERR] at Starter.contextInitialized(Starter.java:17) 20:16:48,622 ERROR [STDERR] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910) 20:16:48,622 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393) 20:16:48,622 ERROR [STDERR] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:367) 20:16:48,622 ERROR [STDERR] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:146) 20:16:48,622 ERROR [STDERR] at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:460) 20:16:48,622 ERROR [STDERR] at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) 20:16:48,622 ERROR [STDERR] at org.jboss.web.deployers.WebModule.start(WebModule.java:96)
I've put ear, sources and build script for this application here:
http://www.abisoft.biz/~nbelov/EJTest.zip -
2. Re: JNDI look up from ServletContextListener
jaikiran Mar 3, 2009 1:59 AM (in response to nikita1828)Looks like a deployment ordering issue. I guess the war is deployed before the ejb jar. Similar to what is noted here http://www.jboss.org/index.html?module=bb&op=viewtopic&t=146745&start=0#4213523
-
3. Re: JNDI look up from ServletContextListener
nikita1828 Mar 4, 2009 8:24 AM (in response to nikita1828)Yes. Looks like you were right. I've switched to JBoss 5.0.1.GA, and added to conf\bootstrap\deployers.xml:
<bean name="topContextComparator"> <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/> <property name="suffixOrder" class="java.util.Map"> <map keyClass="java.lang.String" valueClass="java.lang.Integer"> <entry> <key>.war</key> <value>700</value> </entry> </map> </property> </bean>
Now it works. But I think it is only tempory solution. I hope future jboss versions will load ejb-jars before wars. -
4. Re: JNDI look up from ServletContextListener
mannam.tessco Jul 17, 2009 8:53 AM (in response to nikita1828)xml lines did not appear in the previous post.
<bean name="topContextComparator"> <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/> <property name="suffixOrder" class="java.util.Map"> <map keyClass="java.lang.String" valueClass="java.lang.Integer"> <entry> <key>.war</key> <value>700</value> </entry> </map> </property>