我收到以下错误。我该如何解决?
java.lang.IllegalStateException:Servlet [com.gym.GymperUI $ Servlet]和Servlet [MyUIServlet]具有相同的网址格式:[/]。相关注释信息:注释[@ javax.servlet.annotation.WebServlet(loadOnStartup = -1,initParams = [],smallIcon =,description =,name = MyUIServlet,value = [],largeIcon =,displayName =,asyncSupported = true,类型为[TYPE]的带注释元素[class com.mycompany.gymproject.MyUI $ MyUIServlet]上的urlPatterns = [/])]
在com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:518)
在com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:446)
在com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:419)
在com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:396)
在com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271)
在com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280)
在com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241)
在com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
在org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:203)
在org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:227)
在org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
在com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:881)
在com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:821)
在com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:377)
在com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
在org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
最佳答案
错误消息告诉您:
Servlet [com.gym.GymperUI$Servlet] and Servlet [MyUIServlet] have the same url Pattern: [/].
这只是意味着您有两个试图处理
/
URL的servlet。因此,请删除其他servlet或确保它们处理单独的URL。