我最近尝试从 java7-java8 转换 Eclipse、Google Appengine 项目,因为 GAE 已停止支持 java7(或将在不久的将来支持)。该项目在开始转换之前运行良好。尝试在本地运行项目时,我现在收到此错误:
java.lang.IllegalStateException: Multiple servlets map to path: /api/add-batch-shelfsurvey: ApiShelfSurveyBatchServlet,com.imobdev.figjam.ApiShelfSurveyBatchServlet
这是该 servlet 的 web.xml 中的条目:
<servlet>
<servlet-name>ApiShelfSurveyBatchServlet</servlet-name>
<servlet-class>com.imobdev.figjam.ApiShelfSurveyBatchServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ApiShelfSurveyBatchServlet</servlet-name>
<url-pattern>/api/add-batch-shelfsurvey</url-pattern>
</servlet-mapping>
这是 web.xml 文件的开头:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
我已经两次和三次检查 /api/add-batch-shelfsurvey 路径在 web.xml 中是唯一的,但我仍然收到此错误。错误消息中提到的 servlet 发生了变化,但它们都没有多个映射到一个路径。我发现这些线程看起来相似但实际上并不相关:https : //github.com/dropwizard/dropwizard/issues/2107 https://bugs.eclipse.org/bugs/show_bug.cgi?id=479865
我不知道它是否相关,但这是我的 appengine-web.xml 文件:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<threadsafe>true</threadsafe>
<url-stream-handler>urlfetch</url-stream-handler>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
<property name="appengine.file.encoding" value="US-ASCII"/>
</system-properties>
<sessions-enabled>true</sessions-enabled>
<runtime>java8</runtime>
</appengine-web-app>
莫回无
catspeake
相关分类