tomcat 7 embedded没有正确关闭ClassNotFoundException ContainerBase $ StopChild

 同步管理精英 发布于 2023-02-08 16:59

我正在尝试使用此配置与Tomcat7嵌入式插件进行工作集成测试:

            
                org.apache.tomcat.maven
                tomcat7-maven-plugin
                2.2
                
                    29360
                    
                        ${project.build.testOutputDirectory}/logback-test.xml
                        ${project.build.testOutputDirectory}
                        test-e2e
                    
                
                
                    
                        org.slf4j
                        slf4j-api
                        ${slf4j.version}
                    
                    
                        ch.qos.logback
                        logback-classic
                        ${logback.version}
                    
                
                
                    
                        run-tomcat
                        pre-integration-test
                        
                            run-war-only
                        
                        
                            true
                        
                    
                    
                        stop-tomcat
                        post-integration-test
                        
                            shutdown
                        
                    
                
            

但是当关闭发生时,我一直有这个错误:引起:java.lang.ClassNotFoundException:org.apache.catalina.core.ContainerBase $ StopChild

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:49.618s
[INFO] Finished at: Sun Dec 22 07:58:06 CET 2013
[INFO] Final Memory: 163M/259M
[INFO] ------------------------------------------------------------------------

ERROR: IllegalAccessException for stop method in class org.apache.tomcat.maven.plugin.tomcat7.run.ExtendedTomcat
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.tomcat.maven.common.run.EmbeddedRegistry.shutdownAll(EmbeddedRegistry.java:110)
    at org.apache.tomcat.maven.common.run.EmbeddedRegistry$1.run(EmbeddedRegistry.java:69)
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardServer[-1]]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
    at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:351)
    ... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardService[Tomcat]]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
    at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:753)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    ... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat]]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
    at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:502)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    ... 9 more
Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/core/ContainerBase$StopChild
    at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:1173)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.core.ContainerBase$StopChild
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    ... 13 more

Process finished with exit code 0

有任何改进的提示吗?

1 个回答
  • 如果运行mvn integration-test,它将不会运行集成后测试阶段,这可能导致此错误.请改用mvn verify.

    2023-02-08 17:01 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有