Struts2的ObjectFactory无法在发布到服务器时加载

时间:2012-07-19 21:00:26

标签: maven struts2 weblogic upgrade

我正在转换一个java web项目以使用Maven。在完成转换项目所需的最低限度之后,使用eclipse的转换和创建一个新的Maven项目并从我的项目中删除类和Web组件,我继续得到相同的错误。谷歌搜索死亡数日后,我认为这是问题发布的时间...

当我在我的应用程序服务器(Weblogic 10.3.3)上运行我的项目时,我在发布时获得了一个堆栈跟踪,它告诉我struts2已经加载,所以它拒绝加载我在web.xml中指定的struts2过滤器。消息很清楚,并给出了违规的struts2类(ObjectFactory)的位置。我检查了运行类和它试图实例化的类的位置。它是相同的版本,经过大量测试后直接从我的codebase maven依赖项部署完全相同的文件。来自我本地m2存储库的对象副本使我的服务器上安装的副本无法加载。

我需要知道告诉Maven或Eclipse的内容,以便他们同意使用jar而不尝试从两个位置加载。

2012-07-19 15:32:10,579 ERROR (dispatcher.Dispatcher:27) - Dispatcher initialization failed
Unable to load configuration. - bean - zip:E:/workspace/jory/Servers/jorydomain/servers/joryServer/tmp/_WL_user/_auto_generated_ear_/knfijb/war/WEB-INF/lib/struts2-c
ore-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
    at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:329)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:95)
    at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:58)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1788)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:140)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:106)
    at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:143)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:820)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1227)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:436)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - zip:E:/workspace/jory/Servers/jorydomain/servers/joryServer/tmp/_WL_user/_
auto_generated_ear_/knfijb/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 42 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - zip:C:/Users/bstewart/.m2/repository/org/apach
e/struts/struts2-core/2.1.8/struts2-core-2.1.8.jar!/struts-default.xml:29:72 - bean - zip:E:/workspace/jory/Servers/jorydomain/servers/joryServer/tmp/_WL_user/_auto_
generated_ear_/knfijb/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:205)
    ... 45 more
<Jul 19, 2012 3:32:10 PM CDT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
Unable to load configuration. - bean - zip:E:/workspace/jory/Servers/jorydomain/servers/joryServer/tmp/_WL_user/_auto_generated_ear_/knfijb/war/WEB-INF/lib/struts2-c
ore-2.1.8.jar!/struts-default.xml:29:72
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
    at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:329)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    Truncated. see log file for complete stacktrace
Unable to load configuration. - bean - zip:E:/workspace/jory/Servers/jorydomain/servers/joryServer/tmp/_WL_user/_auto_generated_ear_/knfijb/war/WEB-INF/lib/struts2-c
ore-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
    at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:329)
    Truncated. see log file for complete stacktrace
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - zip:E:/workspace/jory/Servers/jorydomain/servers/joryServer/tmp/_WL_user/_auto_genera
ted_ear_/knfijb/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    Truncated. see log file for complete stacktrace
Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - zip:C:/Users/bstewart/.m2/repository/org/apache/struts/st
ruts2-core/2.1.8/struts2-core-2.1.8.jar!/struts-default.xml:29:72 - bean - zip:E:/workspace/jory/Servers/jorydomain/servers/joryServer/tmp/_WL_user/_auto_generated_e
ar_/knfijb/war/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:205)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
    Truncated. see log file for complete stacktrace
> 

的pom.xml:

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.ahom</groupId>
  <artifactId>AMHOM_Order_Entry</artifactId>
  <version>5.0.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>Project Name</name>
  <url>http://applications.com/Project Name</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.6</java.version>
        <springframework.version>3.1.2.RELEASE</springframework.version>
        <springframework.webflow.version>2.3.0.RELEASE</springframework.webflow.version>
        <springframework.ldap.version>1.3.0.RELEASE</springframework.ldap.version>
        <aspectj.version>1.6.9</aspectj.version>
        <slf4j.version>1.6.1</slf4j.version>
        <jstl.version>1.2</jstl.version>
        <data.version>2.0.0-SNAPSHOT</data.version>
        <common.version>2.0.0-SNAPSHOT</common.version>
        <facade.version>1.0.2</facade.version>
        <security.version>1.0.2</security.version>
        <struts2.version>2.1.8</struts2.version>
        <!-- http://maven.apache.org/plugins/index.html for version numbers -->
        <surefire.version>2.8</surefire.version>
        <maven.eclipse.plugin.version>2.8</maven.eclipse.plugin.version>
    </properties>

  <dependencies>

        <!-- Tiles -->
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <version>2.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>2.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-core</artifactId>
            <version>1.3.10</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-extras</artifactId>
            <version>1.3.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-taglib</artifactId>
            <version>1.3.10</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>asm</artifactId>
                    <groupId>asm</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>asm-commons</artifactId>
                    <groupId>asm</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>asm-tree</artifactId>
                    <groupId>asm</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-lang3</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>javassist</artifactId>
                    <groupId>javassist</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <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>
            <scope>runtime</scope>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox</artifactId>
            <version>1.6.0</version>
        </dependency>

        <dependency>
            <groupId>com.ahom</groupId>
            <artifactId>AMHOM_Data</artifactId>
            <version>${data.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>struts-core</artifactId>
                    <groupId>org.apache.struts</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-dbcp</artifactId>
                    <groupId>commons-dbcp</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-pool</artifactId>
                    <groupId>commons-pool</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jcl-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>slf4j-api</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.ahom</groupId>
            <artifactId>AMHOM_Common</artifactId>
            <version>${common.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>struts-core</artifactId>
                    <groupId>org.apache.struts</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>bcmail-jdk14</artifactId>
                    <groupId>bouncycastle</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>bcprov-jdk14</artifactId>
                    <groupId>bouncycastle</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>itext</artifactId>
                    <groupId>com.lowagie</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jcl-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>weblogic.security.auth</artifactId>
                    <groupId>com.bea.core</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>weblogic.security.identity</artifactId>
                    <groupId>com.bea.core</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>wls-api</artifactId>
                    <groupId>com.bea.core</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>slf4j-api</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5.6</version>
        </dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>

  </dependencies>


    <repositories>
        <repository>
            <id>AHOM-repository</id>
            <url>http://appdev02:8080/archiva/repository/internal/</url>
        </repository>
        <!-- Spring Library -->
        <repository>
            <id>com.springsource.repository.libraries.release</id>
            <name>SpringSource Enterprise Bundle Repository - SpringSource Library Releases</name>
            <url>http://repository.springsource.com/maven/libraries/release</url>
        </repository>
        <repository>
            <id>com.springsource.repository.libraries.external</id>
            <name>SpringSource Enterprise Bundle Repository - External Library Releases</name>
            <url>http://repository.springsource.com/maven/libraries/external</url>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.release</id>
            <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
            <url>http://repository.springsource.com/maven/bundles/release</url>
        </repository>
        <repository>
            <id>com.springsource.repository.bundles.external</id>
            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
            <url>http://repository.springsource.com/maven/bundles/external</url>
        </repository>
    </repositories>
    <distributionManagement>
        <repository>
            <id>AHOM-repository</id>
            <url>http://appdev02:8080/archiva/repository/internal/</url>
            <uniqueVersion>false</uniqueVersion>
        </repository>
    </distributionManagement>
</project>

WEB.XML

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>app name</display-name>

    <!--====================================-->
    <!-- Context Parameters                 -->
    <!--====================================-->
    <context-param>
        <param-name>
            org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
        <param-value>
            classpath:/config/common/tiles/tiles-common-*.xml
        </param-value>
    </context-param>
    <context-param>  
        <param-name>org.apache.tiles.context.AbstractTilesApplicationContextFactory</param-name>
        <param-value>  
            org.apache.tiles.servlet.context.wildcard.WildcardServletTilesApplicationContextFactory
        </param-value>  
    </context-param>

    <!--====================================-->
    <!-- Filters/Mappings                   -->
    <!--====================================-->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*</url-pattern>
    </filter-mapping>

    <!--====================================-->
    <!-- Listeners                          -->
    <!--====================================-->
    <listener>
        <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
    </listener>

    <listener>
        <listener-class>com.ahom.orderentry.utilities.SessionListener</listener-class>
    </listener>

    <listener>
        <listener-class>
            com.ahom.common.log.Log4jConfigListener
        </listener-class>
    </listener>

    <!--====================================-->
    <!-- Servlet Configuration              -->
    <!--====================================-->
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>validate</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>convertNull</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!--====================================-->
    <!-- Servlet URL mappings               -->
    <!--====================================-->
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!--====================================-->
    <!-- Session Configuration              -->
    <!--====================================-->
    <session-config>
        <session-timeout>120</session-timeout>
    </session-config>

    <!--====================================-->
    <!-- Welcome File                       -->
    <!--====================================-->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <!--====================================-->
    <!-- Error Pages                        -->
    <!--====================================-->
    <error-page>
        <error-code>401</error-code>
        <location>/WEB-INF/webtiles/common/security/accessDenied.jsp</location>
    </error-page>


</web-app>

0 个答案:

没有答案