tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Gallimore <jonathan.gallim...@gmail.com>
Subject Re: OpenEJB + Jetty = JNDI conflict
Date Sun, 06 Mar 2011 19:44:02 GMT
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