When I build with ant my project that uses libgdx, I get a strange error. It says that a class com.google.gwt.dom.client.ImageElement is not found, but it isn't used at all in the code. How can I find what makes this class necessary? Even searching over the whole project doesn't give any results. It says that error is at PixmapTextureAtlas.java:16 (class source), but there is no code that uses that ImageElement class. Adding the library containing com.google.gwt.dom.client.ImageElement class helps, of course, but I'd like to figure out why this class in needed.
Here is the place in ant log that tells of the actual error:
Compiling 3 source files to /home/suseika/Projects/tendiwa/client/bin
/home/suseika/Projects/tendiwa/client/src/org/tendiwa/client/PixmapTextureAtlas.java:16: error: cannot access ImageElement
class file for com.google.gwt.dom.client.ImageElement not found
Here is the whole ant log:
/usr/lib/jvm/java-7-oracle/bin/java -Xmx128m -Xss2m -Dant.home=/opt/intellijidea/lib/ant -Dant.library.dir=/opt/intellijidea/lib/ant/lib -Dfile.encoding=UTF-8 -classpath /opt/intellijidea/lib/ant/lib/ant-apache-regexp.jar:/opt/intellijidea/lib/ant/lib/ant-swing.jar:/opt/intellijidea/lib/ant/lib/ant-apache-xalan2.jar:/opt/intellijidea/lib/ant/lib/ant-jdepend.jar:/opt/intellijidea/lib/ant/lib/ant-apache-resolver.jar:/opt/intellijidea/lib/ant/lib/ant-jsch.jar:/opt/intellijidea/lib/ant/lib/ant.jar:/opt/intellijidea/lib/ant/lib/ant-testutil.jar:/opt/intellijidea/lib/ant/lib/ant-launcher.jar:/opt/intellijidea/lib/ant/lib/ant-apache-bsf.jar:/opt/intellijidea/lib/ant/lib/ant-commons-logging.jar:/opt/intellijidea/lib/ant/lib/ant-netrexx.jar:/opt/intellijidea/lib/ant/lib/ant-junit.jar:/opt/intellijidea/lib/ant/lib/ant-commons-net.jar:/opt/intellijidea/lib/ant/lib/ant-apache-bcel.jar:/opt/intellijidea/lib/ant/lib/ant-antlr.jar:/opt/intellijidea/lib/ant/lib/ant-apache-log4j.jar:/opt/intellijidea/lib/ant/lib/ant-jai.jar:/opt/intellijidea/lib/ant/lib/ant-apache-oro.jar:/opt/intellijidea/lib/ant/lib/ant-jmf.jar:/opt/intellijidea/lib/ant/lib/ant-javamail.jar:/usr/lib/jvm/java-7-oracle/lib/tools.jar:/opt/intellijidea/lib/idea_rt.jar com.intellij.rt.ant.execution.AntMain2 -logger com.intellij.rt.ant.execution.IdeaAntLogger2 -inputhandler com.intellij.rt.ant.execution.IdeaInputHandler -buildfile /home/suseika/Projects/tendiwa/client/build.xml jar
build.xml
property
path
description
compile
ant
property
property
property
description
compile
mkdir
javac
jar
ant
property
description
_core_src_available
available
ontology
antcall
property
description
_core_src_available
available
_build_core
ant
property
property
compile
echo
/home/suseika/Projects/tendiwa/client
mkdir
javac
jar
jar
Building jar: /home/suseika/Projects/tendiwa/MainModule.jar
description
tempfile
mkdir
Created dir: /tmp/tendiwa373148820
unjar
Expanding: /home/suseika/Projects/tendiwa/MainModule.jar into /tmp/tendiwa373148820
Expanding: /home/suseika/Projects/tendiwa/tendiwa-backend.jar into /tmp/tendiwa373148820
Expanding: /home/suseika/Projects/tendiwa/tendiwa-ontology.jar into /tmp/tendiwa373148820
copy
Copying 1 file to /tmp/tendiwa373148820
java
Created item short_sword
Created item short_bow
Created item bucket
Created item boot
Created item steel_morningstar
Created item rifle_ammo
Created item handAxe
Created item iron_armor
Created item steel_mace
Created item jacket
Created item fedora
Created item wooden_arrow
Saving sources to /tmp/tendiwa373148820/ontology/src
tendiwa/resources/SoundTypes.java
tendiwa/resources/CharacterTypes.java
tendiwa/resources/ObjectTypes.java
tendiwa/resources/FloorTypes.java
tendiwa/resources/ItemTypes.java
tendiwa/resources/MaterialTypes.java
mkdir
mkdir
mkdir
Created dir: /tmp/tendiwa373148820/ontology/bin
javac
jar
Building jar: /home/suseika/Projects/tendiwa/tendiwa-ontology.jar
echo
Resources source code generated
ant
property
property
compile
echo
/home/suseika/Projects/tendiwa/client
mkdir
javac
jar
jar
jar
Building jar: /home/suseika/Projects/tendiwa/MainModule.jar
mkdir
javac
/home/suseika/Projects/tendiwa/client/build.xml:25: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1150)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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.Main.start(Main.java:180)
at org.apache.tools.ant.Main.main(Main.java:268)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
/home/suseika/Projects/tendiwa/client/build.xml (25:46)'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 3 source files to /home/suseika/Projects/tendiwa/client/bin
/home/suseika/Projects/tendiwa/client/src/org/tendiwa/client/PixmapTextureAtlas.java:16: error: cannot access ImageElement
class file for com.google.gwt.dom.client.ImageElement not found
1 error
/home/suseika/Projects/tendiwa/client/build.xml:25: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1150)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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.Main.start(Main.java:180)
at org.apache.tools.ant.Main.main(Main.java:268)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
/home/suseika/Projects/tendiwa/client/build.xml:25: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1150)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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.Main.start(Main.java:180)
at org.apache.tools.ant.Main.main(Main.java:268)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
Ant build completed with 3 errors one warning in 4s at 10/30/13 3:09 AM
Here is a part of ant file where this error appears:
<path id="tendiwa.jars">
<fileset dir="../libs">
<include name="**/*.jar"/>
</fileset>
<pathelement path="../tendiwa-backend.jar"/>
<pathelement path="../tendiwa-ontology.jar"/>
<!--<fileset dir="/usr/share/java" includes="gwt*.jar"/>-->
</path>
<target name="compile">
<ant dir="../MainModule" target="jar"/>
<mkdir dir="bin"/>
<javac destdir="bin" failonerror="true">
<classpath>
<path refid="tendiwa.jars"/>
<!--temporary-->
<pathelement path="../tendiwa-ontology.jar"/>
<!--temporary-->
<pathelement path="../MainModule.jar"/>
<fileset dir="../libs" includes="**/*.jar"/>
</classpath>
<src>
<pathelement path="Desktop/src"/>
<pathelement path="src"/>
</src>
</javac>
</target>
A given library may have dependencies that it does not provide, so your code needs it indirectly. PixmapTextureAtlas.java:16 does reference this class, and you use PixmapTextureAtlas, therefore you indirectly need com.google.gwt.dom.client.ImageElement.
A tool like Maven can add dependencies/subdependencies and manage them easily.
I found out why that was happening. I accidentally added to classpath two different jars where are two different variants of class com.badlogic.gdx.graphics.Pixmap, one having dependency on GWT, and another being the one I needed. The problem was that I didn't know such situation is possible : )
Related
I have a Java project that builds with Maven but has a build.xml with its only task to run maven to copy files. I can't change this project's design but have to get it running in my Intellij IDE. I'm using the bundled Maven and Ant versions. Maven runs fine and compiles the jars, the ant job does not.
<project name="projectAppUploader" default="devbuild">
<target name="devbuild">
<exec executable="mvn">
<arg value="package"/>
</exec>
<copy file="module-gui/target/appUploader-GUI.jar" todir="/foo/bar/GUI/"/>
<copy file="module-main/target/appUploader.jar" todir="/foo/bar/app"/>
</target>
When I run this as an Ant target I get an error:
/home/alex/dev/projectAppUploader/build.xml:3: Execute failed: java.io.IOException: Cannot run program "mvn" (in directory "/home/alex/dev/projectAppUploader/"): error=2, No such file or directory
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:673)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:497)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
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:834)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.Main.start(Main.java:190)
at org.apache.tools.ant.Main.main(Main.java:274)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:31)
Caused by: java.io.IOException: Cannot run program "mvn" (in directory "/home/alex/dev/projectAppUploader/"): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at java.base/java.lang.Runtime.exec(Runtime.java:592)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:424)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:438)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:630)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
... 23 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 30 more
Ant build completed with 3 errors and no warnings in 0s at 16.04.21, 21:42
Credit goes to dariosiciliy. Ant does not know the path to the executable of the intellij's mvn program. if I add it (or if I install maven on the system and put it into the path variable), it works.
I am building this project https://github.com/oracle/visualvm . I have JDK10 in my system. I changed the source and target option in build xml to 1.8 from 1.5, as there were error saying 1.5 is not supported anymore. Now, I am getting a compile error pointing to common.xml which is in some other sub-folder.
I have no idea, what is wrong as the error log is also very vague. Also, I am working with Ant for the first time.
Here is the log.
C:\dev\jvisualvm\visualvm\visualvm\netbeans\harness\suite.xml:163: The following error occurred while executing this line:
C:\dev\jvisualvm\visualvm\visualvm\netbeans\harness\common.xml:200: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1425)
at org.netbeans.nbbuild.CustomJavac.compile(CustomJavac.java:102)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1133)
at org.netbeans.nbbuild.CustomJavac.execute(CustomJavac.java:83)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:306)
at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:225)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
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:834)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
The part of common.xml where the error is thrown looks like this. (nb-javac srcdir tag)
<target name="compile" depends="init,up-to-date" unless="is.jar.uptodate">
<mkdir dir="${build.classes.dir}"/>
<depend srcdir="${src.dir}" destdir="${build.classes.dir}" cache="${build.dir}/depcache">
<classpath refid="cp"/>
</depend>
<property name="javac.fork" value="false"/>
<nb-javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" encoding="UTF-8"
deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="1.8" target="1.8" includeantruntime="false"
fork="false">
<classpath refid="cp"/>
<compilerarg line="${javac.compilerargs}"/>
<processorpath refid="processor.cp"/>
</nb-javac>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${jar-excludes}"/>
</copy>
<processjsannotation classes="${build.classes.dir}" asm="${asm.jar}">
<classpath refid="cp"/>
</processjsannotation>
</target>
Can anyone point me to some direction to resolve this?
You need to build VisualVM with JDK 8. https://github.com/oracle/visualvm clearly mentions it in Get the tools section.
I am new to StackExchange so please bear with my eventual mistakes...
I have been searching for answers but none seem to apply to my situation being that that build and deployment actually works, but the result is though an IOException at the end of the deployment call.
I am making a build an deployment script in ant. The deployment part is using this taskdef:
<taskdef name="tomcatdeploy" classname="org.apache.catalina.ant.DeployTask" />
<target name="-tomcatdeploy" description="deploy to tomcat">
<echo>deploying from client</echo>
<tomcatdeploy
url="http://32.0.26.146:8080/manager/text"
username="<veryHardToGuessUsername>"
password="<veryHardToGuessPassword>"
path="/avlsweb"
war="/mnt/s/Web/Avlsweb/BambooBuilds/TEST/${nt-server.dir.test}_Tc${version}/avlsweb##${version}.war"
version="${version}"
/>
We use Bamboo as build server. This worked fine for a number of builds. However recently I got this build error:
/mnt/data/bamboo_home/xml-data/build-dir/AVTST-TEST15-JOB1/AvlswebScripts/Ant/build.xml:286: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3192)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3175)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:242)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:195)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
The strange thing is that the build works and it also deploys fine to tomcat. However, for some reason an IOException occurs after the deployment resulting in a "red" failed build message in Bamboo. A couple of additional remarks:
Tomcat manager-script user is setup
Bamboo build server with ant is running on the same server as the targeting tomcat applicationserver however bamboo and the targeting tomcat are running as separate servers on separate ports.
Build server: Atlassian Bamboo 5.9.0
Ant version: 1.9.2
Tomcat version: 8.0.15
Java version: 1.7.0_67
Any ideas?
i think i am slow, i have faced same problem
in tomcatdeploy task instead of war make it localWar
You will get this error if you already have an instance deployed to the Tomcat server. You can set update="true" in the tomcatdeploy:
<tomcatdeploy
url="http://32.0.26.146:8080/manager/text"
username="<veryHardToGuessUsername>"
password="<veryHardToGuessPassword>"
path="/avlsweb"
war="/mnt/s/Web/Avlsweb/BambooBuilds/TEST/${nt-server.dir.test}_Tc${version}/avlsweb##${version}.war"
version="${version}"
update="true"
/>
Another option is to explicitly undeploy and then redeploy, or use the reload tag instead of the deploy tag.
I have a webapp in progress, i constantly need to redeploy it
I noticed that if i just deploy over the old files, it sometimes does not get updated
I went on looking for an undeployment task for me to use in my deploy script
the deploy script is working just fine, if the server is freshly started, and if its not freshly started, it sometimes doesnt overwrite the old files.
the undeploy task doesnt work at all
this is my undeploy script
<target name="undeploy" depends="clean" description="Remove application in Tomcat">
<undeploy url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="/${webapp.name}"/>
</target>
and the exception i get - for some reason it turns the "/" of the context path to "%2F" and this is why i get file not found exception, how can i fix it ?
C:\Dev\webworkspace\ElectronicArenaLenasProject\build.xml:76: java.io.FileNotFou
ndException: http://localhost:8080/manager/undeploy?path=%2FElectronicArenaLe
nasProject
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1613)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalina
Task.java:230)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalina
Task.java:150)
at org.apache.catalina.ant.UndeployTask.execute(UndeployTask.java:44)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
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(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
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)
I guess tomcat is not running. Or the manager URL (that is ${tomcat.manager.url}) is not configured correctly in your build.xml
See the error message:
java.io.FileNotFoundException: http://localhost:8080/manager/undeploy?path=%2FElectronicArenaLenasProject
I'm developing an Ant script for my project purposes and figured out that my proxy causes problem for me. Here is the simplest example from Apache documentation of 'copy' task:
=================== build.xml =====================
<project default="simplestCopy">
<property name="test.dir" value="${basedir}/test/" />
<target name="simplestCopy">
<mkdir dir="${test.dir}" />
<copy todir="${test.dir}" flatten="true">
<resources>
<url url="http://ant.apache.org/index.html"/>
</resources>
</copy>
</target>
</project>
I've got next error:
d:\temp>ant
Buildfile: d:\temp\build.xml
simplestCopy:
java.net.ConnectException: Connection refused: connect
BUILD FAILED
d:\temp\build.xml:7: Warning: Could not find resource url "http://ant.apache.org/index.html" to copy.
I've tried to set kind of
<property name="java.net.useSystemProxies" value="true" />
And define this property in command line
d:\temp>ant -Djava.net.useSystemProxies=true -verbose
But got same error:
d:\temp>ant -Djava.net.useSystemProxies=true -verbose
Apache Ant version 1.8.1 compiled on April 30 2010
Trying the default build file: build.xml
Buildfile: d:\temp\build.xml
Detected Java version: 1.6 in: c:\ProgramFiles\Java\jdk1.6.0_24\jre
Detected OS: Windows XP
parsing buildfile d:\temp\build.xml with URI = file:/d:/temp/build.xml
Project base dir set to: d:\temp
parsing buildfile jar:file:/C:/ProgramFiles/Java/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/ProgramFiles/Java/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Build sequence for target(s) `simplestCopy' is [simplestCopy]
Complete build sequence is [simplestCopy, ]
simplestCopy:
[mkdir] Skipping d:\temp\test because it already exists.
java.net.ConnectException: Connection refused: connect
BUILD FAILED
d:\temp\build.xml:7: Warning: Could not find resource url "http://ant.apache.org/index.html" to copy.
at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:487)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
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 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:1397)
at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
at org.apache.tools.ant.Main.runBuild(Main.java:801)
at org.apache.tools.ant.Main.startAnt(Main.java:218)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 1 second
Any ideas how to fix?
Thanks for help...
Use the setproxy task: http://ant.apache.org/manual/Tasks/setproxy.html
I started the tomcat server and then issue the command and it works