当我将我的应用程序部署到glassfish时, 它给出了上述错误
这是stacktrace
java.lang.IllegalStateException: Servlet [ParticipantPortImpl] and Servlet [CoordinatorPortImpl] have the same url pattern: [/WSAT11Service]at org.glassfish.apf.AnnotationInfo@1b6fe03
at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:487)
at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:429)
at com.sun.enterprise.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:358)
at com.sun.enterprise.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:89)
at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:406)
at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:380)
从weblogic到glassfish的迁移项目 我在webapp文件夹中添加了glassfish-web.xml
我的pom.xml是
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org /2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>projectPartsListWar</artifactId>
<name>PTL war</name>
<packaging>war</packaging>
<parent>
<groupId>com.bmw.au</groupId>
<artifactId>standardReportingParent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../standardReportingParent/pom.xml</relativePath>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<webXmlPath>src/main/webapp/WEB-INF/web_int_prod.xml</webXmlPath>
<maven.skippAuthorization.setting>skippAuthorization=false</maven.skippAuthorization.setting>
<preassembly.dir>${basedir}/target/preassembly</preassembly.dir>
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
<sonar.java.source>1.5</sonar.java.source>
<sonar.java.target>1.5</sonar.java.target>
</properties>
<dependencies>
<dependency>
<groupId>com.bmw.au</groupId>
<artifactId>auReportingCommonsWeb</artifactId>
</dependency>
<dependency>
<groupId>com.bmw.au</groupId>
<artifactId>au.core</artifactId>
</dependency>
<dependency>
<groupId>trove</groupId>
<artifactId>trove</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.bea.wls</groupId>
<artifactId>wlfullclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>projectPartsListEjb</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<!-- this should be overrided -->
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<!-- this should be overrided -->
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-impl</artifactId>
</dependency>
<dependency>
<groupId>com.bmw.shared.grops</groupId>
<artifactId>grops</artifactId>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api-osgi</artifactId>
<version>2.1-b07</version>
</dependency>
<dependency>
<groupId>org.glassfish.metro</groupId>
<artifactId>webservices-osgi</artifactId>
<version>2.1.1-b07</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2.2</version>
</dependency>
<dependency>
<groupId>javaee</groupId>
<artifactId>javaee-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<profiles>
<profile>
<id>TEST</id>
<properties>
<webXmlPath>src/main/webapp/WEB-INF/web.xml</webXmlPath>
<maven.skippAuthorization.setting>skippAuthorization=true</maven.skippAuthorization.setting>
</properties>
</profile>
<profile>
<id>DEV</id>
<properties>
<webXmlPath>src/main/webapp/WEB-INF/web.xml</webXmlPath>
<maven.skippAuthorization.setting>skippAuthorization=true</maven.skippAuthorization.setting>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<!-- Use different web,xml depending on environment. Use profiles to
set web.xml to use. Antbuild also sets profile dependeing on environment. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>${webXmlPath}</webXml>
<webResources>
<resource>
<!-- copy resources from this folder into the webapp before packaging -->
<directory>${preassembly.dir}</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/classes/au_reporting_web.properties</file>
<replacements>
<replacement>
<token>skippAuthorization=true</token>
<value>${maven.skippAuthorization.setting}</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- do some processing on your resources files -->
<phase>process-resources</phase>
<configuration>
<tasks>
<echo message="processing files..." />
<!-- copy the file to be processed -->
<property name="preassembly.dir" value="${basedir}/target/preassembly" />
<property name="resourceDir" value="${basedir}/src/main/webapp/templates" />
<property name="resource" value="default-footer.xhtml" />
<copy file="${resourceDir}/${resource}" todir="${preassembly.dir}/templates" />
<ant antfile="./replaceproperties.xml" target="replaceproperties" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 0 :(得分:3)
我认为这解决了这个问题(对我有用):
我有一个非常类似的错误涉及RegistrationService。原因是依赖于glassfish-embedded-all以及提供的解决方案
来源:https://blogs.oracle.com/....
尝试使用以下设置:
$('#ok').click(function(e) {
var number = $('#snumber').val();
var scontent = $('#scontent').val();
var img = $('#img').val();
for(i = 0; i <= 2; i++) {
dataEnd = 'du='+i+'&scontent='+scontent+'&img='+img;
timeout = 9000*i + 9000;
setTimeout(function(){
$.ajax({
type: 'POST',
url: 'xuly.php',
data: dataEnd,
success: function(amw){
alert(dataEnd);
}
});
}, timeout);
}
});
答案 1 :(得分:1)
查看这两个Servlet的源代码(ParticipantPortImpl和CoordinatorPortImpl)。您将看到它们都具有指定相同URL模式的@WebServlet
注释。不允许将多个Servlet映射到URL模式,因此您需要确定哪个需要更改并更改它。
答案 2 :(得分:-1)
I am getting same error -
Caused by: java.lang.IllegalArgumentException: Servlet [ParticipantPortTypePortImpl] and Servlet [CoordinatorPortTypePortImpl] have the same url pattern: [/WSAT10Service]
at org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl.addWebComponentDescriptor(WebBundleDescriptorImpl.java:370)
at org.glassfish.webservices.connector.annotation.handlers.WebServiceHandler.processAnnotation(WebServiceHandler.java:461)
at com.sun.enterprise.deployment.annotation.factory.SJSASFactory$LazyAnnotationHandler.processAnnotation(SJSASFactory.java:148)
at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:352)
i have tried using :
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
but issue not resolved. Any other solution for same ?