Java servlet 404 error tomcat 8 but not tomcat 6Apache Tomcat Servlet 404 TroubleshootingTomcat 6.0 service does not start: java/lang/NoClassDefFoundErrorSetting Environment Variable for Tomcat 6 Servletcan't start tomcat on vps - java VM error “could not reserve enough space for object heap”Cannot shutdown Tomcat - transport Errordeploying application on tomcat server status is ok but hitting the url throws 404 not foundMemory-consuming servlet crashes TomcatTomcat startup script on RHEL not starting tomcat on rebootTomcat 8.5 can't load @WebServlet annotationsCannot get SSL working on Tomcat8.5
What's the correct term for a waitress in the Middle Ages?
How is it possible that Gollum speaks Westron?
About the expansion of seq_set_split
What can plausibly explain many of my very long and low-tech bridges?
How did students remember what to practise between lessons without any sheet music?
SF novella separating the dumb majority from the intelligent part of mankind
How do I write "Show, Don't Tell" as a person with Asperger Syndrome?
Average spam confidence
After the loss of Challenger, why weren’t Galileo and Ulysses launched by Centaurs on expendable boosters?
Did Darth Vader wear the same suit for 20+ years?
Smooth switching between 12v batteries, with toggle switch
Translating 'Liber'
Company did not petition for visa in a timely manner. Is asking me to work from overseas, but wants me to take a paycut
Russian equivalent of the French expression "broyer du noir"
How many pairs of subsets can be formed?
How can drunken, homicidal elves successfully conduct a wild hunt?
Question about JavaScript Math.random() and basic logic
What risks are there when you clear your cookies instead of logging off?
Last survivors from different time periods living together
Can a user sell my software (MIT license) without modification?
Approximate solutions to non polynomial equations
What happened to all the nuclear material being smuggled after the fall of the USSR?
Random Portfolios vs Efficient Frontier
PL/SQL function to receive a number and return its binary format
Java servlet 404 error tomcat 8 but not tomcat 6
Apache Tomcat Servlet 404 TroubleshootingTomcat 6.0 service does not start: java/lang/NoClassDefFoundErrorSetting Environment Variable for Tomcat 6 Servletcan't start tomcat on vps - java VM error “could not reserve enough space for object heap”Cannot shutdown Tomcat - transport Errordeploying application on tomcat server status is ok but hitting the url throws 404 not foundMemory-consuming servlet crashes TomcatTomcat startup script on RHEL not starting tomcat on rebootTomcat 8.5 can't load @WebServlet annotationsCannot get SSL working on Tomcat8.5
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a server which I flip back and forth between tomcat 6 and tomcat 8. When I do an HTTP post using the command
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
I get different results between the different versions of tomcat.
First of all, for tomcat 8, I get:
* About to connect() to localhost port 8080 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> POST /fortive2/tsmService HTTP/1.1
> User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8080
> Accept: */*
> Referrer:mobileWMS,LLC
> Content-Type:text/xml
> Content-Length: 218
>
< HTTP/1.1 404
< Content-Length: 0
< Date: Mon, 20 May 2019 16:17:36 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0
Then, for tomcat 6, I get the proper response, no 404 error. What is happening? This is literally the same server, the same WAR file. My servlets are defined in the main tomcat web.xml ( $CATALINA_HOME/conf/web.xml ), NOT in the war file. This is on purpose, as it lets me quickly add web service URLs for new customers without changing the war file.
Also, I will say that multiple web applications reference the same war file ( multiple customers, so multiple websites with slight different configutations but the same UI ). This has always worked just fine for servlets in tomcat 6, so I just assumed this would keep working for Tomcat 8. Could this be causing a problem?
Also, as a side point, I can access port 8080 just fine in the browser, because that is how I sometimes get to the website or the tomcat manager ( when SSL is giving me problems with certificates ). So it is not the port.
Also, as added information, I have this for ONE of my servlets ( not the one I am using, a totally different servlet ):
@WebServlet(urlPatterns = "/*", name = "WmsServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = WmsUI.class, productionMode = false)
@SuppressWarnings("serial")
public class WmsServlet extends VaadinServlet
@Override
protected final void servletInitialized() throws ServletException
super.servletInitialized();
getService().addSessionInitListener(new WmsSessionInitListener());
And here are some example $CATALINA_HOME/conf/web.xml servlet configurations:
<servlet>
<servlet-name>veeder-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>VEEDER-WS</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>spence-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>SPENCE-WS</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>veeder-ws</servlet-name>
<url-pattern>/veeder-ws/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>spence-ws</servlet-name>
<url-pattern>/spence-ws/tsmService</url-pattern>
</servlet-mapping>
5/21/2019 update: using Servlet Context listener, I get the following for my development server:
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST; Mappings: /NEWCUST-WebsiteXML
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: default; Mappings: /
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WmsServlet; Mappings: /*
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: FortivePFC; Mappings: /Fortive-PFC
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive3; Mappings: /fortive3/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: jsp; Mappings: *.jspx, *.jsp
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive2; Mappings: /fortive2/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST2; Mappings: /NEWCUST2-WebsiteXML
And the servlet sections of global web.xml ( so $CATALINA_HOME/conf/web.xml ) for my dev machine, where the above logging was printed:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- snipped unrelated config -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<!-- ================ Built In Servlet Mappings ========================= -->
<!-- The servlet mappings for the built in servlets defined above. Note -->
<!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
<!-- must uncomment these mappings (or add them to your application's own -->
<!-- web.xml deployment descriptor) to enable these services -->
<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The mappings for the JSP servlet -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<!-- snipped unrelated config -->
<!-- ==================== Custom WMS servlet setup ===================== -->
<servlet>
<servlet-name>FortivePFC</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive_PFC</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive2</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive3</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive3</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST2</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>FortivePFC</servlet-name>
<url-pattern>/Fortive-PFC</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive2</servlet-name>
<!-- <url-pattern>/turnsmith/tsmService</url-pattern>-->
<url-pattern>/fortive2/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive3</servlet-name>
<!-- <url-pattern>/NEWCUST/tsmService</url-pattern>-->
<url-pattern>/fortive3/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<url-pattern>/NEWCUST-WebsiteXML</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<url-pattern>/NEWCUST2-WebsiteXML</url-pattern>
</servlet-mapping>
</web-app>
tomcat6 tomcat8 servlets
|
show 4 more comments
I have a server which I flip back and forth between tomcat 6 and tomcat 8. When I do an HTTP post using the command
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
I get different results between the different versions of tomcat.
First of all, for tomcat 8, I get:
* About to connect() to localhost port 8080 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> POST /fortive2/tsmService HTTP/1.1
> User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8080
> Accept: */*
> Referrer:mobileWMS,LLC
> Content-Type:text/xml
> Content-Length: 218
>
< HTTP/1.1 404
< Content-Length: 0
< Date: Mon, 20 May 2019 16:17:36 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0
Then, for tomcat 6, I get the proper response, no 404 error. What is happening? This is literally the same server, the same WAR file. My servlets are defined in the main tomcat web.xml ( $CATALINA_HOME/conf/web.xml ), NOT in the war file. This is on purpose, as it lets me quickly add web service URLs for new customers without changing the war file.
Also, I will say that multiple web applications reference the same war file ( multiple customers, so multiple websites with slight different configutations but the same UI ). This has always worked just fine for servlets in tomcat 6, so I just assumed this would keep working for Tomcat 8. Could this be causing a problem?
Also, as a side point, I can access port 8080 just fine in the browser, because that is how I sometimes get to the website or the tomcat manager ( when SSL is giving me problems with certificates ). So it is not the port.
Also, as added information, I have this for ONE of my servlets ( not the one I am using, a totally different servlet ):
@WebServlet(urlPatterns = "/*", name = "WmsServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = WmsUI.class, productionMode = false)
@SuppressWarnings("serial")
public class WmsServlet extends VaadinServlet
@Override
protected final void servletInitialized() throws ServletException
super.servletInitialized();
getService().addSessionInitListener(new WmsSessionInitListener());
And here are some example $CATALINA_HOME/conf/web.xml servlet configurations:
<servlet>
<servlet-name>veeder-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>VEEDER-WS</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>spence-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>SPENCE-WS</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>veeder-ws</servlet-name>
<url-pattern>/veeder-ws/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>spence-ws</servlet-name>
<url-pattern>/spence-ws/tsmService</url-pattern>
</servlet-mapping>
5/21/2019 update: using Servlet Context listener, I get the following for my development server:
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST; Mappings: /NEWCUST-WebsiteXML
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: default; Mappings: /
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WmsServlet; Mappings: /*
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: FortivePFC; Mappings: /Fortive-PFC
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive3; Mappings: /fortive3/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: jsp; Mappings: *.jspx, *.jsp
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive2; Mappings: /fortive2/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST2; Mappings: /NEWCUST2-WebsiteXML
And the servlet sections of global web.xml ( so $CATALINA_HOME/conf/web.xml ) for my dev machine, where the above logging was printed:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- snipped unrelated config -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<!-- ================ Built In Servlet Mappings ========================= -->
<!-- The servlet mappings for the built in servlets defined above. Note -->
<!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
<!-- must uncomment these mappings (or add them to your application's own -->
<!-- web.xml deployment descriptor) to enable these services -->
<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The mappings for the JSP servlet -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<!-- snipped unrelated config -->
<!-- ==================== Custom WMS servlet setup ===================== -->
<servlet>
<servlet-name>FortivePFC</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive_PFC</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive2</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive3</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive3</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST2</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>FortivePFC</servlet-name>
<url-pattern>/Fortive-PFC</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive2</servlet-name>
<!-- <url-pattern>/turnsmith/tsmService</url-pattern>-->
<url-pattern>/fortive2/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive3</servlet-name>
<!-- <url-pattern>/NEWCUST/tsmService</url-pattern>-->
<url-pattern>/fortive3/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<url-pattern>/NEWCUST-WebsiteXML</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<url-pattern>/NEWCUST2-WebsiteXML</url-pattern>
</servlet-mapping>
</web-app>
tomcat6 tomcat8 servlets
Literally the same server? Tomcat8 is using Servlet API 3.1 while Tomcat6 is using Servlet API 2.5. Increase log verbosity and check your webapp and catalina logs...
– Freddy
May 20 at 21:56
Also read Migrating from 6.0.x to 7.0.x and Migrating from 7.0.x to 8.0.x.
– Freddy
May 20 at 22:02
yes, same physical server. It is trivial to run "service tomcat6 stop" and then "service tomcat8 start".
– user3329922
May 20 at 22:06
Ok, that's what you meant with server. I thought you mean Tomcat. And there might be one or two things you have to adjust. Reading the migration guides could help as well as increasing the log verbosity on both Tomcats/Webapps and comparing the logfiles.
– Freddy
May 20 at 22:13
unless I am mistaken, logging level already set to "ALL". Nothing useful in there. What would I be looking for? I mean, does it even log anything to the tomcat logs in this case?
– user3329922
May 20 at 22:41
|
show 4 more comments
I have a server which I flip back and forth between tomcat 6 and tomcat 8. When I do an HTTP post using the command
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
I get different results between the different versions of tomcat.
First of all, for tomcat 8, I get:
* About to connect() to localhost port 8080 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> POST /fortive2/tsmService HTTP/1.1
> User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8080
> Accept: */*
> Referrer:mobileWMS,LLC
> Content-Type:text/xml
> Content-Length: 218
>
< HTTP/1.1 404
< Content-Length: 0
< Date: Mon, 20 May 2019 16:17:36 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0
Then, for tomcat 6, I get the proper response, no 404 error. What is happening? This is literally the same server, the same WAR file. My servlets are defined in the main tomcat web.xml ( $CATALINA_HOME/conf/web.xml ), NOT in the war file. This is on purpose, as it lets me quickly add web service URLs for new customers without changing the war file.
Also, I will say that multiple web applications reference the same war file ( multiple customers, so multiple websites with slight different configutations but the same UI ). This has always worked just fine for servlets in tomcat 6, so I just assumed this would keep working for Tomcat 8. Could this be causing a problem?
Also, as a side point, I can access port 8080 just fine in the browser, because that is how I sometimes get to the website or the tomcat manager ( when SSL is giving me problems with certificates ). So it is not the port.
Also, as added information, I have this for ONE of my servlets ( not the one I am using, a totally different servlet ):
@WebServlet(urlPatterns = "/*", name = "WmsServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = WmsUI.class, productionMode = false)
@SuppressWarnings("serial")
public class WmsServlet extends VaadinServlet
@Override
protected final void servletInitialized() throws ServletException
super.servletInitialized();
getService().addSessionInitListener(new WmsSessionInitListener());
And here are some example $CATALINA_HOME/conf/web.xml servlet configurations:
<servlet>
<servlet-name>veeder-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>VEEDER-WS</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>spence-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>SPENCE-WS</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>veeder-ws</servlet-name>
<url-pattern>/veeder-ws/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>spence-ws</servlet-name>
<url-pattern>/spence-ws/tsmService</url-pattern>
</servlet-mapping>
5/21/2019 update: using Servlet Context listener, I get the following for my development server:
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST; Mappings: /NEWCUST-WebsiteXML
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: default; Mappings: /
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WmsServlet; Mappings: /*
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: FortivePFC; Mappings: /Fortive-PFC
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive3; Mappings: /fortive3/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: jsp; Mappings: *.jspx, *.jsp
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive2; Mappings: /fortive2/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST2; Mappings: /NEWCUST2-WebsiteXML
And the servlet sections of global web.xml ( so $CATALINA_HOME/conf/web.xml ) for my dev machine, where the above logging was printed:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- snipped unrelated config -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<!-- ================ Built In Servlet Mappings ========================= -->
<!-- The servlet mappings for the built in servlets defined above. Note -->
<!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
<!-- must uncomment these mappings (or add them to your application's own -->
<!-- web.xml deployment descriptor) to enable these services -->
<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The mappings for the JSP servlet -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<!-- snipped unrelated config -->
<!-- ==================== Custom WMS servlet setup ===================== -->
<servlet>
<servlet-name>FortivePFC</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive_PFC</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive2</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive3</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive3</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST2</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>FortivePFC</servlet-name>
<url-pattern>/Fortive-PFC</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive2</servlet-name>
<!-- <url-pattern>/turnsmith/tsmService</url-pattern>-->
<url-pattern>/fortive2/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive3</servlet-name>
<!-- <url-pattern>/NEWCUST/tsmService</url-pattern>-->
<url-pattern>/fortive3/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<url-pattern>/NEWCUST-WebsiteXML</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<url-pattern>/NEWCUST2-WebsiteXML</url-pattern>
</servlet-mapping>
</web-app>
tomcat6 tomcat8 servlets
I have a server which I flip back and forth between tomcat 6 and tomcat 8. When I do an HTTP post using the command
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
I get different results between the different versions of tomcat.
First of all, for tomcat 8, I get:
* About to connect() to localhost port 8080 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> POST /fortive2/tsmService HTTP/1.1
> User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8080
> Accept: */*
> Referrer:mobileWMS,LLC
> Content-Type:text/xml
> Content-Length: 218
>
< HTTP/1.1 404
< Content-Length: 0
< Date: Mon, 20 May 2019 16:17:36 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0
Then, for tomcat 6, I get the proper response, no 404 error. What is happening? This is literally the same server, the same WAR file. My servlets are defined in the main tomcat web.xml ( $CATALINA_HOME/conf/web.xml ), NOT in the war file. This is on purpose, as it lets me quickly add web service URLs for new customers without changing the war file.
Also, I will say that multiple web applications reference the same war file ( multiple customers, so multiple websites with slight different configutations but the same UI ). This has always worked just fine for servlets in tomcat 6, so I just assumed this would keep working for Tomcat 8. Could this be causing a problem?
Also, as a side point, I can access port 8080 just fine in the browser, because that is how I sometimes get to the website or the tomcat manager ( when SSL is giving me problems with certificates ). So it is not the port.
Also, as added information, I have this for ONE of my servlets ( not the one I am using, a totally different servlet ):
@WebServlet(urlPatterns = "/*", name = "WmsServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = WmsUI.class, productionMode = false)
@SuppressWarnings("serial")
public class WmsServlet extends VaadinServlet
@Override
protected final void servletInitialized() throws ServletException
super.servletInitialized();
getService().addSessionInitListener(new WmsSessionInitListener());
And here are some example $CATALINA_HOME/conf/web.xml servlet configurations:
<servlet>
<servlet-name>veeder-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>VEEDER-WS</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>spence-ws</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>SPENCE-WS</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>veeder-ws</servlet-name>
<url-pattern>/veeder-ws/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>spence-ws</servlet-name>
<url-pattern>/spence-ws/tsmService</url-pattern>
</servlet-mapping>
5/21/2019 update: using Servlet Context listener, I get the following for my development server:
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST; Mappings: /NEWCUST-WebsiteXML
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: default; Mappings: /
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WmsServlet; Mappings: /*
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: FortivePFC; Mappings: /Fortive-PFC
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive3; Mappings: /fortive3/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: jsp; Mappings: *.jspx, *.jsp
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: Fortive2; Mappings: /fortive2/tsmService
[2019-05-21 13:11:47 EDT] FINE com.mobiwms.website.WmsContextListener logCurrentServlets Servlet name: WMSWebsite-NEWCUST2; Mappings: /NEWCUST2-WebsiteXML
And the servlet sections of global web.xml ( so $CATALINA_HOME/conf/web.xml ) for my dev machine, where the above logging was printed:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- snipped unrelated config -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- snipped unrelated config -->
<!-- ================ Built In Servlet Mappings ========================= -->
<!-- The servlet mappings for the built in servlets defined above. Note -->
<!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
<!-- must uncomment these mappings (or add them to your application's own -->
<!-- web.xml deployment descriptor) to enable these services -->
<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The mappings for the JSP servlet -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<!-- snipped unrelated config -->
<!-- ==================== Custom WMS servlet setup ===================== -->
<servlet>
<servlet-name>FortivePFC</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive_PFC</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive2</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Fortive3</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSProcessorServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>Fortive3</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<servlet-class>com.wmsvision.servlet.WMSWebsiteServlet</servlet-class>
<init-param>
<param-name>socketType</param-name>
<param-value>WMSWebsite-NEWCUST2</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>FortivePFC</servlet-name>
<url-pattern>/Fortive-PFC</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive2</servlet-name>
<!-- <url-pattern>/turnsmith/tsmService</url-pattern>-->
<url-pattern>/fortive2/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Fortive3</servlet-name>
<!-- <url-pattern>/NEWCUST/tsmService</url-pattern>-->
<url-pattern>/fortive3/tsmService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST</servlet-name>
<url-pattern>/NEWCUST-WebsiteXML</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WMSWebsite-NEWCUST2</servlet-name>
<url-pattern>/NEWCUST2-WebsiteXML</url-pattern>
</servlet-mapping>
</web-app>
tomcat6 tomcat8 servlets
tomcat6 tomcat8 servlets
edited May 21 at 17:34
user3329922
asked May 20 at 16:30
user3329922user3329922
1698
1698
Literally the same server? Tomcat8 is using Servlet API 3.1 while Tomcat6 is using Servlet API 2.5. Increase log verbosity and check your webapp and catalina logs...
– Freddy
May 20 at 21:56
Also read Migrating from 6.0.x to 7.0.x and Migrating from 7.0.x to 8.0.x.
– Freddy
May 20 at 22:02
yes, same physical server. It is trivial to run "service tomcat6 stop" and then "service tomcat8 start".
– user3329922
May 20 at 22:06
Ok, that's what you meant with server. I thought you mean Tomcat. And there might be one or two things you have to adjust. Reading the migration guides could help as well as increasing the log verbosity on both Tomcats/Webapps and comparing the logfiles.
– Freddy
May 20 at 22:13
unless I am mistaken, logging level already set to "ALL". Nothing useful in there. What would I be looking for? I mean, does it even log anything to the tomcat logs in this case?
– user3329922
May 20 at 22:41
|
show 4 more comments
Literally the same server? Tomcat8 is using Servlet API 3.1 while Tomcat6 is using Servlet API 2.5. Increase log verbosity and check your webapp and catalina logs...
– Freddy
May 20 at 21:56
Also read Migrating from 6.0.x to 7.0.x and Migrating from 7.0.x to 8.0.x.
– Freddy
May 20 at 22:02
yes, same physical server. It is trivial to run "service tomcat6 stop" and then "service tomcat8 start".
– user3329922
May 20 at 22:06
Ok, that's what you meant with server. I thought you mean Tomcat. And there might be one or two things you have to adjust. Reading the migration guides could help as well as increasing the log verbosity on both Tomcats/Webapps and comparing the logfiles.
– Freddy
May 20 at 22:13
unless I am mistaken, logging level already set to "ALL". Nothing useful in there. What would I be looking for? I mean, does it even log anything to the tomcat logs in this case?
– user3329922
May 20 at 22:41
Literally the same server? Tomcat8 is using Servlet API 3.1 while Tomcat6 is using Servlet API 2.5. Increase log verbosity and check your webapp and catalina logs...
– Freddy
May 20 at 21:56
Literally the same server? Tomcat8 is using Servlet API 3.1 while Tomcat6 is using Servlet API 2.5. Increase log verbosity and check your webapp and catalina logs...
– Freddy
May 20 at 21:56
Also read Migrating from 6.0.x to 7.0.x and Migrating from 7.0.x to 8.0.x.
– Freddy
May 20 at 22:02
Also read Migrating from 6.0.x to 7.0.x and Migrating from 7.0.x to 8.0.x.
– Freddy
May 20 at 22:02
yes, same physical server. It is trivial to run "service tomcat6 stop" and then "service tomcat8 start".
– user3329922
May 20 at 22:06
yes, same physical server. It is trivial to run "service tomcat6 stop" and then "service tomcat8 start".
– user3329922
May 20 at 22:06
Ok, that's what you meant with server. I thought you mean Tomcat. And there might be one or two things you have to adjust. Reading the migration guides could help as well as increasing the log verbosity on both Tomcats/Webapps and comparing the logfiles.
– Freddy
May 20 at 22:13
Ok, that's what you meant with server. I thought you mean Tomcat. And there might be one or two things you have to adjust. Reading the migration guides could help as well as increasing the log verbosity on both Tomcats/Webapps and comparing the logfiles.
– Freddy
May 20 at 22:13
unless I am mistaken, logging level already set to "ALL". Nothing useful in there. What would I be looking for? I mean, does it even log anything to the tomcat logs in this case?
– user3329922
May 20 at 22:41
unless I am mistaken, logging level already set to "ALL". Nothing useful in there. What would I be looking for? I mean, does it even log anything to the tomcat logs in this case?
– user3329922
May 20 at 22:41
|
show 4 more comments
1 Answer
1
active
oldest
votes
OK, found the answer, and it is so simple. So quick answer, and to save people from making my mistake, don't just check the mappings in web.xml, make sure the context is there, or make sure your URL includes a valid context. So if you are not including the context in the URL, make sure the ROOT.xml configuration is there.
So, to be more specific, in my case, I removed $CATALINA_HOME/conf/Catalina/localhost/ROOT.xml, but was posting to the root context. So with my test above,
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
"fortive2" is NOT the context, it is part of my reference to the servlet. You can see this in my web.xml snippets. Because tomcat8 configuration had no ROOT.xml, it was failing with 404 because could not be found. But tomcat6 worked because I never removed ROOT.xml from that "localhost" directory.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f968119%2fjava-servlet-404-error-tomcat-8-but-not-tomcat-6%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
OK, found the answer, and it is so simple. So quick answer, and to save people from making my mistake, don't just check the mappings in web.xml, make sure the context is there, or make sure your URL includes a valid context. So if you are not including the context in the URL, make sure the ROOT.xml configuration is there.
So, to be more specific, in my case, I removed $CATALINA_HOME/conf/Catalina/localhost/ROOT.xml, but was posting to the root context. So with my test above,
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
"fortive2" is NOT the context, it is part of my reference to the servlet. You can see this in my web.xml snippets. Because tomcat8 configuration had no ROOT.xml, it was failing with 404 because could not be found. But tomcat6 worked because I never removed ROOT.xml from that "localhost" directory.
add a comment |
OK, found the answer, and it is so simple. So quick answer, and to save people from making my mistake, don't just check the mappings in web.xml, make sure the context is there, or make sure your URL includes a valid context. So if you are not including the context in the URL, make sure the ROOT.xml configuration is there.
So, to be more specific, in my case, I removed $CATALINA_HOME/conf/Catalina/localhost/ROOT.xml, but was posting to the root context. So with my test above,
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
"fortive2" is NOT the context, it is part of my reference to the servlet. You can see this in my web.xml snippets. Because tomcat8 configuration had no ROOT.xml, it was failing with 404 because could not be found. But tomcat6 worked because I never removed ROOT.xml from that "localhost" directory.
add a comment |
OK, found the answer, and it is so simple. So quick answer, and to save people from making my mistake, don't just check the mappings in web.xml, make sure the context is there, or make sure your URL includes a valid context. So if you are not including the context in the URL, make sure the ROOT.xml configuration is there.
So, to be more specific, in my case, I removed $CATALINA_HOME/conf/Catalina/localhost/ROOT.xml, but was posting to the root context. So with my test above,
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
"fortive2" is NOT the context, it is part of my reference to the servlet. You can see this in my web.xml snippets. Because tomcat8 configuration had no ROOT.xml, it was failing with 404 because could not be found. But tomcat6 worked because I never removed ROOT.xml from that "localhost" directory.
OK, found the answer, and it is so simple. So quick answer, and to save people from making my mistake, don't just check the mappings in web.xml, make sure the context is there, or make sure your URL includes a valid context. So if you are not including the context in the URL, make sure the ROOT.xml configuration is there.
So, to be more specific, in my case, I removed $CATALINA_HOME/conf/Catalina/localhost/ROOT.xml, but was posting to the root context. So with my test above,
curl -v -X POST -d @webOpenCnsRealCheatsheet.xml -H Referrer:mobileWMS,LLC -H Content-Type:text/xml http://localhost:8080/fortive2/tsmService
"fortive2" is NOT the context, it is part of my reference to the servlet. You can see this in my web.xml snippets. Because tomcat8 configuration had no ROOT.xml, it was failing with 404 because could not be found. But tomcat6 worked because I never removed ROOT.xml from that "localhost" directory.
answered May 22 at 16:10
user3329922user3329922
1698
1698
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f968119%2fjava-servlet-404-error-tomcat-8-but-not-tomcat-6%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Literally the same server? Tomcat8 is using Servlet API 3.1 while Tomcat6 is using Servlet API 2.5. Increase log verbosity and check your webapp and catalina logs...
– Freddy
May 20 at 21:56
Also read Migrating from 6.0.x to 7.0.x and Migrating from 7.0.x to 8.0.x.
– Freddy
May 20 at 22:02
yes, same physical server. It is trivial to run "service tomcat6 stop" and then "service tomcat8 start".
– user3329922
May 20 at 22:06
Ok, that's what you meant with server. I thought you mean Tomcat. And there might be one or two things you have to adjust. Reading the migration guides could help as well as increasing the log verbosity on both Tomcats/Webapps and comparing the logfiles.
– Freddy
May 20 at 22:13
unless I am mistaken, logging level already set to "ALL". Nothing useful in there. What would I be looking for? I mean, does it even log anything to the tomcat logs in this case?
– user3329922
May 20 at 22:41