users@jersey.java.net

jersey not mapping requests

From: Tarjei Huse <tarjei_at_scanmine.com>
Date: Tue, 23 Sep 2008 17:42:18 +0200

Hi, I'm testing out jersey, but I got a problem.

I've added my servlet to jettys web.xml like this:

 <servlet>
        <servlet-name>Jersey Web Application</servlet-name>
       
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <description>

            </description>
           
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
           
<param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>com.scanmine.newsletter</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/jersey/*</url-pattern>
    </servlet-mapping>

And I got a class:
@Path("/newsletter")
@ProduceMime("application/xml")
@Service("newsletterService")
public class NewsletterService {

     @GET
    @Path("/")
    public Newsletters listPages() {
        if (rsspageDao == null) {
            log.debug("Missing rsspage!");
        }
        return new Newsletters(rsspageDao.getAll());
    }
...
}

When I try to access the class using the url:
http://localhost:8080/jersey/newsletter/

I get a 404.

In the logs, I find:
INFO: Root resource classes found:
  class com.scanmine.newsletter.service.NewsletterService
  class com.scanmine.newsletter.service.SubscriberService
Sep 23, 2008 5:35:38 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Provider classes found:
Sep 23, 2008 5:35:38 PM org.apache.cxf.transport.servlet.CXFServlet
updateContext
INFO: Load the bus with application context
Sep 23, 2008 5:35:38 PM org.apache.cxf.bus.spring.BusApplicationContext
getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults.
Sep 23, 2008 5:35:38 PM
org.apache.cxf.transport.servlet.AbstractCXFServlet
replaceDestinationFactory
INFO: Servlet transport factory already registered
2008-09-23 17:35:38.259:appfuse:INFO: Initializing Spring
FrameworkServlet 'dispatcher'
[INFO] Restart completed at Tue Sep 23 17:35:39 CEST 2008
2008-09-23 17:35:43.782::WARN: /jersey/newsletter
java.lang.NullPointerException
    at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
    at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
    at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)


So, why am I getting a 404 here?

This service works when I use CXF, although it then has some other
problems.

Also, when will 0.9 be uploaded to the maven repo? I tried to substitute
0.8-ea-SNAPSHOT with 0.9-ea-SNAPSHOT but without luck.

Kind regards,
Tarjei