On Jan 16, 2009, at 3:44 PM, Allan Ditzel wrote:
> Hi Paul,
>
> We are using ivy to handle our dependency management and are pulling
> dependencies from that maven repo. Here is the snippet of our ivy
> config:
>
> <dependency org="com.sun.jersey" name="jersey-server" rev="1.0.1"
> conf="web,test"/>
> <dependency org="com.sun.jersey" name="jersey-client" rev="1.0.1"
> conf="web,test"/>
> <dependency org="com.sun.jersey" name="jersey-json" rev="1.0.1"
> conf="web,test"/>
> <dependency org="com.sun.jersey" name="jersey-fastinfoset"
> rev="1.0.1" conf="web,test"/>
> <dependency org="com.sun.jersey" name="jersey-atom" rev="1.0.1"
> conf="web,test"/>
> <dependency org="com.sun.jersey.contribs" name="jersey-multipart"
> rev="1.0.1" conf="web,test"/>
> <dependency org="com.sun.jersey.contribs" name="jersey-spring"
> rev="1.0.1" conf="web,test"/>
> <dependency org="javax.ws.rs" name="jsr311-api" rev="1.0"
> conf="web,test"/>
>
> Our lib directory ends up with the following jar files for the above
> config:
>
> jersey-atom-1.0.1.jar
> jersey-client-1.0.1.jar
> jersey-fastinfoset-1.0.1.jar
> jersey-json-1.0.1.jar
> jersey-multipart-1.0.1.jar
> jersey-server-1.0.1.jar
> jersey-spring-1.0.1.jar
> jsr311-api-1.0.jar
>
It looks like ivy is not pulling in the jars that the above jars are
depending on (which is what happens when using maven). The following
are the list of jars in the WEB-INF/lib of the spring-annotations
sample (built from the trunk):
activation-1.1.jar
aopalliance-1.0.jar
asm-3.1.jar
aspectjrt-1.5.4.jar
aspectjweaver-1.5.4.jar
cglib-2.2.jar
commons-logging-1.1.1.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.jar
jersey-core-1.0.2-SNAPSHOT.jar
jersey-server-1.0.2-SNAPSHOT.jar
jersey-spring-1.0.2-SNAPSHOT.jar
jsr311-api-1.0.jar
spring-2.5.6.jar
spring-beans-2.5.6.jar
spring-context-2.5.6.jar
spring-core-2.5.6.jar
spring-web-2.5.6.jar
stax-api-1.0-2.jar
I am guessing there should be an exception in the Tomcat logs stating
that the Jersey Spring Servlet cannot be instantiated.
Do you intend to use Spring or not? If not then you are using the
wrong Servlet and should be using:
com.sun.jersey.spi.container.servlet.ServletContainer
as described in the dependencies document i sent a link to in the
previous email. But note that you will still have a problem because
you are not pulling other dependent jars as documented in the the
dependencies document.
Paul.
> Also, we are deploying inside of Tomcat 6 with JDK 6.
>
> Best Regards,
>
> Allan
>
> On Fri, Jan 16, 2009 at 9:02 AM, Paul Sandoz <Paul.Sandoz_at_sun.com>
> wrote:
> Hi Allan,
>
> What are you using in your WEB-INF/lib ? what are the jars files.
> This error indicates that Tomcat cannot find the servlet
> "com.sun.jersey.spi.spring.container.servlet.SpringServlet" because
> you do not have the correct jars. Please read the dependencies
> document for what you require:
>
> https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.1/jersey/dependencies.html
>
> I am assuming you copied the web.xml from the spring-annotations
> sample:
>
> http://download.java.net/maven/2/com/sun/jersey/samples/spring-annotations/1.0.1/spring-annotations-1.0.1-project.zip
>
> If you build this sample you can find all the dependent jars in the
> location:
>
> target/spring-annotations/WEB-INF/lib
>
> Paul.
>
> On Jan 16, 2009, at 1:01 AM, Allan Ditzel wrote:
>
>> Sorry for the bump, but here's more that I've tried, just to give
>> more context:
>>
>> I just tried just loading the spring servlet and letting spring
>> instantiate the resource:
>>
>> <servlet>
>> <servlet-name>Jersey Spring Web Application</servlet-name>
>> <servlet-
>> class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</
>> servlet-class>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>> <servlet-mapping>
>> <servlet-name>Jersey Spring Web Application</servlet-name>
>> <url-pattern>/rest/*</url-pattern>
>> </servlet-mapping>
>>
>> Spring config:
>>
>> <bean id="dynamicImageService" class="com.company.web.rest.DynamicImageResource
>> "/>
>>
>> I still get the same 404 error when I try to access this service.
>>
>> On Thu, Jan 15, 2009 at 6:26 PM, Allan Ditzel
>> <allan.ditzel_at_gmail.com> wrote:
>> Hi,
>>
>> I was hoping someone might be able to help me out. I'm trying to
>> get jersey integrated into our project at work, but it seems that
>> the servlet isn't getting loaded. Here are my servlet and servlet
>> mapping definitions:
>>
>> <servlet>
>> <servlet-name>Jersey Spring Web Application</servlet-name>
>> <servlet-
>> class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</
>> servlet-class>
>> <!-- The following initialization parameter is only
>> required for
>> registering Jersey managed classes. Spring-managed
>> classes
>> are automatically registered.
>> -->
>> <init-param>
>> <param-name>com.sun.jersey.config.property.packages</
>> param-name>
>> <param-value>com.company.path.web.rest</param-value>
>> </init-param>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>> <servlet-mapping>
>> <servlet-name>Jersey Spring Web Application</servlet-name>
>> <url-pattern>/rest/*</url-pattern>
>> </servlet-mapping>
>>
>> Whenever I try to access anything in:
>>
>> http://localhost:8080/portal/rest (for example: http://localhost:8080/portal/rest/image/foo.jpg)
>> , I get the following error:
>>
>> HTTP Status 404 - Servlet Jersey Spring Web Application is not
>> available
>>
>> type Status report
>>
>> message Servlet Jersey Spring Web Application is not available
>>
>> description The requested resource (Servlet Jersey Spring Web
>> Application is not available) is not available.
>>
>> Apache Tomcat/6.0.18
>>
>>
>> Here is the resource that will be backing that service:
>>
>> @Path("/images")
>> public class DynamicImageResource {
>> /** Logger */
>> private static transient final Log log =
>> LogFactory.getLog(DynamicImageResource.class);
>>
>> /**
>> *
>> * @param imageName
>> * @return
>> */
>> @GET
>> @Path("{imagename")
>> @Produces("image/jpeg")
>> public byte[] getImage(@PathParam("imagename") String
>> imageName) {
>> /* ... code ... */
>> }
>> }
>>
>> Thanks in advance!
>>
>> Allan
>>
>
>