users@glassfish.java.net

web.xml for restful jax-ws web service (using HTTPBinding)

From: Coarr, Matt <mcoarr_at_mitre.org>
Date: Wed, 13 Feb 2008 11:06:31 -0500

Hi,
 
I'm having some trouble with getting a jax-ws RESTful web service up
and running on glassfish.
 
My problem is that I created my webservice class and then declare it in
a "servlet" element via the "servlet-class" element. I then go on to
create a servlet-mapping. But my problem is that glassfish complains
that it cannot cast my class to javax.servlet.Servlet.

My code right now is based on the code from this article:
 
http://weblogs.java.net/blog/kohlert/archive/2006/01/publishing_a_re.ht
ml

Here' the stack trace:
 
[#|2008-02-13T11:02:11.869-0500|INFO|sun-appserver9.1|javax.enterprise.
system.container.web|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-
1;|PWC1412: WebModule[/alert] ServletContext.log():PWC1409: Marking
servlet incoming as unavailable|#]
 
[#|2008-02-13T11:02:11.869-0500|SEVERE|sun-appserver9.1|javax.enterpris
e.system.container.web|_ThreadID=17;_ThreadName=httpSSLWorkerThread-808
0-1;_RequestID=c04894a9-80d6-43a7-bb6e-17aa261e9457;|StandardWrapperVal
ve[incoming]: PWC1382: Allocate exception for servlet incoming
java.lang.ClassCastException:
org.mitre.hotspotting.live.web.SimpleRestService cannot be cast to
javax.servlet.Servlet
        at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.ja
va:1132)
        at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:
832)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
ve.java:197)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCo
ntextValve.java:271)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal
ve.java:202)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.jav
a:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.jav
a:577)
        at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav
a:206)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.jav
a:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.jav
a:577)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
.java:150)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.jav
a:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.jav
a:577)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAda
pter(DefaultProcessorTask.java:637)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess
(DefaultProcessorTask.java:568)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(D
efaultProcessorTask.java:813)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcess
orTask(DefaultReadTask.java:341)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(Default
ReadTask.java:263)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(Default
ReadTask.java:214)
        at
com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(P
ortUnificationPipeline.java:380)
        at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265
)
        at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWor
kerThread.java:106)
|#]