EAR Struts ClassNotFoundError
littlewing68 Oct 10, 2003 9:51 AMHi all,
My environment:
-J2SE 1.4.2
-jboss-3.2.1_tomcat-4.1.24
-Struts 1.1
Im trying to use the J2EE JBOSS-Tomcat server.
When i m using both jboss and tomcat separately, my application woks fine. But when i am trying to deploy an EAR in the Jboss-Tomcat throw an error 500.
the exception
2003-09-24 14:31:44,166 ERROR [Thread-7] (DispatchAction.java:307) - Dispatch[/ask] to method create returned an exception
java.lang.reflect.InvocationTargetException
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:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:252)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NoClassDefFoundError: fr/cgbi/holidays/helper/MailHelper
at fr.cgbi.holidays.helper.VacationAsksHelper.createNewAsk(VacationAsksHelper.java:76)
at fr.cgbi.holidays.action.AsksAction.create(AsksAction.java:47)
... 45 more
my application.xml
<display-name>EAR HOLIDAYS</display-name>
EAR du gestionnaire de conges
<web-uri>holidays.war</web-uri>
<context-root>/holidays</context-root>
holidays-ejb.jar
commons-j2ee-1.1.2.jar
commons-beanutils-STRUTS.jar
commons-collections-STRUTS.jar
commons-digester-STRUTS.jar
commons-fileupload-STRUTS.jar
commons-lang-STRUTS.jar
commons-logging-STRUTS.jar
commons-validator-STRUTS.jar
jakarta-oro-STRUTS.jar
struts-STRUTS.jar
struts-legacy-STRUTS.jar
REM: i have put the Struts libraries at the top of the EAR because Jboss could nt load these.
I could see in the forum that there are 2 separate ClassLoaders the first for EJBs and the second for WebApp. In the following code (which throws the ClassNoFoundError) , Jboss seems to use the bad ClassLoader (EJBClassLoader ?) after EJB calls :-(
My Code:
EJBVacationAskFacadeHome home = (EJBVacationAskFacadeHome) ServiceLocator.getLocator().getHome(EJBVacationAskFacadeHome.JNDI_NAME);
EJBVacationAskFacade facade = home.create();
facade.createNewAsk(VacationAskLineWrapper.getLines(form.getAsks()),
(....)
//The EJBClassLoader is Still used!!!!!!
MailHelper mailer = new MailHelper(props,
Config.getInstance().getProperty(ConfigKeys.MAIL_ASKS_QUERY_BODY_ADV));
// ---> EXCEPTION :-(
mailer.setToAddress(form.getEmail());
mailer.send();
I have the same exception when i m trying to deploy separately the webapp and ejb in the Jboss-Tomcat server.
Actually, I am obliged to use separately Tomcat and Jboss.
if you have a sample of EAR with Struts Webapp and EJB, I would be very interested to see that :-D
Thanks for your help and sorry for my english
Alexandre Touret