users@jersey.java.net

Re: [Jersey] OSGI Jersey example not working

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Thu, 08 Apr 2010 18:56:17 +0200

 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

you will need to specify an absolute path based on the current working dir
(e.g. file:///home/larry/osgified-webapp.war),
and then start it, e.g.:

-> install file:osgified-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]
> *Sent:* Wednesday, April 07, 2010 7:17 PM
> *To:* 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/
>
>
>
>
>