我收到以下错误。我该如何解决?
java.lang.IllegalStateException:Servlet [com.gym.GymperUI $ Servlet]和Servlet [MyUIServlet]具有相同的url模式:[/ ]。相关注释信息:注释[@javax.servlet.annotation.WebServlet(loadOnStartup = -1,initParams = [],smallIcon =,description =,name = MyUIServlet,value = [],largeIcon =,displayName =,asyncSupported = true, urlPatterns = [/ ])]在[TYPE]类型的带注释元素[类com.mycompany.gymproject.MyUI $ MyUIServlet]上 在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) at 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)
答案 0 :(得分:1)
错误消息告诉您:
Servlet [com.gym.GymperUI$Servlet] and Servlet [MyUIServlet] have the same url Pattern: [/].
这只是意味着您有两个尝试处理/
URL的servlet。因此要么删除其他servlet,要么确保它们处理单独的URL。