1 Reply Latest reply on May 2, 2013 10:11 AM by asoldano

    Restfull web service with Spring Servlet in same war

    tim_mickelson

        Hello I'm currently using JBoss 7.1 and have a web probject with an empty web.xml and a class that extends javax.ws.rs.core.Application. More I have the annotation @ApplicationPath("/rest") and everything is working great.

       

        No I have the need to integrate Spring as a MVC and would like to do it in the same war. The only problem is that when I put the spring stuff in the web.xml (as below) the web service doesn't work any more. JBoss does not complain and the deployment is fine, the Spring is working fine, but it is as if JBoss doesn't see my @ApplicationPath any more and if I try to reach the web service I have a 404 not found.

       

        My question is, have I done something wrong, if so is it documented somewhere? Maybe it is not possible to have Spring in the same war as the web service, again, is it documented? I have seen on this link various ways to declare the web service (which are not working for some reason for me) and it seems that the web.xml could be not empty. https://docs.jboss.org/author/display/AS7/JAX-RS+Reference+Guide

       

        Greetings, Tim

       

      web.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <web-app version="3.0"

          xmlns="http://java.sun.com/xml/ns/javaee"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

          <servlet>

              <servlet-name>springmvc</servlet-name>

              <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

              <init-param>

                  <param-name>contextConfigLocation</param-name>

                  <param-value>/WEB-INF/spring/spring.xml</param-value>

              </init-param>

              <load-on-startup>1</load-on-startup>

          </servlet>

         

          <servlet-mapping>

              <servlet-name>springmvc</servlet-name>

              <url-pattern>/prova</url-pattern>

          </servlet-mapping>   

       

      </web-app>