You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Paul Moore <pa...@gmail.com> on 2013/07/04 02:11:36 UTC

Re: Integrating Tomee 1.6.0-SNAPSHOT and Jersey 2.0

Romain,

Thanks for the hint.  I've used this as a start point and have been making
some progress.

I have however come across an issue that I'm struggling to resolve.  The
Jersey2 libs call a getProperties method in javax.ws.rs.core.Application on
initialisation, and this results in a java.lang.NoSuchMethodError,
specifically:

java.lang.NoSuchMethodError:
javax.ws.rs.core.Application.getProperties()Ljava/util/Map;


I have tracked this down to the fact that the wrong
javax.ws.rs.core.Application is being bound at runtime, and further that
the bound class is an "old" (JAX-RS 1.1) version.

This is somewhat confusing as I understood that the Tomee "webprofile" does
not include JAX-RS.

However, after some time in the debugger I've found that *even* the
webprofile bundles the javax.ws.rs-api (and hence the old version of
core.Application) in the "org.apache.openejb:javaee-api:6.0-4" package.

Confirmed by a quick inspection of the .jar:

neptune:tomee paulkmoore$ jar -tf
./examples/tomee-jersey-eclipselink/target/apache-tomee/lib/javaee-api-6.0-4-tomcat.jar
| grep Application\.class
javax/ws/rs/core/Application.class


I suspect that the javax.ws.rs-api should be excluded from the webprofile
target.  Is there a workaround for this that you can think of?  Does this
constitue a bug in the build of the webprofile?

Thanks

Paul

On 29 June 2013 08:24, Romain Manni-Bucau <rm...@gmail.com> wrote:

> Hi
>
> We have for months this sample with jersey 1 IIRC
>
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/tomee-jersey-eclipselink/
>
> Not sure somebody tried jersey 2
> Le 29 juin 2013 03:52, "Paul Moore" <pa...@gmail.com> a écrit :
>
> > Hi all,
> >
> > I'm trying to get Tomee working with Jersey 2.0, and am making little
> > progress.
> >
> > There seems to be little information about how to do this, with the
> > notable exception of this blog entry
> > http://www.fdmtech.org/2012/07/tomee-1-0-jersey-jax-rs-cdi/ (which is
> > using older versions of Tomee and Jersey).
> >
> > Essentially, I am using Tomee (not jax-rs, or plus) 1.6.0-SNAPSHOT, and
> > Jersey 2.0.
> >
> > I have setup a pom.xml, and using the tomee-maven-plugin have made
> > reasonable progress in setting up the dependencies, making sure the libs
> > are copied to the tomee instance, and using a custom
> conf/system.properties
> > to configure the 'LookupExtensionInBeanManager' directive (as per the
> blog
> > reference).
> >
> > However, on startup I see no Jersey references what so ever, and
> certainly
> > not the expected scanning of annotated resources.  I have tried various
> of
> > the Jersey deployment options (
> > https://jersey.java.net/documentation/latest/user-guide.html#deployment)
> > without success.
> >
> > I was wondering if the
> > 'com.sun.jersey.server.impl.cdi.LookupExtensionInBeanManager' was subject
> > to any renaming in latter Tomee versions, but couldn't find anything
> > obvious.
> >
> > I must be missing something, and I suspect I need to be making the tomee
> > instance *aware* of Jersey in some way.  Any steer willingly received...
> >
> > Attached is the bare bones of the project, that illustrates the issue.
> >
> > Thanks in advance
> >
> > Paul
> >
> >
> >
> >
> >
> >
>

Re: Integrating Tomee 1.6.0-SNAPSHOT and Jersey 2.0

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

A bug? I dont think so (remember tomee targets javaee 6)

A workaround? Remove javaee-api and replace it by the content of
javaee-api-version.zip (on repo1). Finally remove jaxrs api v1 (geronimo
one)
Le 4 juil. 2013 02:12, "Paul Moore" <pa...@gmail.com> a écrit :

> Romain,
>
> Thanks for the hint.  I've used this as a start point and have been making
> some progress.
>
> I have however come across an issue that I'm struggling to resolve.  The
> Jersey2 libs call a getProperties method in javax.ws.rs.core.Application on
> initialisation, and this results in a java.lang.NoSuchMethodError,
> specifically:
>
> java.lang.NoSuchMethodError:
> javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
>
>
> I have tracked this down to the fact that the wrong
> javax.ws.rs.core.Application is being bound at runtime, and further that
> the bound class is an "old" (JAX-RS 1.1) version.
>
> This is somewhat confusing as I understood that the Tomee "webprofile" does
> not include JAX-RS.
>
> However, after some time in the debugger I've found that *even* the
> webprofile bundles the javax.ws.rs-api (and hence the old version of
> core.Application) in the "org.apache.openejb:javaee-api:6.0-4" package.
>
> Confirmed by a quick inspection of the .jar:
>
> neptune:tomee paulkmoore$ jar -tf
>
> ./examples/tomee-jersey-eclipselink/target/apache-tomee/lib/javaee-api-6.0-4-tomcat.jar
> | grep Application\.class
> javax/ws/rs/core/Application.class
>
>
> I suspect that the javax.ws.rs-api should be excluded from the webprofile
> target.  Is there a workaround for this that you can think of?  Does this
> constitue a bug in the build of the webprofile?
>
> Thanks
>
> Paul
>
> On 29 June 2013 08:24, Romain Manni-Bucau <rm...@gmail.com> wrote:
>
> > Hi
> >
> > We have for months this sample with jersey 1 IIRC
> >
> >
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/tomee-jersey-eclipselink/
> >
> > Not sure somebody tried jersey 2
> > Le 29 juin 2013 03:52, "Paul Moore" <pa...@gmail.com> a écrit :
> >
> > > Hi all,
> > >
> > > I'm trying to get Tomee working with Jersey 2.0, and am making little
> > > progress.
> > >
> > > There seems to be little information about how to do this, with the
> > > notable exception of this blog entry
> > > http://www.fdmtech.org/2012/07/tomee-1-0-jersey-jax-rs-cdi/ (which is
> > > using older versions of Tomee and Jersey).
> > >
> > > Essentially, I am using Tomee (not jax-rs, or plus) 1.6.0-SNAPSHOT, and
> > > Jersey 2.0.
> > >
> > > I have setup a pom.xml, and using the tomee-maven-plugin have made
> > > reasonable progress in setting up the dependencies, making sure the
> libs
> > > are copied to the tomee instance, and using a custom
> > conf/system.properties
> > > to configure the 'LookupExtensionInBeanManager' directive (as per the
> > blog
> > > reference).
> > >
> > > However, on startup I see no Jersey references what so ever, and
> > certainly
> > > not the expected scanning of annotated resources.  I have tried various
> > of
> > > the Jersey deployment options (
> > >
> https://jersey.java.net/documentation/latest/user-guide.html#deployment)
> > > without success.
> > >
> > > I was wondering if the
> > > 'com.sun.jersey.server.impl.cdi.LookupExtensionInBeanManager' was
> subject
> > > to any renaming in latter Tomee versions, but couldn't find anything
> > > obvious.
> > >
> > > I must be missing something, and I suspect I need to be making the
> tomee
> > > instance *aware* of Jersey in some way.  Any steer willingly
> received...
> > >
> > > Attached is the bare bones of the project, that illustrates the issue.
> > >
> > > Thanks in advance
> > >
> > > Paul
> > >
> > >
> > >
> > >
> > >
> > >
> >
>