Running an app on Tomcat 5.5
Question
My Spring application runs on Tomcat 6.0 on localhost.
When I try to run it on 5.5, I get an error "Tomcat version 5.5 only supports J2EE 1.2, 1.3, and 1.4 Web modules".
How do I know the type of Web module my app is running on, and how do I make it run on 1.4?
Thanks.
EDIT:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>AppName</display-name>
<listener>
<listener-class>com.appname.connection.MySqlDBPooling</listener-class>
</listener>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
<url-pattern>*.js</url-pattern>
<url-pattern>*.jpg</url-pattern>
<url-pattern>*.jpeg</url-pattern>
<url-pattern>*.png</url-pattern>
<url-pattern>*.gif</url-pattern>
<url-pattern>*.ico</url-pattern>
</servlet-mapping>
</web-app>
Solution
You need to use the correct J2EE
version (<1.5
) of your dependencies for your development.
You also need define a compatible servlet version to use in web.xml
, i.e.
<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">
OTHER TIPS
In project, .settings
folder, find this file org.eclipse.wst.common.project.facet.core.xml
, change the version of facet="jst.web"
to 2.4 or 2.5 and facet="jst.java"
to 1.4 like this:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<fixed facet="java"/>
<installed facet="java" version="1.4"/>
<installed facet="jst.web" version="2.4"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
I had also faced the same issue, i.e."cvc-complex-type.2.4.d: Invalid content was found starting with element 'url-pattern'. No child element is expected at this point" , but after using advance version of JBOSS (jboss-as-7.1.1.Final), the issue was resolved.
if you face in Tomacat and getting same issue then try the advance version of it.