从 Ant 启动/停止 Tomcat - NoClassDefFoundError
我正在尝试从 Ant 启动/停止 tomcat。这是用于停止的 xml 文件的相关部分:
<target name="stop" depends="readProperties" >
<exec executable="/home/local/WorkEnvironment/apache-tomcat-7.0.14/bin/">
<arg value="shutdown.sh"/>
</exec>
</target>
这给出了以下异常:
/home/local/workspace/Eclipse/Main/tomcat.xml:26: Execute failed: java.io.IOException: java.io.IOException: Permission denied
at java.lang.PosixProcess.<init>(libgcj.so.11)
at java.lang.Runtime.execInternal(libgcj.so.11)
at java.lang.Runtime.exec(libgcj.so.11)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.11)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: Permission denied
at java.lang.PosixProcess.nativeSpawn(libgcj.so.11)
at java.lang.PosixProcess.spawn(libgcj.so.11)
at java.lang.PosixProcess$ProcessManager.run(libgcj.so.11)
看到这一点,我尝试了以下操作:
<target name="stop" depends="readProperties" >
<echo message="${tomcat.path.home}"/>
<java jar="${tomcat.path.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.path.home}"/>
<arg line="stop"></arg>
</java>
</target>
这告诉我:
stop:
[echo] /home/local/WorkEnvironment/apache-tomcat-7.0.14
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.juli.logging.LogFactory
[java] at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:60)
[java] at java.lang.Class.initializeClass(libgcj.so.11)
[java] Java Result: 1
我检查了 tomcat-juli.jar 及其存在于 tomcat_home/bin 和 tomcat_home 中/lib。它还具有 ant 所说缺失的类。出了什么问题?我发现有时 Manifest.MF 文件可能会产生误导,但是,我无法弄清楚该文件到底出了什么问题:(。
I am trying to start/stop tomcat from Ant. Here is my relevant portion of the xml file for stopping :
<target name="stop" depends="readProperties" >
<exec executable="/home/local/WorkEnvironment/apache-tomcat-7.0.14/bin/">
<arg value="shutdown.sh"/>
</exec>
</target>
This gives the following exception :
/home/local/workspace/Eclipse/Main/tomcat.xml:26: Execute failed: java.io.IOException: java.io.IOException: Permission denied
at java.lang.PosixProcess.<init>(libgcj.so.11)
at java.lang.Runtime.execInternal(libgcj.so.11)
at java.lang.Runtime.exec(libgcj.so.11)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.11)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: Permission denied
at java.lang.PosixProcess.nativeSpawn(libgcj.so.11)
at java.lang.PosixProcess.spawn(libgcj.so.11)
at java.lang.PosixProcess$ProcessManager.run(libgcj.so.11)
Seeing this, I tried the following :
<target name="stop" depends="readProperties" >
<echo message="${tomcat.path.home}"/>
<java jar="${tomcat.path.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.path.home}"/>
<arg line="stop"></arg>
</java>
</target>
This tells me that :
stop:
[echo] /home/local/WorkEnvironment/apache-tomcat-7.0.14
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.juli.logging.LogFactory
[java] at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:60)
[java] at java.lang.Class.initializeClass(libgcj.so.11)
[java] Java Result: 1
I checked for tomcat-juli.jar and its present in tomcat_home/bin and also in tomcat_home/lib. It also has the class which ant says is missing. What is going wrong ? I saw that sometimes the Manifest.MF file can mislead, but, I could not make out what exactly could be wrong with that file :( .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可执行文件不应该包含“shutdown.sh”吗? (不是作为参数关闭,而是作为可执行路径的一部分)。
像这样的东西:
Shouldn't executable include "shutdown.sh"? (not shutdown as an arg, but as part of the executable path).
Something like: