Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8526759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:21:52+00:00 2026-06-11T08:21:52+00:00

I have a small Java/Spring MVC REST /Maven app that runs just fine in

  • 0

I have a small Java/Spring MVC REST /Maven app that runs just fine in Eclipse but also when I run the following command from the prompt:

mvn clean tomcat6:run

My problem is when I do:

mvn clean package

and push the generated war file to the “webapps” folder in my standalone Tomcat instance, the service doesn’t work anymore.

The standalone Tomcat starts up just fine, no error in the logs. Interestingly enough though the standalone instance listens on port 8989 vs. 8080 when I run the app in Eclipse or through the mvn command.

Once the app is up in the standalone Tomcat if I try to hit my service w/ RESTClient I get a 404 back. My custom 404 actually, not the generic one.

Also the static content, like my index.html comes up just fine.

Here is my web.xml file:

    <?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <display-name>Skunk User Interface</display-name>

  <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>file:///${APPS_CONFIG}/log4j.xml</param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  </listener>

  <servlet>
    <servlet-name>skunk</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/skunk-servlet.xml
    </param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  <servlet-mapping>
    <servlet-name>skunk</servlet-name>
    <url-pattern>/skunk/*</url-pattern>
  </servlet-mapping>

  <!-- Healthcheck mapping -->
  <servlet-mapping>
    <servlet-name>skunk</servlet-name>
    <url-pattern>/health/*</url-pattern>
  </servlet-mapping>

  <error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/404.htm</location>
  </error-page>
</web-app>

And the skunk-servlet.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:c="http://www.springframework.org/schema/c"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:cache="http://www.springframework.org/schema/cache"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
         http://www.springframework.org/schema/mvc
         http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-3.1.xsd
         http://www.springframework.org/schema/tx
         http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
         http://www.springframework.org/schema/aop 
         http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
         http://www.springframework.org/schema/cache 
         http://www.springframework.org/schema/cache/spring-cache-3.1.xsd">

    <tx:annotation-driven/>

    <!-- Load configuration settings -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>

    <bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
      <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
      <property name="searchContextAttributes" value="true" />
      <property name="contextOverride" value="true" />
      <property name="ignoreResourceNotFound" value="true" />
      <property name="locations">
        <list>
          <value>classpath:config/application.properties</value>
          <value>file:///${APPS_CONFIG}/application.properties</value>
        </list>
      </property>
    </bean>

  <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${jdbc.driverClassName}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
  </bean>

  <bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate" 
    c:dataSource-ref="dataSource" />

  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource">
      <ref bean="dataSource"/>
    </property>
    <property name="hibernateProperties">
      <props>
        <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
      </props>
    </property>
  </bean>

  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" 
    p:sessionFactory-ref="sessionFactory" />

  <!-- Auto scan the components -->
  <context:component-scan base-package="com.skunk.myapp" />
  <mvc:annotation-driven/>

    <cache:annotation-driven />

    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
        <property name="cacheManager" ref="ehcache"/>
    </bean>
    <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    <property name="configLocation" value="classpath:/ehcache.xml"/>
    </bean> 

  <aop:aspectj-autoproxy proxy-target-class="true" />

</beans>

Is there anything in that configuration that would explain why any request to the dispatcher servlet return 404 instead of routing to the controller?

Thanks


UPDATE:

Adding log outputs from Tomcat Standalone.

catalina.[date].log:

Sep 13, 2012 1:47:28 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_31\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;.
Sep 13, 2012 1:47:28 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 13, 2012 1:47:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 673 ms
Sep 13, 2012 1:47:28 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 13, 2012 1:47:28 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Sep 13, 2012 1:47:28 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Sep 13, 2012 1:47:29 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Sep 13, 2012 1:47:29 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive skunk.war
Sep 13, 2012 1:47:44 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Sep 13, 2012 1:47:44 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Sep 13, 2012 1:47:44 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Sep 13, 2012 1:47:44 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 13, 2012 1:47:44 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 13, 2012 1:47:44 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/19  config=null
Sep 13, 2012 1:47:44 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 16106 ms

localhost.[date].log:

Sep 13, 2012 1:47:39 PM org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'webapp.root' = [C:\Users\my.user\Tomcat\webapps\skunk\]
Sep 13, 2012 1:47:39 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing log4j from [file:///${APPS_CONFIG}/log4j.xml]
Sep 13, 2012 1:47:39 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Sep 13, 2012 1:47:43 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'skunk'
Sep 13, 2012 1:47:44 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Sep 13, 2012 1:47:44 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:21:58+00:00Added an answer on June 11, 2026 at 8:21 am

    If you merely copy yourproject.war to Tomcat’s webapps folder and let the default deployer kick in (which expands yourproject.war to a directory named yourproject) then you should be aware that the default Tomcat logic is to make your app available under the context path (read: URL) of /yourproject.

    If you want the app to be available under the root context (/) you should configure Tomcat appropriately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small java program that reads a file in, in eclipse i
I have a small Spring (3.1.0.RELEASE) application, which was working just fine, until I
I'm writing a small demo application in Java using Spring, that needs to have
I have a small Java program that reads list of IPs from text file
I have a small Java test app in Netbeans where the main() class reads
I currently have a small text game I've written in Java that utilizes System.out.print();
I have a relatively small Java library that implements a few dozen beans (no
I have a spring application that has configured log4j (via xml) and that runs
I have a developed two small Java applications - a vanilla Java app and
I have a small java program that searches the contents of all *.txt files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.