JBoss Community

RestEasy deployment

created by Igor Atman in JBoss Web Services - View the full discussion

Hi,

 

I'm new to RestEasy and for my test project I was following Bill Burke's "Restful Java" examples. My project works fine but what is bothering me is that I was unable to deploy it as described in the book. Bill provides two web.xml examples for deployment in both "JAX-RS-aware and unaware" containers. None worked for me. First I expected JBoss container to be JAX-RS aware. I tried to set my Application class as <servlet-class> but received error complaining that my application cannot be cast into servlet. Then I used "unaware" version setting my Application as <init-param> inside <servlet> declaration . No luck either. The error now says "resource unavilable". What finally worked for me is setting my Application as <context-param>. The app works fine but I have a couple of issues with the way it is deployed.

First, what does it mean that I can set up my Application through <context-param> only? Is something missing from my environment?

Is it true that it is normally not advisable to deploy the application through <context-param> (I heard that it can cause strange behavior from Spring beans etc.)?

Thanks!

 

Didn't work:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<servlet>

    <servlet-name>Resteasy</servlet-name>

    <servlet-class>path.MyApplication</servlet-class>

</servlet>

 

Didn't work:

#

#

 

<servlet>

    <servlet-name>Resteasy</servlet-name>

    <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>

        <init-param>

             <param-name>javax.ws.rs.Application</param-name>

             <param-value>path.MyApplication</param-value>

        </init-param>

</servlet>

Worked:

 

<servlet>

    <servlet-name>Resteasy</servlet-name>

    <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>

</servlet>

 

<context-param>
    <param-name>javax.ws.rs.Application</param-name>
    <param-value>path.MyApplication</param-value>
</context-param>

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community