• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Occuring problem during interacting with the Tomcat server throught ant

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Ranchers,

I am trying to interact with the Tomcat server throught ant, it works for me
for the list command, but I can't start or stop the server.

I am using the following target invocation:

<target name = "start"
description = "Start Tomcat application"
>
<start
url = "http://localhost:8080/manager"
username = "admin"
password = "tomcat"
path = "/springapp"
/>
</target>

I have installed jdk 1.6_02 and also java runtime 1.6 for Tomcat 5.5.


If I execute after staring the server manually the list task it works, but
start and stop commands don't work.

1. Do I have to use jdk 1.6 with Tomcat 5.5? During the Tomcat installation
I have selected a 1.5 runtime version.

2. Do I have to use a previous version of tomcat?

3. Is there any way to say during the ant execution that it should invoke
the tomcat tasks assuming another runtime versions?



After running this target on verbose mode I get the following output:

==================================================================
Detected Java version: 1.4 in: C:\Java\j2sdk\jre
Detected OS: Windows 2000
parsing buildfile P:\springapp\build.xml with URI =
file:///P:/springapp/build.xml
Project base dir set to: P:\springapp
Importing file properties.xml from P:\springapp\build.xml
parsing buildfile P:\springapp\properties.xml with URI =
file:///P:/springapp/properties.xml
[property] Loading C:\Documents and
Settings\UF367151\springapp_build.properties
Property ${user.properties.file} has not been set
[property] Loading P:\springapp\${user.properties.file}
[property] Unable to find property file:
P:\springapp\${user.properties.file}
[property] Loading P:\springapp\build.properties
Override ignored for property junit.printsummary
Override ignored for property junit.fork
Override ignored for property junit.showoutput
Override ignored for property junit.haltonfailure
Override ignored for property junit.formatter.type
Override ignored for property junit.formatter.usefile
Importing file taskdef.xml from P:\springapp\build.xml
parsing buildfile P:\springapp\taskdef.xml with URI =
file:///P:/springapp/taskdef.xml
[property] Loading P:\springapp\messages.properties
Build sequence for target `start' is [start]
Complete build sequence is [start, undeploy, load-data, compile, build,
deploy, drop-tables, show-properties, junit-do, print-properties, install,
stop, reload, clean, usage, help, init, list, clear-data, print-data, junit,
create-tables, deploywar, ]
start:
BUILD FAILED
P:\springapp\build.xml:236: java.net.ConnectException: Connection refused:
connect
at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.ja
va:261)
at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.ja
va:145)
at org.apache.catalina.ant.StartTask.execute(StartTask.java:71)
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.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.j
ava:521)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:4
98)
at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.ja
va:202)
... 12 more
--- Nested Exception ---
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.j
ava:521)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:4
98)
at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.ja
va:202)
at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.ja
va:145)
at org.apache.catalina.ant.StartTask.execute(StartTask.java:71)
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.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Total time: 5 seconds
====================================================================

Thanks,

Brijesh
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume you've followed the instructions here?.
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brijesh, looks like ANT tries to connect Tomcat before Tomcat is started.

By the way you post looks exactly like this one http://marc.info/?l=ant-user&m=111209847918951&w=2 but dated almost four year back.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic