Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Cannot deploy a WAB in OSGi Jetty 9 because of javax.naming.NameNotFoundException; remaining name 'java:comp'

Hi Jan,

Thanks for the reply. I have the 2 calls on jetty.xml for java.naming.factory.initial and java.naming.factory.url.pkgs, like I mentioned, it's all on the link to StackOverflow I sent, I posted it there because I can't place the attachments for the exception or my jetty.xml here on the email message.

My OSGi container is a plain Felix 5.0.0 downloaded from felix.apache.org and it only has the gogo bundles to get the command line.

The bundles I have deployed I chose them because the OSGi page on the Jetty documentation mentions them as needed http://eclipse.org/jetty/documentation/current/framework-jetty-osgi.html I only selected the servlet and annotation support ones, as I haven't been able to make the JSP support bundles work correctly with either the Glassfish or the Apache bundles, on deploy they kill my Felix instance, so the documentation is wrong there as well.

The packages from org.eclipse.jetty are all version 9.2.10.v20150310

The packages I have deployed are:
org.eclipse.jetty.osgi: jetty-osgi-boot
org.eclipse.jetty: jetty-util
org.eclipse.jetty: jetty-http
org.eclipse.jetty: jetty-io
org.eclipse.jetty: jetty-security
org.eclipse.jetty: jetty-server
org.eclipse.jetty: jetty-servlet
org.eclipse.jetty: jetty-webapp
org.eclipse.jetty: jetty-deploy
org.eclipse.jetty: jetty-xml
org.eclipse.jetty.toolchain: jetty-osgi-servlet-api 3.1.0.M3
javax.servlet: javax.servlet-api 3.1.0
org.eclipse.jetty: jetty-jndi
org.eclipse.jetty: jetty-plus
org.eclipse.jetty: jetty-annotations
org.eclipse.jetty.orbit: javax.mail.glassfish 1.4.1.v201005082020
org.ow2.asm: asm 5.0.3
org.ow2.asm: asm-commons 5.0.3
org.ow2.asm: asm-tree 5.0.3
org.apache.aries: org.apache.aries.util 1.1.0
org.apache.aries.spifly: org.apache.aries.spifly.dynamic.bundle 1.0.1
javax.annotation: javax.annotation-api 1.2

And I'm also going to need Jersey support so I have also deployed these (all version 2.17):
org.glassfish.jersey.core: jersey-server
org.glassfish.jersey.core: jersey-common
org.glassfish.jersey.containers: jersey-container-jetty-servlet
org.glassfish.jersey.media: jersey-media-json-jackson

But I have tried it without having the Jersey bundles deployed and get the error, so I think it's not that.

As you can see, it's all the packages mentioned in the OSGi documentation, and the 3 configurations files in the etc folder (jetty.xml, jetty-selector.xml and jetty-deployer.xml) I took them from https://eclipse.googlesource.com/jetty/org.eclipse.jetty.project/+/jetty-9.2.x/jetty-osgi/jetty-osgi-boot/jettyhome/etc/ because the files are nowhere to be found on the documentation, I actually added an issue on the github.com for Jetty documentation on this. I use the default files, I didn't do any modifications to them.

And you know what, I don't use JNDI whatsoever, so if I could disable it altogether it would be awesome, but apparently the jetty-plus and jetty-annotation bundles depend on it, and I do need the servlet annotation support.

How do I enable JNDI logging?

Thanks.

Raul

 

Date: Tue, 19 May 2015 08:45:33 +1000
From: Jan Bartel <janb@xxxxxxxxxxx>
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] Cannot deploy a WAB in OSGi Jetty 9 because
        of javax.naming.NameNotFoundException; remaining name 'java:comp'
Message-ID:
        <CALg=Vpgs_5Dq6d0-p7g1m7qgp7TGATdYr1+2XY5mY4kXZJ4b0A@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8

Raul,

Can you post what osgi environment you are deploying into, and what
version. Please also post the list of bundles that you have deployed.

The jndi exception is odd. The jndi mechanism is only used if
appropriate jndi classes are detected on the classpath. So it looks
like those classes are detected. However, I can see that the setup is
not correct, because the lookup for "java:comp" is being done in the
default server namespace instead of the special "java:" namespace
provided by jetty.

To setup the "java:" namespace correctly, jetty needs some system
properties defined. These are in the jetty.xml file here:

 <Call class="java.lang.System" name="setProperty">
      <Arg>java.naming.factory.initial</Arg>
      <Arg><Property name="java.naming.factory.initial"
default="org.eclipse.jetty.jndi.InitialContextFactory"/></Arg>
    </Call>
    <Call class="java.lang.System" name="setProperty">
      <Arg>java.naming.factory.url.pkgs</Arg>
      <Arg><Property name="java.naming.factory.url.pkgs"
default="org.eclipse.jetty.jndi"/></Arg>
    </Call>

The second of those properties is required for "java:" namespace.

Can you dump your osgi setup environment to double check that those
values are set?

Please also post the output you get if you run with logging enabled
for org.eclipse.jetty.jndi  package.

Jan


On 19 May 2015 at 03:23, Ra?l Guerrero Deschamps <raul@xxxxxxxxxxx> wrote:
> I'm trying to deploy a simple WAB application inside an OSGi container that
> has installed the Jetty 9.2.10 bundles and the JAX-RS Jersey 2.17 bundles.
>
> All the bundles start correctly and without issues, and when I install my
> WAB it also installs correctly, but when I start my WAB it sends a JNDI name
> not found exception, it's really odd because I don't use JNDI whatsoever in
> my WAB, and the name that the exception is referencing is completely bogus,
> because it just states the missing JNDI resource name is 'java:comp', which
> is just the Jetty prefix for JNDI resources, so some Jetty bundle must be
> trying to setup an empty JNDI resource which causes the problem.
>
> 2015-05-15 23:48:29.968:WARN:oejw.WebAppContext:FelixDispatchQueue: Failed
> startup of context
> o.e.j.w.WebAppContext@5718e0e{/wab,file:/private/var/folders/3h/w04868ln4j30dwqdscvy8wnw0000gn/T/jetty-0.0.0.0-8080-wab-sample-1.0.0.war-_wab-any-3819588013061278932.dir/webapp/,null}{file:/Users/****/NetbeansProjects/*****/target/bundle/wab-sample-1.0.0.war}
> javax.naming.NameNotFoundException; remaining name 'java:comp'
>
> I posted this issue in stackoverflow where I have the full exception and my
> jetty.xml configuration file.
>
> Thanks for the help!
>
http://stackoverflow.com/questions/30272184/cannot-deploy-a-wab-in-osgi-jetty-9-because-of-javax-naming-namenotfoundexceptio
>
>
>
>
>
> _______________________________________________
> jetty-users mailing list
jetty-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top