1

我在网上搜索了答案,但我发现的一切都没有帮助。问题是这样的:动态 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>
4

1 回答 1

1

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

于 2013-07-17T15:18:46.340 回答