Discussion:
[jboss-user] [JBoss Web Services] - Restfull web service with Spring Servlet in same war
Tim Mickelson
2013-05-01 10:52:19 UTC
Permalink
Tim Mickelson [https://community.jboss.org/people/tim_mickelson] created the discussion

"Restfull web service with Spring Servlet in same war"

To view the discussion, visit: https://community.jboss.org/message/811076#811076

--------------------------------------------------------------
  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 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 http://java.sun.com/xml/ns/javaee"
    xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd 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>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/811076#811076]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Alessio Soldano
2013-05-02 14:12:09 UTC
Permalink
Alessio Soldano [https://community.jboss.org/people/asoldano] created the discussion

"Re: Restfull web service with Spring Servlet in same war"

To view the discussion, visit: https://community.jboss.org/message/811260#811260

--------------------------------------------------------------
I suggest you to post this in the RestEasy section of the forum
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/811260#811260]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Loading...