windows – 为什么我不能关闭从maven插件嵌入的tomcat 7?
发布时间:2020-12-14 01:57:02 所属栏目:Windows 来源:网络整理
导读:我正在使用tomcat7-maven-plugin 2.2从命令行运行webapp(我在 Windows 8.1,Java 1.7.0_51和Maven 3.2.1上). 这是配置(非常简单,我猜): plugin groupIdorg.apache.tomcat.maven/groupId artifactIdtomcat7-maven-plugin/artifactId version2.2/version confi
我正在使用tomcat7-maven-plugin 2.2从命令行运行webapp(我在
Windows 8.1,Java 1.7.0_51和Maven 3.2.1上).
这是配置(非常简单,我猜): <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <address>localhost</address> <port>8080</port> <path>/</path> <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin> 我使用mvn tomcat7运行Maven:运行并且它正确启动,服务器启动,webapp加载,我可以与它进行交互. [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building <project-name-here> 0.3 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) @ <project-name-here> >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ <project-name-here> --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 25 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ <project-name-here> --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) @ <project-name-here> <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ <project-name-here> --- [INFO] Running war on http://localhost:8080/ [INFO] Using existing Tomcat server configuration at c:workspace&;project-name-here>targettomcat [INFO] create webapp with contextPath: apr 01,2014 10:39:50 AM org.apache.coyote.AbstractProtocol init Informazioni: Initializing ProtocolHandler ["http-bio-127.0.0.1-8080"] apr 01,2014 10:39:50 AM org.apache.catalina.core.StandardService startInternal Informazioni: Starting service Tomcat apr 01,2014 10:39:50 AM org.apache.catalina.core.StandardEngine startInternal Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.47 apr 01,2014 10:39:52 AM org.apache.coyote.AbstractProtocol start Informazioni: Starting ProtocolHandler ["http-bio-127.0.0.1-8080"] 然后,我想关闭服务器:我从单独的命令提示符运行mvn tomcat7:shutdown,但我得到的是: [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building <project-name-here> 0.3 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- tomcat7-maven-plugin:2.2:shutdown (default-cli) @ <project-name-here> --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.083 s [INFO] Finished at: 2014-04-01T10:39:59+01:00 [INFO] Final Memory: 9M/154M [INFO] ------------------------------------------------------------------------ "cmd" non è riconosciuto come comando interno o esterno,un programma eseguibile o un file batch. 最后一行写道:
我可以阻止Tomcat从第一个命令提示符击中Ctrl C,但由于我需要传递所有这些,我想给他们一个脚本来启动webapp和一个脚本来阻止它. 怎么了?这是一个插件错误吗?这是我的配置错误吗? 编辑 如果我添加< fork> true< / fork>到POM,服务器崩溃时出现此错误: [...] Informazioni: Starting service Tomcat apr 03,2014 2:05:29 PM org.apache.catalina.core.StandardEngine startInternal Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.47 apr 03,2014 2:05:31 PM org.apache.coyote.AbstractProtocol start Informazioni: Starting ProtocolHandler ["http-bio-127.0.0.1-8080"] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.711 s [INFO] Finished at: 2014-04-03T14:05:31+01:00 [INFO] Final Memory: 26M/368M [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:606) 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 解决方法
据我所知,你需要在使用mvn tomcat7启动Tomcat服务器后使用Ctrl c:运行以关闭它,因为它连接到当前的Maven运行.
关闭目标用于在例如之后调用.执行一些测试(集成测试)以干净的方式完成所有工作. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Windows10:Opencv4.0+Opencv4.0.1_contrib编译
- FindFirstChangeNotification是Windows上用于文件系统更改通
- active-directory – Windows bginfo显示A.D到期日期?
- windows – 没有运行Small Business Server的原因是什么?
- ASP木马Webshell安全解决方案
- windows-phone-7 – 如何使用Expression Blend在页面加载时
- 实测win10 efi启动及centos7双系统引导顺序修改
- windows-server-2008 – 在没有guest虚拟机运行时,添加Hype
- Windows – 如何在Team Foundation Server(TFS)中重命名项目
- GCP - Running Windows Server Failover Clustering Step b
推荐文章
站长推荐
热点阅读