Dain Sundstrom wrote:
>
>
>
> On Jun 5, 2008, at 2:52 AM, uglything wrote:
>
>>
>> Nothing complex... But Tomcat tries to load MyWebApp before openejb,
>> as
>> expected from the specifications... Hence the deployment fails.
>>
>>
>>
>> Well, to address that, I tried to add explicitely the openejb
>> context before
>> MyWebApp :
>>
>>
>>
>> <Context docBase="openejb" />
>> <Context docBase="../../target/MyWebApp" />
>
> If you add the OpenEJBListener to the server.xml file, OpenEJB will
> always initialize first. Simply copy the openejb-javaagent.jar file
> to the Tomcat lib directory, and add this declaration at the top of
> the server.xml file:
>
>
>
>
> Since Tomcat starts components in the order they are declared in the
> server.xml file, OpenEJB will guaranteed to be running by the time
> your application is deployed.
>
> -dain
>
>
>
Thanks dain, that was helpful.
I installed the javaagent and the openejb context loads at tomcat startup
prior to anything else.
Now my context discovered in the webapps loads at the correct time.
I still have a problem when I explicitely set a new context in the
server.xml...
OpenEJB loads first, but when MyWebApp loads, the following exception arises
:
ERROR - Unable to load web.xml in war testMain: Exception: Cannot read the
web.xml file: jndi:/localhost/testMain/WEB-INF/web.xml: null
org.apache.openejb.OpenEJBException: Cannot read the web.xml file:
jndi:/localhost/testMain/WEB-INF/web.xml: null
at
org.apache.openejb.config.ReadDescriptors.readWebApp(ReadDescriptors.java:474)
at
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.createWebModule(TomcatWebAppBuilder.java:595)
at
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:526)
at
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:229)
at
org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:58)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4239)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at
org.apache.catalina.core.StandardService.start(StandardService.java:516)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.io.FileNotFoundException
at
org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:298)
at java.net.URL.openStream(URL.java:1007)
at
org.apache.openejb.config.ReadDescriptors.readWebApp(ReadDescriptors.java:468)
... 19 more
Strange, isn't it ?
The rest of the ejb-jars loads correctly, but I have a problem then in a
servlet :
INFO - schema update complete
INFO - Jndi(name=ConcreteChildOneManagerImplLocal) -->
Ejb(deployment-id=ConcreteChildOneManagerImpl)
INFO - Created Ejb(deployment-id=ConcreteChildOneManagerImpl,
ejb-name=ConcreteChildOneManagerImpl, container=Default Stateless Container)
INFO - Jndi(name=MyTestBeanLocal) --> Ejb(deployment-id=MyTestBean)
INFO - Created Ejb(deployment-id=MyTestBean, ejb-name=MyTestBean,
container=Default Stateless Container)
INFO - Jndi(name=ConcreteChildTwoManagerImplLocal) -->
Ejb(deployment-id=ConcreteChildTwoManagerImpl)
INFO - Created Ejb(deployment-id=ConcreteChildTwoManagerImpl,
ejb-name=ConcreteChildTwoManagerImpl, container=Default Stateless Container)
INFO - Deployed
Application(path=D:\projets\CCV-Core\CCV-Core-TestMain\tomcat1\webapps\..\..\target\CCV-Core-TestMain-0.0.1-SNAPSHOT)
6 juin 2008 11:46:17 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Erreur lors de la configuration de la classe d'écoute de
l'application (application listener) LaunchTest
javax.naming.NameNotFoundException: Le Nom LaunchTest n'est pas lié à ce
Contexte
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at
org.apache.catalina.util.DefaultAnnotationProcessor.lookupFieldResource(DefaultAnnotationProcessor.java:203)
at
org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:139)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3777)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at
org.apache.catalina.core.StandardService.start(StandardService.java:516)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
6 juin 2008 11:46:17 org.apache.catalina.core.StandardContext listenerStart
The message of the exception could be translated in plain ol' english as
follow :
ERROR: Error while configuring the application listener LaunchTest
javax.naming.NameNotFoundException: The Name LaunchTest isn't bound to any
context
Here is the source for the listener, which by the way works just fine
without declaring the context in the servlet.xml :
import javax.ejb.EJB;
import javax.naming.NamingException;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import test.beans.TestBean;
public class LaunchTest implements ServletContextListener {
@EJB
private TestBean bean;
public void contextDestroyed(ServletContextEvent arg0) {
}
public void contextInitialized(ServletContextEvent arg0) {
try {
System.out.println("/***************************************/");
System.out.println("/* run
*/");
System.out.println("/***************************************/");
bean.run();
} catch (NamingException e) {
throw new RuntimeException(e);
}
}
}
The context in the servlet.xml is declared as follow:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="../../target/CCV-Core-TestMain-0.0.1-SNAPSHOT"
path="testMain"/>
</Host>
CCV-Core-TestMain-0.0.1-SNAPSHOT is the real name for MyWebApp...
Anyway, thanks a lot for your help.
I greatly appreciate the responsiveness of the OpenEJB crew.
Cheers,
Juan Manuel
--
View this message in context:
http://www.nabble.com/OpenEJB.war-outside-webapps-tp17666227p17688720.html
Sent from the OpenEJB User mailing list archive at Nabble.com.