我正在开发一个系统来部署从 GWT 接口中选择的应用程序。我已经相应地编写了 build.xml;
<target
name="deploywar"
description="Varolan WAR dosyasını yayınlar." >
<echo level="info" >
Proje sunucuda yayinlaniyor...
</echo>
<exec
executable="cmd"
failonerror="true" >
<arg value="/c" />
<arg value="D:/enlil/glassfish3/bin/asadmin --passwordfile D:/stajyer/password.txt deploy --contextroot /GlassfishDeployment dist/MobilHis.war" />
</exec>
</target>
并从 Java 调用此目标;
buildfile = new java.io.File("build.xml");
p = new Project();
p.setUserProperty("ant.file", buildfile.getAbsolutePath());
p.init();
helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildfile);
p.executeTarget("deploywar");
当我从 test(main) 类调用这个过程时,我的意思不是从 Web 界面,它执行部署过程。但是当我通过 RPC 回调从 web 界面调用这个方法时,我得到了这个错误。
exec returned: 1
D:\stajyer\Glassfish Deployment\war\build.xml:83: exec returned: 1
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:591)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:617)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:452)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at com.enlil.source.server.RunAntXmlFile.deployWar(RunAntXmlFile.java:58)
at com.enlil.source.server.FTPProcessImpl.deployFiles(FTPProcessImpl.java:120)
at com.enlil.source.server.FTPProcessImpl.updateFiles(FTPProcessImpl.java:350)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
我找不到问题出在哪里。感谢帮助。