users@jersey.java.net

[Jersey] Re: Weld + Jersey + Tomcat?

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Tue, 25 Jan 2011 15:58:15 +0100

Hi Aaron,

Can you try setting the system property when you run Tomcat:

   -Dcom.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=true

The reason for that is we are currently working around an issue in GF
related to looking up the BeanManager using JNDI so by default we are
using a specific JNDI lookup that appears to be failing on Tomcat.

Paul.

On Jan 25, 2011, at 3:40 PM, aaron_at_acsiri.com wrote:

> Are there any good examples of running Jersey integrated with Weld
> (CDI) on Tomcat 6?
>
> I'm able to individually get Weld working with Tomcat and Jersey
> working with Tomcat but I can't get both of them working together.
> Right now I'm seeing the following exception:
>
> javax.naming.NameNotFoundException: Name com.sun.jersey.config is not
> bound in this Context
>
> My web.xml looks like:
>
> <web-app>
> <display-name>Archetype Created Web Application</display-name>
>
> <listener>
>
> <listener-class>org.jboss.weld.environment.servlet.Listener</
> listener-c
> lass>
> </listener>
>
> <servlet>
> <servlet-name>JerseyTest</servlet-name>
> <servlet-class>
>
> com.sun.jersey.spi.container.servlet.ServletContainer
> </servlet-class>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>com.myco.api.service</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>JerseyTest</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
>
> <resource-env-ref>
>
> <resource-env-ref-name>BeanManager</resource-env-ref-name>
>
> <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</
> resourc
> e-env-ref-type>
> </resource-env-ref>
> </web-app>
>
> My context.xml looks like:
>
> <Context>
> <Resource name="BeanManager" auth="Container"
> type="javax.enterprise.inject.spi.BeanManager"
> factory="org.jboss.weld.resources.ManagerObjectFactory" />
>
> <Listener
> className="org.jboss.weld.environment.tomcat.WeldLifecycleListener" />
>
> </Context>
>
> What else do I need to do?
>
> Thanks,
>
> -Aaron