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,

The thing is that, even though I followed the test project and your recommendations, I just don't get the same packages as you!

I still get errors when trying to start some bundles, I see you get the Xalan package, but I haven't found it anywhere in maven.

I moved my Jetty version up to 9.3.0.RC0 just in case there's something new on dependencies or anything.

 here's what I get now when starting the bundles that I didn't get before, I didn't have any issues with osgi.serviceloader before but now it appears as a missing requirement:


8|Installed  |    1|Jetty :: Apache JSP Implementation (9.3.0.RC0)
org.osgi.framework.BundleException: Unable to resolve org.eclipse.jetty.apache-jsp [8](R 8.0): missing requirement [org.eclipse.jetty.apache-jsp [8](R 8.0)] osgi.extender; (osgi.extender=osgi.serviceloader.registrar) Unresolved requirements: [[org.eclipse.jetty.apache-jsp [8](R 8.0)] osgi.extender; (osgi.extender=osgi.serviceloader.registrar)]

22|Installed  |    1|Jetty :: Websocket :: Servlet Interface (9.3.0.RC0)
org.osgi.framework.BundleException: Unable to resolve org.eclipse.jetty.websocket.servlet [22](R 22.0): missing requirement [org.eclipse.jetty.websocket.servlet [22](R 22.0)] osgi.extender; (osgi.extender=osgi.serviceloader.processor) Unresolved requirements: [[org.eclipse.jetty.websocket.servlet [22](R 22.0)] osgi.extender; (osgi.extender=osgi.serviceloader.processor)]

26|Installed  |    1|Jetty :: Websocket :: Server (9.3.0.RC0)
org.osgi.framework.BundleException: Unable to resolve org.eclipse.jetty.websocket.server [26](R 26.0): missing requirement [org.eclipse.jetty.websocket.server [26](R 26.0)] osgi.extender; (osgi.extender=osgi.serviceloader.registrar) Unresolved requirements: [[org.eclipse.jetty.websocket.server [26](R 26.0)] osgi.extender; (osgi.extender=osgi.serviceloader.registrar)]

28|Installed  |    1|Jetty :: Websocket :: javax.websocket.server :: Server Implementation (9.3.0.RC0)
org.osgi.framework.BundleException: Unable to resolve org.eclipse.jetty.websocket.javax.websocket.server [28](R 28.0): missing requirement [org.eclipse.jetty.websocket.javax.websocket.server [28](R 28.0)] osgi.wiring.package; (&(osgi.wiring.package=org.eclipse.jetty.websocket.server)(version>=9.0.0)(!(version>=10.0.0))) [caused by: Unable to resolve org.eclipse.jetty.websocket.server [26](R 26.0): missing requirement [org.eclipse.jetty.websocket.server [26](R 26.0)] osgi.extender; (osgi.extender=osgi.serviceloader.registrar)] Unresolved requirements: [[org.eclipse.jetty.websocket.javax.websocket.server [28](R 28.0)] osgi.wiring.package; (&(osgi.wiring.package=org.eclipse.jetty.websocket.server)(version>=9.0.0)(!(version>=10.0.0)))]

44|Installed  |    1|JavaServer Pages (TM) TagLib Implementation (1.2.2)
org.osgi.framework.BundleException: Unable to resolve org.glassfish.web.javax.servlet.jsp.jstl [44](R 44.0): missing requirement [org.glassfish.web.javax.servlet.jsp.jstl [44](R 44.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.org.apache.xalan.internal.res) Unresolved requirements: [[org.glassfish.web.javax.servlet.jsp.jstl [44](R 44.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.org.apache.xalan.internal.res)]

63|Installed  |    1|Jetty :: Servlet Annotations (9.3.0.RC0)
org.osgi.framework.BundleException: Unable to resolve org.eclipse.jetty.annotations [63](R 63.0): missing requirement [org.eclipse.jetty.annotations [63](R 63.0)] osgi.extender; (osgi.extender=osgi.serviceloader.processor) Unresolved requirements: [[org.eclipse.jetty.annotations [63](R 63.0)] osgi.extender; (osgi.extender=osgi.serviceloader.processor)]


The way that I'm fetching the bundles is that I created a project POM that contains all the bundles as dependencies, and then using the copy-dependencies maven plugin, it copies all declared dependencies to the bundles folder in my Felix installation.

So, If you use Maven as well, what are the dependencies I need to declare so I get the same packages as you? Like I mentioned before, I have a plain vanilla Felix, so it only comes with the gogo bundles.

Also, the test project you told me to check out has a lot of dependencies declared as test and runtime scopes, so, which ones are actually needed to run on execution? which ones of the test scope are used for execution as well?

Do you have a POM you can share with me that has all the dependencies that I can add to my POM that I told you about that copies everything into the bundles folder in Felix and actually starts correctly?


Thanks so much for the help

Raul


2015-05-20 0:22 GMT-05:00 Jan Bartel <janb@xxxxxxxxxxx>:
Raul,

I've tested our standard jetty test webapp (that does *not* use jndi)
with felix 5.0.0 and it runs no problems.

Here's the gogo shell output:


g! lb
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (5.0.0)
    1|Active     |    1|ASM (5.0.1)
    2|Active     |    1|ASM commons classes (5.0.1)
    3|Active     |    1|ASM Tree class visitor (5.0.1)
    4|Active     |    1|geronimo-jta_1.1_spec (1.1.1)
    5|Active     |    1|Jetty :: Websocket :: javax.websocket ::
Client Implementation (9.2.10.v20150310)
    6|Active     |    1|Jetty :: Websocket :: javax.websocket.server
:: Server Implementation (9.2.10.v20150310)
    7|Active     |    1|javax.annotation API (1.2.0)
    8|Active     |    1|javax.mail bundle from Glassfish (1.4.1.v201005082020)
    9|Active     |    1|WebSocket server API (1.0.0)
   10|Active     |    1|Jetty :: Servlet Annotations (9.2.10.v20150310)
   11|Active     |    1|Jetty :: Deployers (9.2.10.v20150310)
   12|Active     |    1|Jetty :: Http Utility (9.2.10.v20150310)
   13|Active     |    1|Jetty :: IO Utility (9.2.10.v20150310)
   14|Active     |    1|Jetty :: JNDI Naming (9.2.10.v20150310)
   15|Active     |    1|Jetty :: OSGi :: Boot (9.2.10.v20150310)
   16|Resolved   |    1|Jetty-OSGi-Jasper Integration (9.2.10.v20150310)
   17|Active     |    1|Jetty Servlet API and Schemas for OSGi (3.1.0.M3)
   18|Active     |    1|Jetty :: Plus (9.2.10.v20150310)
   19|Active     |    1|Jetty :: Rewrite Handler (9.2.10.v20150310)
   20|Active     |    1|Jetty :: Security (9.2.10.v20150310)
   21|Active     |    1|Jetty :: Server Core (9.2.10.v20150310)
   22|Active     |    1|Jetty :: Servlet Handling (9.2.10.v20150310)
   23|Active     |    1|Jetty :: Utility Servlets and Filters (9.2.10.v20150310)
   24|Active     |    1|Jetty :: Utilities (9.2.10.v20150310)
   25|Active     |    1|Jetty :: Webapp Application Support (9.2.10.v20150310)
   26|Active     |    1|Jetty :: XML utilities (9.2.10.v20150310)
   27|Active     |    1|Apache Aries SPI Fly Dynamic Weaving Bundle (1.0.1)
   28|Active     |    1|Apache Aries Util (1.0.0)
   29|Active     |    1|Apache Felix Bundle Repository (2.0.4)
   30|Active     |    1|Apache Felix Configuration Admin Service (1.8.4)
   31|Active     |    1|Apache Felix EventAdmin (1.4.2)
   32|Active     |    1|Apache Felix Gogo Command (0.14.0)
   33|Active     |    1|Apache Felix Gogo Runtime (0.16.2)
   34|Active     |    1|Apache Felix Gogo Shell (0.10.0)
   35|Active     |    1|Apache Felix Log Service (1.0.1)
   36|Active     |    1|Apache Standard Taglib Implementation (1.2.1)
   37|Active     |    1|Apache Standard Taglib Specification API (1.2.1)
   38|Active     |    1|Xalan-Java (2.7.1.v201005080400)
   39|Active     |    1|Apache XML Commons Serializer (2.7.1.v201005080400)
   40|Active     |    1|Jetty :: Apache JSP Implementation (9.2.10.v20150310)
   41|Active     |    1|Eclipse Compiler for Java(TM) (3.8.2.v20130121-145325)
   42|Active     |    1|Mortbay EL API and Implementation (8.0.9)
   43|Active     |    1|Mortbay Jasper (8.0.9)
   44|Active     |    1|Jetty :: Websocket :: API (9.2.10.v20150310)
   45|Active     |    1|Jetty :: Websocket :: Client (9.2.10.v20150310)
   46|Active     |    1|Jetty :: Websocket :: Common (9.2.10.v20150310)
   47|Active     |    1|Jetty :: Websocket :: Server (9.2.10.v20150310)
   48|Active     |    1|Jetty :: Websocket :: Servlet Interface
(9.2.10.v20150310)

g! install file:/usr/local/java/felix/felix-framework-5.0.0/jetty-webapp-bundles-9.2.10/test-jetty-webapp-9.2.11-SNAPSHOT-webbundle.jar
Bundle ID: 49
g! start 49
2015-05-20 15:13:59.844:DBUG:oejpw.EnvConfiguration:Gogo shell:
Created java:comp/env for webapp /
2015-05-20 15:13:59.845:DBUG:oejpw.EnvConfiguration:Gogo shell:
Binding env entries from the jvm scope
2015-05-20 15:13:59.847:DBUG:oejpw.EnvConfiguration:Gogo shell:
Binding env entries from the server scope
2015-05-20 15:13:59.848:DBUG:oejpw.EnvConfiguration:Gogo shell:
Binding env entries from the context scope
2015-05-20 15:14:00.885:INFO:oejsh.ContextHandler:Gogo shell: Started
o.e.j.w.WebAppContext@4e5d3431{/,file:/tmp/jetty-0.0.0.0-8080-test-jetty-webapp-9.2.11-SNAPSHOT-webbundle.jar-_-any-7268102787456536697.dir/webapp/,AVAILABLE}{/test.war}

My conf/system.properties contains:

[2887] cat conf/system.properties
jetty.port=8080
jetty.home=/usr/local/java/felix/felix-framework-5.0.0/jetty-home
jetty.etc.config.urls=etc/jetty.xml,etc/jetty-testrealm.xml,etc/jetty-selector.xml,etc/jetty-deployer.xml
#org.eclipse.jetty.annotations.LEVEL=DEBUG
#org.eclipse.jetty.osgi.LEVEL=DEBUG
#org.eclipse.jetty.webapp.LEVEL=DEBUG
org.eclipse.jetty.plus.webapp.EnvConfiguration.LEVEL=DEBUG

My conf/config.properties sets the org.osgi.framework.system.packages
property  to a rather long list of packages. If you need it, the value
of property is pasted here: http://pastebin.com/T0j9kEpt


I used the xml files from the
jetty-osgi/test-jetty-osgi/src/test/config/etc dir in the jetty repo
and copied them into
/usr/local/java/felix/felix-framework-5.0.0/jetty-home/etc.

I used the standard test-jetty-webapp as a webbundle. It isn't
uploaded to maven, so the only way to get it is to checkout jetty and
build it (use the jetty-9.2.x branch). You'll find it in
tests/test-webapps/test-jetty-webapp/target with a -webbundle suffix.

Notice that the jetty-annotations jar requires a jta api jar. The
geronimo one is the only one that has a correct osgi manifest that
does not bring in a lot of extraneous and unneeded dependencies. You
don't have that listed on your output, so I don't know how the
jetty-annotations jar is being resolved for you.

You also have the javax.servlet: javax.servlet-api 3.1.0 jar listed on
your deployed bundles - do not use that as it does not have a good
osgi manifest. You already have the org.eclipse.jetty.toolchain:
jetty-osgi-servlet-api 3.1.0.M3 deployed, which is all you should
need, so undeploy the javax.servlet-api one.

The test-jetty-webapp requires the jetty-rewrite, jetty-sevlets, and
all the websocket jars, which is why you see them listed above.

regards
Jan

On 20 May 2015 at 08:23, Jan Bartel <janb@xxxxxxxxxxx> wrote:
> Raul,
>
>
>> 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 jetty osgi bundles with the glassfish or apache bundles have been
> tested and verified as working with felix 4.4.1. I'll download felix-5
> and double-check against that 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.
>
> Those files are present inside the jetty-osgi-boot.jar. It might be
> nice if jetty used those if neither of the system properties were
> found. I'll make a bug for that.
>
>>
>> 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?
>
> Set the normal jetty logging property in the
> felix/conf/system.properties file. Ie
> org.eclipse.jetty.jndi.LEVEL=DEBUG. Also throw in
> org.eclipse.jetty.webapp.LEVEL=DEBUG.
>
>
> Also have a look in the jetty github repo in the
> jetty-osgi/test-jetty-osgi directory. There are a number of unit tests
> where we deploy the standard jetty test webapps, all with jsp, some
> with jndi and annotations and some without - look at the way they're
> deployed and compare to your setup to see if you can work out what is
> different.
>
> regards
> Jan
>
>
>>
>> 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
>>>
>>
>> _______________________________________________
>> 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
>
>
>
> --
> Jan Bartel <janb@xxxxxxxxxxx>
> www.webtide.com
> 'Expert assistance from the creators of Jetty and CometD'



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
'Expert assistance from the creators of Jetty and CometD'
_______________________________________________
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