trebor
trebor

Reputation: 1003

Map Multiple Spring MVC Applications to Root Servlet

I have multiple Spring MVC applications I want to deploy to the same server but am having troubles doing so.

In my web.xml I map the dispatcher servlet:

<servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

However, if I have multiple applications on the same server, I get the following error when trying to deploy:

0000003f webapp W com.ibm.ws.webcontainer.webapp.WebApp initializeStaticFileHandler SRVE0278E: Error while adding servlet mapping --> /*.

If I change the mapping to /test it works, but of course I want the dispatcher servlet mapped for all requests.

What am I doing wrong?

Update:

I want all my requests under the root URI (i.e. http://<server>/<contextroot>/*) but am running into problems when having multiple applications do this.

Upvotes: 0

Views: 5474

Answers (2)

Dirk Lachowski
Dirk Lachowski

Reputation: 3151

Seems you have hit this error: http://www-01.ibm.com/support/docview.wss?uid=swg1PK18713

As recommended, either

  • upgrade your app server or
  • disable file serving

Upvotes: 3

M Abbas
M Abbas

Reputation: 6479

If I change the mapping to /test it works, but of course I want the dispatcher servlet mapped for all requests.

In this case, you should replace:

<url-pattern>/test</url-pattern>

with

<url-pattern>/test/*</url-pattern>

Upvotes: 0

Related Questions