Getting IllegalStateException: No such servlet: js

2020-04-11 09:55发布

I've been trying to deploy a Spring MVC Java Web Application on a Google App Engine application but been having no luck doing so. I'm using App Engine Java SDK to deploy it from my machine. When I perform a deploy, I can access the resources (such as images, js, etc through URL). But when I try to access the homepage I get a response with 500 status code, and the error on the server is the following: java.lang.IllegalStateException: No such servlet: jsp at org.eclipse.jetty.servlet.ServletHandler.updateMappings (ServletHandler.java:1535) at org.eclipse.jetty.servlet.ServletHandler.doStart (ServletHandler.java:157) ...

I've tried to lookup the "No such servlet: jsp" error but I didn't get any luck with the different suggestions found. PS: When testing web server in the local development environment using the App Engine command the Web Server works as expected.

Hope you can give me any suggestion to what must be doing wrong.

Thank you

1条回答
放我归山
2楼-- · 2020-04-11 10:52

This problem appeared for the first time when we tried to migrate from Java 7 to 8 on GAE. We have Spring MVC + Apache Tiles and we are serving legacy JSP pages. Since this was pointing to JSP problem I started playing around with related options. One of these was defined inside web.xml as follow:

<jsp-property-group>
			<url-pattern>*.jsp</url-pattern>
			<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>

I simply removed this jsp-property-group definition and GAE server started serving JSP back again. We are now able to use Java 8 on GAE with Spring MVC and Apache Tiles but we now have to live with JSP extra generated whitespaces as described here: How to trim whitespaces from your JSP pages which was not a deal breaker for us while targeting JDK 1.8 was an absolute requirement... Hope this helps.

查看更多
登录 后发表回答