在 Tomcat 7 上部署一个 Seam 项目(war 文件)- Maven:两个同名的组件

Deploying a Seam project (war file) on Tomcat 7 - Maven: two components with same name

[编辑]
可以在以下位置找到工作项目:
https://github.com/joergi77/JSF2_Richfaces4_Seam_23

[/编辑]

当我在 Tomcat 7.0.57 上部署我的项目时(一直是 JBoss ear projekt,我正在将结构更改为 war 文件),我'我没有收到错误,但以下信息是 war 告诉我的,我有两个同名的组件。

我编译这个项目没有问题,这个错误只发生在我将 war 文件部署到 Tomcat 7.0.57 时我遇到了问题。

我的设置:

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.transaction.transaction

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.security.persistentPermissionResolver

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.core.locale

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.web.userPrincipal

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.core.manager

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.core.locale

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.core.expressions

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.persistence.persistenceProvider

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.async.dispatcher

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.core.resourceLoader

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.web.isUserInRole

Initialization [INFO] two components with same name, higher precedence wins: org.jboss.seam.web.parameters

使用 mvn dependency:tree 我得到了以下信息:

 com.ourproject:war:1.0-SNAPSHOT
 +- de.dialogworks.base:company-connect:jar:1.1.1-SNAPSHOT:compile
 |  +- de.dialogworks.base:company-utils:jar:1.1.1-SNAPSHOT:compile
 |  |  +- commons-io:commons-io:jar:1.3.1:compile (version managed from 1.3.2)
 |  |  \- net.sf.opencsv:opencsv:jar:2.3:compile
 |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
 |  +- com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile
 |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile
 |  +- com.fasterxml.jackson.datatype:jackson-datatype-hibernate4:jar:2.3.0:compile
 |  +- com.sun.jersey:jersey-server:jar:1.14:compile
 |  |  \- com.sun.jersey:jersey-core:jar:1.14:compile
 |  +- com.sun.jersey:jersey-client:jar:1.14:compile
 |  +- com.sun.jersey:jersey-json:jar:1.14:compile
 |  |  +- org.codehaus.jettison:jettison:jar:1.1:compile (version managed from 1.1)
 |  |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile
 |  |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:compile
 |  |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.2:compile
 |  |  \- org.codehaus.jackson:jackson-xc:jar:1.9.2:compile
 |  \- com.sun.jersey.contribs:jersey-multipart:jar:1.14:compile
 |     \- org.jvnet:mimepull:jar:1.6:compile
 +- org.jboss.seam:jboss-seam-ui:jar:2.3.1.Final:compile
 |  \- org.jboss.seam:jboss-seam:jar:2.3.1.Final:compile (version managed from 2.3.1.Final)
 |     +- org.testng:testng:jar:5.14.10:compile (version managed from 5.14.10)
 |     |  +- org.beanshell:bsh:jar:2.0b4:compile (version managed from 2.0b4)
 |     |  +- com.beust:jcommander:jar:1.12:compile
 |     |  \- org.yaml:snakeyaml:jar:1.6:compile
 |     +- junit:junit:jar:4.8.2:compile (version managed from 4.8.2)
 |     \- org.jboss.el:jboss-el:jar:1.0_02.CR6:compile (version managed from 1.0_02.CR6)
 +- org.jboss.seam:jboss-seam-remoting:jar:2.3.1.Final:compile
 +- javax.persistence:persistence-api:jar:1.0:compile
 +- org.hibernate:hibernate-validator:jar:4.0.2.GA:compile
 |  +- javax.xml.bind:jaxb-api:jar:2.1:compile
 |  |  \- javax.xml.stream:stax-api:jar:1.0-2:compile
 |  \- com.sun.xml.bind:jaxb-impl:jar:2.1.3:compile
 +- org.hibernate:hibernate-core:jar:4.0.1.Final:compile
 |  +- commons-collections:commons-collections:jar:3.2.1:compile
 |  +- antlr:antlr:jar:2.7.6:compile (version managed from 2.7.7)
 |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile (version managed from 1.0.0.Final)
 |  +- dom4j:dom4j:jar:1.6.1-brew:compile (version managed from 1.6.1)
 |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile (version managed from 1.0.1.Final)
 |  +- org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
 |  +- org.javassist:javassist:jar:3.15.0-GA:compile (version managed from 3.15.0-GA)
 |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
 +- javax.validation:validation-api:jar:1.1.0.Final:compile
 +- org.hibernate:hibernate-entitymanager:jar:4.0.1.Final:compile
 +- javax.mail:mail:jar:1.4:compile
 |  \- javax.activation:activation:jar:1.1.1:compile (version managed from 1.1)
 +- org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.0.Final:compile
 +- com.pdflib:pdflib:jar:8.0:compile
 +- quartz:quartz:jar:1.5.2:compile
 |  \- commons-logging:commons-logging:jar:1.0.4:compile
 +- org.jfree:jfreechart:jar:1.0.19:compile
 |  \- org.jfree:jcommon:jar:1.0.23:compile
 +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.6.0:compile
 |  +- xml-resolver:xml-resolver:jar:1.2:compile
 |  +- asm:asm:jar:3.3.1:compile
 |  +- org.apache.cxf:cxf-api:jar:2.6.0:compile
 |  |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.2:runtime
 |  |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
 |  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.2:compile
 |  |  +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
 |  |  \- wsdl4j:wsdl4j:jar:1.6.2:compile
 |  +- org.apache.cxf:cxf-rt-core:jar:2.6.0:compile
 |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.6.0:compile
 |  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.6.0:compile
 |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.6.0:compile
 |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.6.0:compile
 |  \- org.apache.cxf:cxf-rt-ws-addr:jar:2.6.0:compile
 |     \- org.apache.cxf:cxf-rt-ws-policy:jar:2.6.0:compile
 |        \- org.apache.neethi:neethi:jar:3.0.2:compile
 +- org.apache.cxf:cxf-rt-transports-http:jar:2.6.0:compile
 +- org.apache.cxf:cxf-rt-transports-local:jar:2.6.0:compile
 +- commons-net:commons-net:jar:2.0:compile
 +- javax.el:el-api:jar:2.2:provided
 +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
 +- com.jcraft:jsch:jar:0.1.48:compile
 +- org.apache.sanselan:sanselan:jar:0.97-incubator:compile
 +- javax.servlet.jsp:jsp-api:jar:2.1:provided
 +- com.sun.faces:jsf-api:jar:2.1.2:compile
 +- com.sun.faces:jsf-impl:jar:2.1.2:compile
 +- javax.servlet:jstl:jar:1.1.2:compile
 +- org.richfaces.ui:richfaces-ui:jar:3.3.3.Final:compile
 |  +- org.richfaces.framework:richfaces-api:jar:3.3.3.Final:compile
 |  +- commons-beanutils:commons-beanutils:jar:1.7.0:compile (version managed from 1.8.0)
 |  \- commons-digester:commons-digester:jar:2.1:compile (version managed from 1.8.1)
 +- org.richfaces.framework:richfaces-impl-jsf2:jar:3.3.3.Final:compile
 +- commons-lang:commons-lang:jar:2.3:compile
 +- log4j:log4j:jar:1.2.14:compile
 +- org.slf4j:slf4j-log4j12:jar:1.5.8:compile
 +- org.slf4j:slf4j-api:jar:1.5.8:compile
 +- mysql:mysql-connector-java:jar:5.1.18:compile
 +- net.sourceforge.jexcelapi:jxl:jar:2.6.10:compile
 \- joda-time:joda-time:jar:2.0:compile

我的pom.xml、web.xml等文件都在这个.

我真的看不出来,哪里隐藏了双分量

在执行 mvn dependency:tree -Dincludes=org.jboss.seam 时,我得到以下信息,这对我来说似乎不是问题:

 +- org.jboss.seam:jboss-seam-ui:jar:2.3.1.Final:compile
 |  \- org.jboss.seam:jboss-seam:jar:2.3.1.Final:compile (version managed from 2.3.1.Final)
 \- org.jboss.seam:jboss-seam-remoting:jar:2.3.1.Final:compile

[已编辑] - 这是我的 components.xml

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.org/schema/seam/components"
            xmlns:core="http://jboss.org/schema/seam/core"
            xmlns:persistence="http://jboss.org/schema/seam/persistence"
            xmlns:transaction="http://jboss.org/schema/seam/transaction"
            xmlns:security="http://jboss.org/schema/seam/security"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:mail="http://jboss.org/schema/seam/mail"
            xmlns:async="http://jboss.org/schema/seam/async"
            xmlns:web="http://jboss.org/schema/seam/web"
            xsi:schemaLocation=
                "http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd 
                http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd 
                http://jboss.org/schema/seam/transaction http://jboss.org/schema/seam/transaction-2.3.xsd 
                http://jboss.org/schema/seam/security http://jboss.org/schema/seam/security-2.3.xsd
                http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd
                http://jboss.org/schema/seam/mail http://jboss.org/schema/seam/mail-2.3.xsd
                http://jboss.org/schema/seam/async http://jboss.org/schema/seam/async-2.3.xsd
                http://jboss.org/schema/seam/web http://jboss.org/schema/seam/web-2.3.xsd">

    <core:init debug="true"/>

    <!--  took the following from http://community.jboss.org/thread/10024?tstart=0 -->
    <core:manager concurrent-request-timeout="30000"
        conversation-id-parameter="cid" conversation-timeout="1200000"
        parent-conversation-id-parameter="pid" />

    <transaction:entity-transaction entity-manager="#{entityManager}"/>

    <persistence:entity-manager-factory name="projectDatabase"/>

    <persistence:managed-persistence-context name="entityManager"
                               auto-create="true" 
                    entity-manager-factory="#{projectDatabase}"/>

    <security:jpa-identity-store
        user-class="com.ourproject.user.model.Account"
        role-class="com.ourproject.user.model.AccountRole" />

    <security:permission-manager permission-store="#{jpaPermissionStore}"/>      

    <security:jpa-permission-store
        user-permission-class="com.ourproject.user.model.AccountPermission"/>

    <web:multipart-filter create-temp-files="true"
        max-request-size="100000000" url-pattern="*.html" />

    <web:logging-filter disabled="true" />

    <web:cache-control-filter name="imageCacheControlFilter"
        regex-url-pattern=".*(\.gif|\.png|\.jpg|\.jpeg)" value="max-age=86400" />

    <web:cache-control-filter name="textCacheControlFilter"
        regex-url-pattern=".*(\.css|\.js)" value="max-age=1400" />

    <core:resource-loader>
        <core:bundle-names>
            <value>messages</value>
            <value>navigation_messages</value>
            <value>product_messages</value>
            <value>customer_referral</value>
        </core:bundle-names>
    </core:resource-loader>

    <async:quartz-dispatcher />


</components>

这是我的seam.properties(我的项目中只有1个)

# SEAM Settings
org.jboss.seam.core.init.debug=false

但我也有一个 seam.quartz.properties

#==============================================================
# Configure Main Scheduler Properties
#==============================================================

org.quartz.scheduler.instanceName = Sched1
org.quartz.scheduler.instanceId = AUTO
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false

#==============================================================
# Configure ThreadPool
#==============================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 3

#==============================================================
# Configure JobStore
#==============================================================

org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

seam.properties 和 seam.quartz.properties 在一起有问题吗?

这是我 tomcat/libs 文件夹中的库

annotations-api.jar
catalina-ant.jar
catalina-ha.jar
catalina.jar
catalina-tribes.jar
ecj-4.4.jar
el-api.jar
jasper-el.jar
jasper.jar
jsp-api.jar
servlet-api.jar
tomcat7-websocket.jar
tomcat-api.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
tomcat-jdbc.jar
tomcat-util.jar
websocket-api.jar

应@tair 的要求,这是我的 jar -tf my.war

META-INF/
META-INF/MANIFEST.MF
WEB-INF/

...our stuff removed ..

WEB-INF/pages.xml
WEB-INF/lib/jersey-client-1.14.jar
WEB-INF/lib/mysql-connector-java-5.1.18.jar
WEB-INF/lib/slf4j-log4j12-1.5.8.jar
WEB-INF/lib/hibernate-commons-annotations-4.0.1.Final.jar
WEB-INF/lib/jackson-core-2.3.0.jar
WEB-INF/lib/cxf-rt-frontend-simple-2.6.0.jar
WEB-INF/lib/javassist-3.12.0.GA.jar
WEB-INF/lib/xml-resolver-1.2.jar
WEB-INF/lib/testng-5.14.10.jar
WEB-INF/lib/jsf-api-2.1.2.jar
WEB-INF/lib/jersey-server-1.14.jar
WEB-INF/lib/commons-lang-2.3.jar
WEB-INF/lib/cxf-rt-transports-local-2.6.0.jar
WEB-INF/lib/activation-1.1.1.jar
WEB-INF/lib/bsh-2.0b4.jar
WEB-INF/lib/jettison-1.1.jar
WEB-INF/lib/richfaces-api-3.3.3.Final.jar
WEB-INF/lib/slf4j-api-1.5.8.jar
WEB-INF/lib/commons-beanutils-1.7.0.jar
WEB-INF/lib/jersey-json-1.14.jar
WEB-INF/lib/log4j-1.2.14.jar
WEB-INF/lib/persistence-api-1.0.jar
WEB-INF/lib/cxf-rt-frontend-jaxws-2.6.0.jar
WEB-INF/lib/snakeyaml-1.6.jar
WEB-INF/lib/commons-logging-1.0.4.jar
WEB-INF/lib/stax-api-1.0-2.jar

WEB-INF/lib/xmlschema-core-2.0.2.jar
WEB-INF/lib/jaxb-api-2.1.jar
WEB-INF/lib/jboss-seam-remoting-2.3.1.Final.jar
WEB-INF/lib/javassist-3.15.0-GA.jar
WEB-INF/lib/joda-time-2.0.jar
WEB-INF/lib/neethi-3.0.2.jar
WEB-INF/lib/jackson-core-asl-1.9.2.jar
WEB-INF/lib/jxl-2.6.10.jar
WEB-INF/lib/pdflib-8.0.jar
WEB-INF/lib/jackson-xc-1.9.2.jar
WEB-INF/lib/jboss-transaction-api_1.1_spec-1.0.1.Final.jar
WEB-INF/lib/sanselan-0.97-incubator.jar
WEB-INF/lib/opencsv-2.3.jar
WEB-INF/lib/mail-1.4.jar
WEB-INF/lib/hibernate-core-4.0.1.Final.jar
WEB-INF/lib/cxf-rt-ws-addr-2.6.0.jar
WEB-INF/lib/jstl-1.1.2.jar
WEB-INF/lib/commons-net-2.0.jar
WEB-INF/lib/jackson-datatype-hibernate4-2.3.0.jar
WEB-INF/lib/woodstox-core-asl-4.1.2.jar
WEB-INF/lib/cxf-rt-databinding-jaxb-2.6.0.jar
WEB-INF/lib/commons-collections-3.2.1.jar
WEB-INF/lib/wsdl4j-1.6.2.jar
WEB-INF/lib/cxf-rt-transports-http-2.6.0.jar

WEB-INF/lib/cxf-rt-bindings-soap-2.6.0.jar
WEB-INF/lib/cxf-api-2.6.0.jar
WEB-INF/lib/jboss-el-1.0_02.CR6.jar
WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
WEB-INF/lib/jfreechart-1.0.19.jar
WEB-INF/lib/jcommon-1.0.23.jar
WEB-INF/lib/jcommander-1.12.jar
WEB-INF/lib/richfaces-impl-jsf2-3.3.3.Final.jar
WEB-INF/lib/jaxb-impl-2.1.3.jar
WEB-INF/lib/validation-api-1.1.0.Final.jar
WEB-INF/lib/jackson-mapper-asl-1.9.2.jar
WEB-INF/lib/jboss-interceptors-api_1.1_spec-1.0.0.Final.jar
WEB-INF/lib/jboss-seam-2.3.1.Final.jar
WEB-INF/lib/jsch-0.1.48.jar
WEB-INF/lib/jsf-impl-2.1.2.jar
WEB-INF/lib/jboss-logging-3.1.0.CR2.jar
WEB-INF/lib/commons-digester-2.1.jar
WEB-INF/lib/cxf-rt-core-2.6.0.jar
WEB-INF/lib/jboss-seam-ui-2.3.1.Final.jar
WEB-INF/lib/asm-3.3.1.jar
WEB-INF/lib/hibernate-validator-4.0.2.GA.jar
WEB-INF/lib/cxf-rt-bindings-xml-2.6.0.jar
WEB-INF/lib/geronimo-javamail_1.4_spec-1.7.1.jar
WEB-INF/lib/richfaces-ui-3.3.3.Final.jar
WEB-INF/lib/jersey-multipart-1.14.jar
WEB-INF/lib/antlr-2.7.6.jar
WEB-INF/lib/jackson-annotations-2.3.0.jar
WEB-INF/lib/hibernate-entitymanager-4.0.1.Final.jar
WEB-INF/lib/quartz-1.5.2.jar
WEB-INF/lib/jersey-core-1.14.jar
WEB-INF/lib/stax2-api-3.1.1.jar
WEB-INF/lib/mimepull-1.6.jar
WEB-INF/lib/junit-4.8.2.jar
WEB-INF/lib/commons-io-1.3.1.jar
WEB-INF/lib/cxf-rt-ws-policy-2.6.0.jar
WEB-INF/lib/dom4j-1.6.1-brew.jar
WEB-INF/lib/jackson-databind-2.3.0.jar
WEB-INF/lib/jackson-jaxrs-1.9.2.jar
WEB-INF/navigation.xml
WEB-INF/faces-config.xml
WEB-INF/homescreen-warning.page.xml
WEB-INF/web.xml

WEB-INF/classes/ourproject-datamodel.application.properties

WEB-INF/classes/ter

WEB-INF/classes/seam.properties
WEB-INF/classes/customer_referral.properties
WEB-INF/classes/seam.quartz.properties

WEB-INF/classes/META-INF/components.xml
WEB-INF/classes/META-INF/persistence.xml
WEB-INF/classes/log4j.properties
WEB-INF/classes/logging.properties

login.page.xml
error.page.xml

如果您的应用程序按预期工作,您不必担心这些消息。这是 overriding/extending Seam 框架 JBoss 内置功能的标准方式。请参阅此处的示例 [1].

这些消息并不表示类路径重复,因为在这种情况下,您会得到类似 ERROR: Found two or more components with same name and precedence ...

的信息

[1] http://docs.jboss.org/seam/2.3.1.Final/reference/html_single/#d0e13759