6

I have JAX-RS WS application deployed on WAS 8.0 with an empty 2.4 web.xml, class that extends 'javax.ws.rs.core.Application' and 2 resources, and it works great.

I would like to deploy this application on WAS 7.0, but I'm getting: 'Error 404: SRVE0190E: File not found: /rest/source' (that's the path of the resource).

How can I deploy JAX-RS application on WAS 7.0 without using Jersey or any other application-server related classes?

Thanks

danieln
  • 4,795
  • 10
  • 42
  • 64

1 Answers1

3

In WAS 7 you must defined the servlet in the web.xml:

<servlet>
    <description>JAX-RS Tools Generated - Do not modify</description>
    <servlet-name>JAX-RS Servlet</servlet-name>
    <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
    <init-param>
        <param-name>javax.ws.rs.Application</param-name>
        <param-value>YOUR APPLICATION CLASS</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>JAX-RS Servlet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

Also, WAS 7 isn't bundle with JAX-RS you should add the JAX-RS jars to your web module or add it as a shared library.

Aviram Segal
  • 10,962
  • 3
  • 39
  • 52
  • To clarify, you want to obtain those JAX-RS jars by installing the (free) WebSphere Application Server Feature Pack for Web 2.0 and Mobile http://www-01.ibm.com/software/webservers/appserv/was/featurepacks/web20-mobile/features/ – dbreaux Dec 11 '12 at 17:45
  • Yes, and even then, the info center indicates you should bundle the jars in your app – Aviram Segal Dec 12 '12 at 07:02
  • Or define a shared library. That's what we did. – dbreaux Dec 12 '12 at 14:48
  • Cool! It worked! I also found this - http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.web20fepjaxrs.doc/info/ae/ae/twbs_jaxrs_getstarted.html – danieln Dec 13 '12 at 09:15