On Mar 27, 2009, at 10:47 PM, [email protected] wrote:

Hi!
Background:
I have embedded OpenEJB 3.1 in a web application which uses Spring and runs in Tomcat 6. No OpenEJB stuff has been installed in Tomcat, so Spring is "in charge" of the OpenEJB instance. I also enable remote access of EJBs deployed in the application. Everything works very well until I shut down the server or try to redeploy the application, then I get the following exceptions which repeats endlessly:

I've never tried this myself and I'm not aware of anyone who has, so I can't guarantee it will work. That said, it would be a great feature to have, so if you're willing to rollup your sleeves, we can give it a shot.

Seems there's something about the WebappClassLoader.clearReferences() that is attempting to do some cleanup which is actually causing a class (SimpleWorkManager) to get loaded. Why the class isn't loading successfully is less strange to me as why is Tomcat attempting to clean it? My gut says that's the first place to investigate.

Maybe not related, but are all the openejb libraries in the WEB-INF/ lib or somewhere in Tomcat itself? I suspect that the only way this might work is if everything is in the WEB-INF/lib.

One key point is to make sure you're not using the org.apache.openejb.tomcat.loader.LoaderServlet as that is designed specifically for the standard OpenEJB in Tomcat integration and will result in the opposite effect than what you want.

-David


INFO - Undeploying app: classpath.ear
java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java: 205)
    at java.util.concurrent.FutureTask.get(FutureTask.java:80)
    at org.apache.openejb.util.Memoizer.compute(Memoizer.java:53)
    at org.apache.openejb.util.Logger.getInstance(Logger.java:141)
    at org.apache.openejb.util.Logger.getInstance(Logger.java:164)
at org .apache .openejb .core.transaction.SimpleWorkManager.<clinit>(SimpleWorkManager.java: 49)
    at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun .reflect .UnsafeFieldAccessorFactory .newFieldAccessor(UnsafeFieldAccessorFactory.java:25) at sun .reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java: 122)
    at java.lang.reflect.Field.acquireFieldAccessor(Field.java:917)
    at java.lang.reflect.Field.getFieldAccessor(Field.java:898)
    at java.lang.reflect.Field.get(Field.java:357)
at org .apache .catalina .loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1641) at org .apache .catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1524) at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:707) at org.apache.catalina.core.StandardContext.stop(StandardContext.java: 4557) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098) at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448) at org.apache.catalina.core.StandardService.stop(StandardService.java: 584) at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
    at org.apache.catalina.startup.Catalina.stop(Catalina.java:628)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:603)
    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.lang.NullPointerException
    at org.apache.openejb.util.Memoizer$1.call(Memoizer.java:42)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java: 269)
    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
    at org.apache.openejb.util.Memoizer.compute(Memoizer.java:49)
    ... 26 more

I have tried to add the following code, in order to clean up at time of shut down, but to no avail:
        Assembler theAssembler =
            SystemInstance.get().getComponent(Assembler.class);
for (AppInfo theAppInfo : theAssembler.getDeployedApplications())
        {
            try
            {
                theAssembler.destroyApplication(theAppInfo.jarPath);
            } catch (final Exception theException)
            {
                /* Shutting down, so ignore exceptions. */
            }
        }
        OpenEJB.destroy();

I have tried to set the openejb.deployments.classpath.ear flag both to true and to false, also to no avail.
Does anyone have any idea on how to remedy this?
Many thanks in advance!

Reply via email to