tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Bugayenko <e...@technoparkcorp.com>
Subject Re: OpenEJB + Jetty = JNDI conflict
Date Mon, 07 Mar 2011 07:32:20 GMT
Hi Jonathan,

Thanks for your response! I already decided to try Tomcat instead of Jetty
and looks like there is some progress. Actually all my integration tests
(empowered by JSFUnit) work fine, but the problem is that during Tomcat
shutdown OpenEJB goes into endless cycle and crashes Maven:

java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at
java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
        at java.util.concurrent.FutureTask.get(FutureTask.java:83)
        at org.apache.openejb.util.Memoizer.compute(Memoizer.java:53)
        at org.apache.openejb.util.Logger.getInstance(Logger.java:145)
        at org.apache.openejb.util.Logger.getInstance(Logger.java:168)
        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:918)
        at java.lang.reflect.Field.getFieldAccessor(Field.java:899)
        at java.lang.reflect.Field.get(Field.java:358)
        at
org.apache.catalina.loader.WebappClassLoader.clearReferencesStaticFinal(WebappClassLoader.java:2031)
        at
org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1894)
        at
org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1798)
        at
org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:738)
        at
org.apache.catalina.core.StandardContext.stop(StandardContext.java:4812)
        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:450)
        at org.apache.catalina.startup.Embedded.stop(Embedded.java:867)
        at
org.codehaus.mojo.tomcat.EmbeddedRegistry.shutdownAll(EmbeddedRegistry.java:108)
        at
org.codehaus.mojo.tomcat.ShutdownMojo.execute(ShutdownMojo.java:54)
        at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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:597)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
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:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at org.apache.openejb.util.Memoizer.compute(Memoizer.java:49)
        ... 41 more


I will investigate it further and let you know the details. The good thing
is that tests work.

—
Yegor Bugayenko



On Sun, Mar 6, 2011 at 8:44 PM, Jonathan Gallimore <
jonathan.gallimore@gmail.com> wrote:

> Hi Yegor,
>
> We have started work on some integration between Jetty and OpenEJB, but
> unfortunately its not quite there yet. As Stephen says, basically what we do
> is let Jetty manage most of JNDI, just adding our stuff under java:openejb
> and then we parse web.xml and any servlet annotations and we wire up the
> necessary LinkRefs for java:comp/env.
>
> We do this where I work and I wrote up something about this a while back:
> http://openejb.apache.org/functional-testing-with-openejb-jetty-and-selenium.html.
> Its also worth checking out the Jetty source code we have in SVN:
> https://svn.apache.org/repos/asf/openejb/trunk/openejb3/assembly/openejb-jetty/- its
pretty basic, but it does seem to work.
>
> I've grabbed a checkout of your project and I'll take a look at it over the
> next couple of days and see if I can suggest anything.
>
> As I mentioned previously, our Jetty integration isn't there yet - if you
> or anyone reading this fancies helping out, it would definitely be
> appreciated and I'd be more than happy to help out.
>
> If you can get Jetty/OpenEJB working for your integration tests, its well
> worth it, we use where I work and its great to be able to do a checkout and
> run the tests without having to setup a particular environment.
>
> Hope that's some help.
>
> Jon
>
>
> On Sun, Mar 6, 2011 at 11:56 AM, Yegor Bugayenko <egor@technoparkcorp.com>wrote:
>
>> Hi Stephen, thanks for response. I've seen your article about it, but
>> unfortunately it doesn't help.
>>
>> Maybe you know how to make integration tests working with OpenEJB? I tried
>> Tomcat+OpenEJB with no luck and Jetty+OpenEJB with the same result :(
>>
>> Shall I try Glassfish?
>>
>> —
>> Yegor Bugayenko
>>
>>
>>
>> On Sat, Mar 5, 2011 at 12:35 PM, Stephen Connolly <
>> stephen.alan.connolly@gmail.com> wrote:
>>
>> > I had this problem also.
>> >
>> > I did get a partial working solution.
>> >
>> > You end up leaving OpenEJB to handle it's JNDI and leave Jetty handling
>> > its.
>> >
>> > Then you essentially sync between the two JNDI scopes.
>> >
>> > I also had another solution whereby I modifies the jetty-plus to work
>> > around a NPE when using jetty's JNDI from OpenEJB.
>> >
>> > Now that got your hopes up.... here comes the hope-dash
>> >
>> > That was all work for my previous employer.
>> >
>> > That work remains the property of my previous employer.
>> >
>> > So I no longer have the source code.
>> >
>> > But one of the two solutions above works... you just need to persist in
>> the
>> > hackyness to get there
>> >
>> > -Stephen
>> >
>> >
>> > On 4 March 2011 21:17, Yegor Bugayenko <egor@technoparkcorp.com> wrote:
>> >
>> >> I'm trying to test my WAR application in-container with Jetty and
>> OpenEJB.
>> >> I'm not sure that my understanding of the situation is correct, but
>> looks
>> >> like:
>> >>
>> >> 1. Jetty has its own jndi.properties where java.naming.factory.initial
>> is
>> >> set to Jetty class (org.mortbay.naming.InitialContextFactory). This
>> >> setting
>> >> is overlapping my own jndi.properties.
>> >>
>> >> 2. To resolve this overriding I'm explicitly providing the value of
>> this
>> >> property via <systemProperty> in pom.xml:
>> >>
>> >>  <systemProperty>
>> >>    <name>java.naming.factory.initial</name>
>> >>    <value>org.apache.openejb.client.LocalInitialContextFactory</value>
>> >>  </systemProperty>
>> >>
>> >> 3. Now Jetty can't work with OpenEJB JNDI, and very strange
>> >> NullPointerExceptions are being thrown. Like the following:
>> >>
>> >> javax.naming.NamingException [Root exception is
>> >> java.lang.NullPointerException]
>> >> at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:588)
>> >>  at
>> javax.naming.spi.NamingManager.getURLContext(NamingManager.java:533)
>> >> at
>> >>
>> >>
>> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:320)
>> >>  at javax.naming.InitialContext.lookup(InitialContext.java:392)
>> >> at
>> >>
>> >>
>> org.eclipse.jetty.plus.webapp.EnvConfiguration.deconfigure(EnvConfiguration.java:120)
>> >>  at
>> org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:528)
>> >> at
>> >>
>> >>
>> org.mortbay.jetty.plugin.JettyWebAppContext.doStop(JettyWebAppContext.java:168)
>> >>  at
>> >>
>> >>
>> org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:80)
>> >> at
>> >>
>> >>
>> org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection.java:235)
>> >>  at
>> >>
>> >>
>> org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:80)
>> >> at
>> >>
>> >>
>> org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection.java:235)
>> >>  at
>> >>
>> >>
>> org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:80)
>> >> at
>> >>
>> >>
>> org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:106)
>> >>  at org.eclipse.jetty.server.Server.doStop(Server.java:300)
>> >> at
>> >>
>> >>
>> org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:80)
>> >>  at org.mortbay.jetty.plugin.Monitor.run(Monitor.java:102)
>> >> Caused by: java.lang.NullPointerException
>> >> at
>> >>
>> >>
>> org.apache.openejb.core.ivm.naming.java.javaURLContextFactory.getContext(javaURLContextFactory.java:41)
>> >>  at
>> >>
>> >>
>> org.apache.openejb.core.ivm.naming.java.javaURLContextFactory.getObjectInstance(javaURLContextFactory.java:34)
>> >> at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:584)
>> >>  ... 15 more
>> >>
>> >> My pom.xml is here:
>> >>
>> http://trac.fazend.com/rempl/browser/rempl/trunk/rempl/rempl-oss/pom.xml
>> >>
>> >> I tried to raise a similar question at stackoverflow:
>> >> http://stackoverflow.com/questions/5172788. Still no answer. Maybe
>> >> someone
>> >> in this mailing list can help?
>> >>
>> >> —
>> >> Yegor Bugayenko
>> >>
>> >
>> >
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message