Maven war - 无法启动组件[StandardEngine [Catalina] .StandardHost [localhost] .StandardContext [/]构建maven战争

时间:2013-07-12 10:14:30

标签: java maven tomcat7

我在网上搜索了答案,但我发现的一切都没有帮助。问题是:动态Web项目已经转换为maven项目,并将其部署到tomcat7工作得很好,但是在从同一项目构建war文件并尝试运行相同之后,我得到了一个org.apache .catalina.LifecycleException。我相信我的所有依赖都已到位,因此我不认为这是maven的问题,而是maven编译器。此外,虽然eclipse在同一个项目中建立战争,但在tomcat上运行得很好,但是通过maven构建,却没有。这是堆栈跟踪:

`Jul 12, 2013 11:39:27 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.6.0_43\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;D:\install\apache-maven-3.0.5\bin;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;D:\install\apache-ant-1.9.1-bin\apache-ant-1.9.1\bin;C:\Program Files (x86)\Java\jdk1.6.0_43\bin;c:\Program Files (x86)\Java\jdk1.6.0_43\bin;D:\install\eclipse-jee-juno-SR2-win32\eclipse;;.
Jul 12, 2013 11:39:27 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jul 12, 2013 11:39:27 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jul 12, 2013 11:39:27 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 295 ms
Jul 12, 2013 11:39:27 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 12, 2013 11:39:27 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
Jul 12, 2013 11:39:27 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive D:\install\apache-tomcat-7.0.40\webapps\RQM-WEB-MVN-0.0.1-SNAPSHOT.war
Jul 12, 2013 11:39:36 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RQM-WEB-MVN-0.0.1-SNAPSHOT]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1654)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: LLog;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2300)
    at java.lang.Class.getDeclaredFields(Class.java:1745)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: Log
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 25 more
Jul 12, 2013 11:39:36 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive D:\install\apache-tomcat-7.0.40\webapps\RQM-WEB-MVN-0.0.1-SNAPSHOT.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RQM-WEB-MVN-0.0.1-SNAPSHOT]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1654)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
Jul 12, 2013 11:39:36 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\install\apache-tomcat-7.0.40\webapps\host-manager
Jul 12, 2013 11:39:36 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\install\apache-tomcat-7.0.40\webapps\manager
Jul 12, 2013 11:39:36 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\install\apache-tomcat-7.0.40\webapps\ROOT
Jul 12, 2013 11:39:36 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 12, 2013 11:39:36 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jul 12, 2013 11:39:36 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8855 ms
`

pom.xml退出很大,它不适合,因此无法发布,但我真的相信所有依赖都已到位......帮助将不胜感激!

这些是我的插件:

        <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <packagingExcludes>WEB-INF/lib/maven*.jar</packagingExcludes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.4.2</version>
            <configuration>
                <skipTests>true</skipTests>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.1</version>
        </plugin>
    </plugins>

1 个答案:

答案 0 :(得分:1)

几天后,终于找到了问题所在。我认为这可能会帮助其他类似问题。在构建.war文件(通过m2e-wtp或者控制台mvn包)之后,maven编译器从src / main / webapp / WEB-INF / classes文件夹中取出java类而不是目标文件夹(target / projectName / WEB) -INF / classes),从而报告导入错误,导致将.war文件部署到tomcat时出错。因此,只需从WEB-INF文件夹中删除classes文件夹,maven就会处理它。