users@jersey.java.net

Re: [Jersey] OSGI Jersey example not working

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Fri, 09 Apr 2010 11:14:27 +0200

Larry Touve wrote:
>
> Update:
>
>
>
> I did a fresh install of the felix framework (2.0.4), and I didn't
> need to install the DynamicJava.org JAXB bundle.
>
>
>
> Sorry for all the trouble. Thanks for the help., though.
>

No problem. Glad it works for you now!

~Jakub

>
>
> *From:* Larry Touve
> *Sent:* Thursday, April 08, 2010 2:03 PM
> *To:* users_at_jersey.dev.java.net
> *Subject:* RE: [Jersey] OSGI Jersey example not working
>
>
>
> Here's what's happening...
>
>
>
> When I try to start jersey-core, I was getting an error (I installed
> pax-logging to get some details):
>
>
>
> ERROR: Error starting
> http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.2-SNAPSHOT/jersey-core-1.2-SNAPSHOT.jar
> (org.osgi.framework.BundleException: Unresolved constraint in bundle
> com.sun
>
> .jersey.jersey-core [272]: package; (package=javax.xml.bind.annotation))
>
> org.osgi.framework.BundleException: Unresolved constraint in bundle
> com.sun.jersey.jersey-core [272]: package;
> (package=javax.xml.bind.annotation)
>
> at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3295)
>
> at org.apache.felix.framework.Felix.startBundle(Felix.java:1653)
>
> at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1124)
>
> at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
>
> at java.lang.Thread.run(Unknown Source)
>
>
>
> So I'm left with:
>
>
>
> START LEVEL 1
>
> ID State Level Name
>
> [ 0] [Active ] [ 0] System Bundle (2.0.4)
>
> [ 2] [Active ] [ 1] Apache Felix Bundle Repository (1.4.3)
>
> [ 3] [Active ] [ 1] Apache Felix Configuration Admin Service
> (1.2.4)
>
> [ 6] [Active ] [ 1] Apache Felix Shell Service (1.4.2)
>
> [ 8] [Active ] [ 1] Apache Felix Shell TUI (1.4.1)
>
> [ 11] [Active ] [ 1] OPS4J Pax Web - Jetty Bundle (0.7.1)
>
> [ 271] [Active ] [ 1] jsr311-api (1.1.1)
>
> [ 272] [Installed ] [ 1] jersey-core (1.2.0.SNAPSHOT)
>
> [ 273] [Active ] [ 1] jersey-server (1.2.0.SNAPSHOT)
>
> [ 274] [Active ] [ 1] OPS4J Pax Web - Extender - WAR (0.7.1)
>
> [ 278] [Active ] [ 1] OPS4J Pax Logging - API (1.4)
>
> [ 279] [Active ] [ 1] OPS4J Pax Logging - Service (1.4)
>
>
>
> At this point if I tried to run the example, it would result in some
> other exceptions. I looked around and found that DynamicJava.org has
> an OSGI compatible JAXB bundle
> (http://www.dynamicjava.org/projects/jsr-api/jaxb-osgi), so I
> downloaded that, installed it, and started it. That allowed
> jersey-core to start up. Then I was able to install, start, and
> access osgified-webapp.war. Now everything is working as expected.
>
>
>
> Thanks!
>
>
>
> Larry
>
>
>
> *From:* Jakub.Podlesak_at_Sun.COM [mailto:Jakub.Podlesak_at_Sun.COM]
> *Sent:* Thursday, April 08, 2010 12:56 PM
> *To:* users_at_jersey.dev.java.net
> *Subject:* Re: [Jersey] OSGI Jersey example not working
>
>
>
>
> From the felix console, the following should work:
>
> install
> http://www.gossipcheck.com/mirrors/apache/felix/org.apache.felix.configadmin-1.2.4.jar
> install
> http://repo2.maven.org/maven2/org/ops4j/pax/web/pax-web-jetty-bundle/0.7.1/pax-web-jetty-bundle-0.7.1.jar
> install
> http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar
> install
> http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.2-SNAPSHOT/jersey-core-1.2-SNAPSHOT.jar
> install
> http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.2-SNAPSHOT/jersey-server-1.2-SNAPSHOT.jar
> install
> http://repo2.maven.org/maven2/org/ops4j/pax/web/pax-web-extender-war/0.7.1/pax-web-extender-war-0.7.1.jar
>
> then start all the modules, e.g.:
>
> -> ps
> START LEVEL 1
> ID State Level Name
> [ 0] [Active ] [ 0] System Bundle (2.0.4)
> [ 1] [Active ] [ 1] Apache Felix Bundle Repository (1.4.3)
> [ 2] [Active ] [ 1] Apache Felix Shell Service (1.4.2)
> [ 3] [Active ] [ 1] Apache Felix Shell TUI (1.4.1)
> [ 26] [Installed ] [ 1] Apache Felix Configuration Admin Service
> (1.2.4)
> [ 27] [Installed ] [ 1] OPS4J Pax Web - Jetty Bundle (0.7.1)
> [ 28] [Installed ] [ 1] jsr311-api (1.1.1)
> [ 29] [Installed ] [ 1] jersey-core (1.2.0.SNAPSHOT)
> [ 30] [Installed ] [ 1] jersey-server (1.2.0.SNAPSHOT)
> [ 31] [Installed ] [ 1] OPS4J Pax Web - Extender - WAR (0.7.1)
> -> start 26 27 28 29 30 31
>
> then
>
> install file:osgified-webapp.war <file:///%5C%5Cosgified-webapp.war>
>
> you will need to specify an absolute path based on the current working dir
> (e.g. file:///home/larry/osgified-webapp.war
> <file:///%5C%5Chome%5Clarry%5Cosgified-webapp.war>),
> and then start it, e.g.:
>
> -> install file:osgified-webapp.war <file:///%5C%5Cosgified-webapp.war>
> Bundle ID: 32
> -> start 32
> Apr 8, 2010 6:49:16 PM
> com.sun.jersey.server.impl.application.WebApplicationImpl initiate
> INFO: Initiating Jersey application, version 'Jersey: 1.2-SNAPSHOT
> 04/08/2010 12:06 PM'
>
> The webapp should be started then, and if you have not changed the
> config defaults, the following
> two webresources available at:
>
> http://localhost:8080/osgified-webapp/webresources/helloworld
> http://localhost:8080/osgified-webapp/webresources/another
>
> Does it work for you?
>
> ~Jakub
>
>
> Larry Touve wrote:
>
> Jakub,
>
>
>
> I have already downloaded the osgified-war-tests - that's what I was
> trying to run. I can get it to run successfully when I run the Pax
> Exam test. It starts up felix, deploys the bundles and works fine.
> What I am trying to do is deploy the osgified-webapp.war to an
> existing felix installation. I'm trying to figure out which bundles I
> need to deploy to my felix installation. Some of the bundles deployed
> by the test are for testing purposes, so I don't think I need them
> all, correct?
>
>
>
> Thanks,
>
> Larry
>
>
>
>
>
> *From:* Jakub.Podlesak_at_Sun.COM <mailto:Jakub.Podlesak_at_Sun.COM>
> [mailto:Jakub.Podlesak_at_Sun.COM]
> *Sent:* Wednesday, April 07, 2010 7:17 PM
> *To:* users_at_jersey.dev.java.net <mailto:users_at_jersey.dev.java.net>
> *Subject:* Re: [Jersey] OSGI Jersey example not working
>
>
>
> Marc Hadley wrote:
>
> I'm not up-to-speed on the OSGI work but the following explains the module dependencies:
>
> https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#chapter_deps
>
> Looks like you also need jersey-core unless that is bundled in the jersey-server bundle ?
>
>
>
> Right, the jersey-core module is needed as well, as it is not bundled
> with the jersey-server module.
> An example of a OSGified web app could be found at [1], you can just:
>
> svn checkout
> https://jersey.dev.java.net/svn/jersey/trunk/jersey/osgi/osgified-war-tests/
>
> then you should see two modules there:
>
> - osgified-webapp contains a simple OSGified WAR module
> - osgified-war-test contains appropriate test
>
> you need Java SE 6 to be able to run this.
>
> I will move these modules to samples space before the 1.2 release,
> and then the content should also become available for download as a
> standalone zip file.
>
> HTH,
>
> ~Jakub
>
> [1]https://jersey.dev.java.net/svn/jersey/trunk/jersey/osgi/osgified-war-tests/
>
>
>
>
>
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.801 / Virus Database: 271.1.1/2797 - Release Date:
> 04/07/10 14:32:00
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.801 / Virus Database: 271.1.1/2797 - Release Date:
> 04/07/10 14:32:00
>