Running Ant via Servlet

Discussion in 'Java' started by Brett Morgan, Jul 18, 2003.

  1. Brett Morgan

    Brett Morgan Guest

    I've created a servlet that reads an ant build file and displays the
    ant targets on a webpage. When you click on one of the targets it is
    executed. I added a BuildListener to the ant project object, so I
    could output build status to webpage. I'm using an anonymous inner
    class for the BuildListener. For each method in the inner class I
    want to write out information to the PrintWriter. I only way I could
    get the PrintWriter in the inner class was to declare it as final in
    the Servlet. This works for the first request, but the servlet dies
    after that. I think the problem is caused by making the PrintWriter
    final. Does anyone know how I can write out to the webpage from within
    a Listener?
     
    Brett Morgan, Jul 18, 2003
    #1
    1. Advertising

  2. Brett Morgan

    Brett Morgan Guest

    Carfield Yim <> wrote in message news:<bfac0o$cni15$-berlin.de>...
    > Brett Morgan wrote:
    > > I've created a servlet that reads an ant build file and displays the
    > > ant targets on a webpage. When you click on one of the targets it is
    > > executed. I added a BuildListener to the ant project object, so I
    > > could output build status to webpage. I'm using an anonymous inner
    > > class for the BuildListener. For each method in the inner class I
    > > want to write out information to the PrintWriter. I only way I could
    > > get the PrintWriter in the inner class was to declare it as final in
    > > the Servlet. This works for the first request, but the servlet dies
    > > after that. I think the problem is caused by making the PrintWriter
    > > final. Does anyone know how I can write out to the webpage from within
    > > a Listener?

    >
    > Any stack trace?
    > --
    > \\\|///
    > \\- - -//
    > ( @ @ )
    > -----------oOOo-(_)-oOOo------------------------------------------------
    > Visit my homepage at http://www.carfield.com.hk
    >
    > Email: carfield(at)carfield(dot)com(dot)hk
    > ------------------------------------------------------------------------



    Here is the stack trace.

    Listener attempted to access System.out - infinite loop terminated
    at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:2009)
    at org.apache.tools.ant.Project.fireMessageLogged(Project.java:2034)
    at org.apache.tools.ant.Project.log(Project.java:389)
    at org.apache.tools.ant.Project.topoSort(Project.java:1674)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1332)
    at com.technoetic.xplanner.servlets.AntRunner.doGet(AntRunner.java:76)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:536)
     
    Brett Morgan, Jul 23, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nara Bala
    Replies:
    2
    Views:
    362
    John C. Bollinger
    Aug 14, 2003
  2. circuit_breaker
    Replies:
    2
    Views:
    2,060
    Jack Jia
    Apr 4, 2004
  3. NullBock

    Problem running CVS via Ant

    NullBock, Aug 5, 2004, in forum: Java
    Replies:
    1
    Views:
    522
    Greg Larkin
    Aug 5, 2004
  4. Baddn Raj
    Replies:
    0
    Views:
    396
    Baddn Raj
    Oct 1, 2004
  5. Replies:
    4
    Views:
    825
Loading...

Share This Page