I'm developing a system that deploys the applications which is selected from GWT interface. I've wrote build.xml accordingly;

<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>

and call this target from 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");

When I call this process from test(main) class, I meant not from a web interface, it does the deployment process. But when I call this method from the web interface via RPC callback, I got this error.

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) 

I can't find where the problem is. Thanks for help.

有帮助吗?

解决方案

Try following.

<exec executable="D:/enlil/glassfish3/bin/asadmin" failonerror="true">
    <arg value="--passwordfile"/>
    <arg value="D:/stajyer/password.txt"/>
    <arg value="deploy"/>
    <arg value="--contextroot"/>
    <arg value="/GlassfishDeployment"/>
    <arg value="dist/MobilHis.war"/>
</exec>

Keep arguments in separate <arg/> elements.

This is probably because glassfish not being able to open up the command prompt.

其他提示

I figured out that in my project folder there are 2 build.xml files and my class references the other one, I don't know why I have two of them, but when I pasted my codes into other build.xml all problems have fixed up.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top