users@jersey.java.net

Re: [Jersey] Re: Having problems getting Jersey up and running

From: Allan Ditzel <allan.ditzel_at_gmail.com>
Date: Fri, 16 Jan 2009 09:39:26 -0500

Hi Naresh,

We do have the ContextLoaderListener in place. Here is that snippet from our
web.xml:

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:business-api.spring.xml,
classpath:security.web.spring.xml, classpath:business-impl.spring.xml,
/WEB-INF/rest-services-servlet.xml</param-value>
    </context-param>

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

Thanks,

Allan

On Fri, Jan 16, 2009 at 12:43 AM, Srinivas Naresh Bhimisetty <
Srinivas.Bhimisetty_at_sun.com> wrote:

> Hi Allan,
>
> did you register the spring context listener class name and context
> parameter in the web.xml? Just wondering if this is the reason.
> Something like-
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>classpath:applicationContext.xml</param-value>
> </context-param>
> <listener>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
> Thanks,
> Naresh
>
> 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<mailto:
>> 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
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>