我部署战争时出错(TomCat)

发布于 2024-09-19 08:44:50 字数 6856 浏览 8 评论 0原文

当我将战争部署到 TomCat 时,出现以下错误:

9月14日2010 11:48:07 org.apache.catalina.core.StandardContext filterStart GRAVE: 异常 au démarrage du filtre struts2 无法 加载 bean: 类型: 类:com.opensymphony.xwork2.ObjectFactory - bean - jar:文件:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/tuto-hello/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-默认.xml:29:72 在 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208) 在 org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101) 在 com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131) 在 com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) 在 org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) 在 org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452) 在 org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201) 在 org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) 在 org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) 在 org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115) 在 org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001) 在 org.apache.catalina.core.StandardContext.start(StandardContext.java:4651) 在 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) 在 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) 在 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546) 在 org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905) 在 org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740) 在 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500) 在 org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) 在 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) 在 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 在 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 在 org.apache.catalina.core.StandardHost.start(StandardHost.java:785) 在 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 在 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445) 在 org.apache.catalina.core.StandardService.start(StandardService.java:519) 在 org.apache.catalina.core.StandardServer.start(StandardServer.java:710) 在 org.apache.catalina.startup.Catalina.start(Catalina.java:581) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native 方法)在 sun.reflect.NativeMethodAccessorImpl.invoke(未知 来源)于 sun.reflect.DelegatingMethodAccessorImpl.invoke(未知 来源)于 java.lang.reflect.Method.invoke(未知 来源)于 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) 在 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 引起原因:Bean类型类 com.opensymphony.xwork2.ObjectFactory xwork这个名字已经被 由 bean 加载 - jar:文件:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/tuto-hello/WEB-INF/lib/struts2-core-2.0.11.2.jar!/struts-default.xml :30:72 - bean - jar:文件:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/tuto-hello/WEB-INF/lib/struts2-core-2.2.1.jar !/struts-default.xml:29:72 在 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193) ... 9 月 14 日还有 33 个2010 11:48:08 org.apache.catalina.core.ApplicationContext 日志信息:ContextListener: contextInitialized() 9 月 14 日2010年 11:48:08 org.apache.catalina.core.ApplicationContext 日志信息:会话监听器: 上下文初始化()

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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>fr.test</groupId>
  <artifactId>monTest</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>monTest Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
        <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-core</artifactId>
      <version>2.2.1</version>
    </dependency>   
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.13</version>
    </dependency>

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>3.3.2.GA</version>
    </dependency>              
  </dependencies>
  <profiles>
      <profile>
      <id>default-tools.jar</id>
      <activation>
        <property>
          <name>java.vendor</name>
          <value>Sun Microsystems Inc.</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.4.2</version>
          <scope>system</scope>
          <systemPath>C:\Program Files\Java\jdk1.6.0_21\lib\tools.jar</systemPath>
        </dependency>
      </dependencies>
    </profile>
    </profiles>
  <build>
    <finalName>monTest</finalName>
        <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>1.0</version>
             <configuration>
                <update>true</update>            
                <url>http://127.0.0.1:8080/manager/html</url>
                <username>root</username>
                <password>root</password>
             </configuration>
        </plugin>
    </plugins>
  </build>
</project>

when i deploy my war into TomCat i have this error:

14 sept. 2010 11:48:07
org.apache.catalina.core.StandardContext
filterStart GRAVE: Exception au
démarrage du filtre struts2 Unable to
load bean: type:
class:com.opensymphony.xwork2.ObjectFactory
- bean - jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/tuto-hello/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
at
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
at
org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at
org.apache.catalina.core.StandardService.start(StandardService.java:519)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at
org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source) at
java.lang.reflect.Method.invoke(Unknown
Source) at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Bean type class
com.opensymphony.xwork2.ObjectFactory
with the name xwork has already been
loaded by bean -
jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/tuto-hello/WEB-INF/lib/struts2-core-2.0.11.2.jar!/struts-default.xml:30:72 - bean - jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/tuto-hello/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193)
... 33 more 14 sept. 2010 11:48:08
org.apache.catalina.core.ApplicationContext
log INFO: ContextListener:
contextInitialized() 14 sept. 2010
11:48:08
org.apache.catalina.core.ApplicationContext
log INFO: SessionListener:
contextInitialized()

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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>fr.test</groupId>
  <artifactId>monTest</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>monTest Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
        <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-core</artifactId>
      <version>2.2.1</version>
    </dependency>   
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.13</version>
    </dependency>

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>3.3.2.GA</version>
    </dependency>              
  </dependencies>
  <profiles>
      <profile>
      <id>default-tools.jar</id>
      <activation>
        <property>
          <name>java.vendor</name>
          <value>Sun Microsystems Inc.</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.4.2</version>
          <scope>system</scope>
          <systemPath>C:\Program Files\Java\jdk1.6.0_21\lib\tools.jar</systemPath>
        </dependency>
      </dependencies>
    </profile>
    </profiles>
  <build>
    <finalName>monTest</finalName>
        <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>1.0</version>
             <configuration>
                <update>true</update>            
                <url>http://127.0.0.1:8080/manager/html</url>
                <username>root</username>
                <password>root</password>
             </configuration>
        </plugin>
    </plugins>
  </build>
</project>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桜花祭 2024-09-26 08:44:50

您的类路径上有多个版本的 struts2-core(struts2-core-2.0.11.2.jar 和 struts2-core-2.2.1.jar)。你需要做一些清理工作。显示完整的 pom.xml 以获得更多帮助。

You have several versions of struts2-core (struts2-core-2.0.11.2.jar and struts2-core-2.2.1.jar) on your classpath. You need to do some cleanup. Show your complete pom.xml for more help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文