servlets - java.lang.IllegalStateException : Servlet [ParticipantPortImpl] and Servlet [CoordinatorPortImpl] have the same url pattern: [/WSAT11Service]

标签 servlets migration

您好,当我将应用程序部署到 glassfish 时, 它给出了上述错误

这是堆栈跟踪

    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>

最佳答案

我认为这解决了问题(这对我有用):

我遇到了一个涉及 RegistrationService 的非常类似的错误。原因是对 glassfish-embedded-all 的依赖以及设置提供的解决方案

来源:https://blogs.oracle.com/....

尝试使用这些设置:

 <dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>3.1.2.2</version>
    <scope>provided</scope>
 </dependency>

关于servlets - java.lang.IllegalStateException : Servlet [ParticipantPortImpl] and Servlet [CoordinatorPortImpl] have the same url pattern: [/WSAT11Service],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22663520/

相关文章:

visual-studio-2012 - TFS2012错误的用户丢失工作区

node.js - 一个迁移文件中的多个迁移语句

java - servlet 的 Servlet.service() [ Jersey REST 服务] java.lang.NullPointerException

java - 在 Servlet 中获取真实的客户端 IP

java - 使用jsp向浏览器显示动态生成的图像

spring - 如何调试卡住的迁移

web-applications - 从其他线程关闭 http session

java - 使用 JDBC 的 Servlet

python - 我的旧项目的 Django 1.7 迁移问题

mysql - 将印度语言数据从 SQL Server 迁移到 MySQL