Issue with proxy while running Ant script - java

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

Related

Project compilation requires a class that is not used anywhere

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

Using external libraries in Java

Here's the error I keep getting at runtime:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
Note, this is a runtime error, not a compile-time one. Both tasks in my build.xml have an identical classpath set, and the compile task runs fine every single time:
<path id="classpath">
<fileset dir="lib" includes="*.jar" />
</path>
<target name="compile">
<mkdir dir="build/classes"/>
<javac
srcdir="src"
classpathref="classpath"
includeantruntime="false"
destdir="build/classes"
/>
</target>
...
<target name="run" depends="clean,compile,jar">
<java
jar="build/jar/${project.name}.jar"
fork="true"
classpathref="classpath"
>
<sysproperty key="java.library.path" path="${path.lib}/windows"/>
</java>
</target>
Trying to run the jar via command-line manually yields the same result:
java -cp .:lib/*.jar -Djava.library.path=lib/windows -jar build/jar/JUtopia.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
Note that the library jarfile is ok:
bash-3.1$ jar -tf lib/lwjgl.jar | grep LWJGLException
org/lwjgl/LWJGLException.class
And the native libraries are in place:
bash-3.1$ ls lib/windows/lwjgl.dll
lib/windows/lwjgl.dll
The question: where the blazes have I gone wrong? I've been beating at this problem for nearly 3 days. Any help would be much appreciated.
Full result stack:
clean:
[delete] Deleting directory C:\Users\mkumpan\Projects\JUtopia\build
compile:
[mkdir] Created dir: C:\Users\mkumpan\Projects\JUtopia\build\classes
[javac] Compiling 12 source files to C:\Users\mkumpan\Projects\JUtopia\build\classes
jar:
[mkdir] Created dir: C:\Users\mkumpan\Projects\JUtopia\build\jar
[jar] Building jar: C:\Users\mkumpan\Projects\JUtopia\build\jar\JUtopia.jar
run:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
[java] at JUtopia.<init>(Unknown Source)
[java] at JUtopia.main(Unknown Source)
[java] Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[java] ... 2 more
P.S.: Note, I'm using Console2 with bash in a windows environment for my commandline work, thus the windows natives yet linux shell syntax. Using vanilla cmd to run the jar yields the same result.
-jar...
When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored. - reference
try setting the Class-Path in the JAR
Alternatively try running without the -Jar option, by specifying the main class on the command line
One of the possible causes is that while loading the class LWJGLException it also references another class which can't be found on the classpath. Hence the reported error is sometimes not clear.
Important here is thet you have this NoClassDefFoundError and not ClassNotFoundException which is the error you assume you are having: it cannot find the class LWHLException, yes it can ! But it cannot load it....

ant task with exec returning error 7

I am trying to build using an Ant task that uses exec. Here is a snippet of my task:
<exec executable="cmd" failonerror="true" osfamily="windows">
<arg value="/c" />
<arg value="${path.installer}" />
<arg value="-silent"/>
<arg value="-allowDownload"/>
<arg value="-eulaAccepted"/>
</exec>
This is essentially an installer. When I am trying to run the installer (.exe) from the path, I am getting the following error:
C:\Users\abc\jenkins\install.xml:57: exec returned: 7 (line 57 points to beginning of exec)
I ran ant with verbose option to get more details:
[antcall] Exiting C:\Users\abc\jenkins\install.xml.
[echo] Installing new build from C:\Users\abc\jenkins\BA\integration_win\Nuze.exe
[exec] Current OS is Windows 7
[exec] Executing 'cmd' with arguments:
[exec] '/c'
[exec] 'C:\Users\abc\jenkins\BA\integration_win\Nuze.exe
[exec] '-silent'
[exec] '-allowDownload'
[exec] '-eulaAccepted'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
target 'install.nuze' failed with message 'exec returned: 7'.
BUILD FAILED
C:\Users\abc\jenkins\install.xml57: exec returned: 7
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:646)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav: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(DefaultExeutor.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)
Also I can confirm that my Jenkins slave has access to C:\Users\abc\jenkins\BA\integration_win\Nuze.exe
and I can install manually from that location without any issues. Any idea on where I am erring? I looked up error codes, but generally the tip I got is that there could be some issue with ant configuration. Any pointers? Thanks a ton in advance for the help.
Doesn't look like a ANT issue. "7" is the return code of the program you're running. You need to consult the documentation of the "nuze" program you are running.
Non-zero error codes indicate to ANT that the program has failed and programmers often return different codes to indicate to the calling program what went wrong. Standard OS stuff.
I am not very knowledgeable on this subject but sense there are no other answers I figured I would give it a shot. From looking at similar problems maybe try re-phrasing your xml
<exec executable="cmd" failonerror="true" osfamily="windows">
<arg line="/c ${path.installer} -silent -allowDownload -eulaAccepted"/>
</exec>

Configure Apache Ant and Ivy on Windows 7

I'm been attempting to clone and build a project on my Windows 7 box, like so:
git clone git#github.com:corvec/project-name.git
cd project-name
git submodule init
git submodule update
ant clean
ant resolve
All of the commands up until ant resolve work as expected, which gives me the following error message:
Buildfile: c:\workspace\project-name\build.xml
clean-lib:
[delete] Deleting directory c:\workspace\project-name\lib
load-ivy:
resolve:
[echo] Storing dependencies in lib dir: lib
[mkdir] Created dir: c:\workspace\project-name\lib
[ivy:retrieve] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = c:\workspace\project-name\core-build\xml\ant\ivy\ivysettings.xml
BUILD FAILED
c:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml:55: impossible to configure
ivy:settings with given file: c:\workspace\project-name\core-build\xml\ant\ivy\ivysettings.xml
: java.text.ParseException: failed to load settings from file:/c:/workspace/project-name/core-build/xml/ant/ivy/ivysettings.xml: io problem while parsing config file: unknown protocol: c
at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:165)
at org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:150)
at org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:384)
at org.apache.ivy.Ivy.configure(Ivy.java:411)
at org.apache.ivy.ant.IvyAntSettings.createIvyEngine(IvyAntSettings.java:272)
at org.apache.ivy.ant.IvyAntSettings.getConfiguredIvyInstance(IvyAntSettings.java:237)
at org.apache.ivy.ant.IvyTask.getIvyInstance(IvyTask.java:92)
at org.apache.ivy.ant.IvyTask.prepareTask(IvyTask.java:256)
at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:276)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
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: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)
Caused by: java.net.MalformedURLException: unknown protocol: c
at org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:234)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:277)
at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160)
... 24 more
Caused by: java.net.MalformedURLException: unknown protocol: c
at java.net.URL.<init>(URL.java:574)
at java.net.URL.<init>(URL.java:464)
at org.apache.ivy.core.settings.XmlSettingsParser.includeStarted(XmlSettingsParser.java:409)
at org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:211)
... 38 more
Total time: 0 seconds
EDIT: With the verbose flag applied, I now get the following message:
Apache Ant(TM) version 1.9.0 compiled on March 5 2013
Trying the default build file: build.xml
Buildfile: C:\workspace\project-name\build.xml
Detected Java version: 1.6 in: c:\Program Files\Java\jdk1.6.0_25\jre
Detected OS: Windows 7
parsing buildfile C:\workspace\project-name\build.xml with URI = file:/C:/workspace/project-name/build.xml
Project base dir set to: C:\workspace\project-name
parsing buildfile jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
[property] Loading C:\workspace\project-name\build.properties
Importing file C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml from C:\workspace\project-name\build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-basic-targets.xml
Already defined in main or a previous import, ignore build-tests
Already defined in main or a previous import, ignore dist-war
Already defined in main or a previous import, ignore all
Already defined in main or a previous import, ignore console
Importing file C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml from
C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-ant-contrib-targets.xml
Overriding previous definition of reference to ant.projectHelper
Importing file C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml from C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-ivy-targets.xml
Importing file C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml from
C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml
Skipped already imported file:
C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml
Importing file C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml from C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml
Skipped already imported file:
C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml
[property] Loading C:\workspace\project-name\placeholder.build.properties
[property] Unable to find property file: C:\workspace\project-name\placeholder.build.properties
[property] Loading C:\workspace\project-name\core-build\xml\ant\ivy\ivysettings.properties
Property "ivy.basedir" has not been set
Property "ivy.basedir" has not been set
Override ignored for property "shared.base"
Override ignored for property "shared.lib"
Overriding previous definition of reference to ant.projectHelper
[property] Loading C:\workspace\project-name\placeholder.build.properties
[property] Unable to find property file: C:\workspace\project-name\placeholder.build.properties
Override ignored for property "conf.web.dir"
Override ignored for property "jdk.lib"
Importing file C:\workspace\project-name\core-build\xml\ant\build-testing-targets.xml from C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-testing-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-testing-targets.xml
[macrodef] creating macro do-testing
[macrodef] creating macro test-one-class
[macrodef] creating macro test-classes
Overriding previous definition of reference to ant.projectHelper
Overriding previous definition of reference to ant.projectHelper
Importing file C:\workspace\project-name\core-build\xml\ant\build-eclipse-classpath.xml from C:\workspace\project-name\build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-eclipse-classpath.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-eclipse-classpath.xml
[property] Loading C:\workspace\project-name\placeholder.build.properties
[property] Unable to find property file: C:\workspace\project-name\placeholder.build.properties
Overriding previous definition of reference to ant.projectHelper
Importing file C:\workspace\project-name\core-build\xml\ant\build-findBugs-targets.xml from C:\workspace\project-name\build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-findBugs-targets.xml with
URI = file:/C:/workspace/project-name/core-build/xml/ant/build-findBugs-targets.xml
Override ignored for property "shared.lib"
Overriding previous definition of reference to ant.projectHelper
Importing file C:\workspace\project-name\core-build\xml\ant\build-pmd-targets.xml from C:\workspace\project-name\build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-pmd-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-pmd-targets.xml
Override ignored for property "shared.lib"
Overriding previous definition of reference to ant.projectHelper
Overriding previous definition of reference to lib.jars
Build sequence for target(s) `resolve' is [clean-lib, load-ivy, resolve]
Complete build sequence is [clean-lib, load-ivy, resolve, build, build-tests, -missing-test-param, project-name.run-one-test-plain, project-name.run-tests-xml, project-name.clean, check-findbugs-filters, runFindBugsFiltered, runFindBugsUnfiltered, project-name.runFindBugs, eclipse-classpath, dist, dist-war, project-name.run-one-test-html, pmd.pmd-html, report, runFindBugsFiltered-html, runFindBugsUnfiltered-html, runFindBugs-html, project-name.dist, project-name.dist-onejar, project-name.eclipse-classpath-with-conf, project-name.clean-cache, instrument-classes, run-tests, report-tests, report-coverage, ivy-version, publish-nodeps,
publish, project-name.publish-nodeps, project-name.run-tests, cpd, run-tests-html, cpd-html, pmd, pmd-all, project-name.ivy-local-version, project-name.create-javadoc, run-one-test-html, project-name.publish, project-name.runFindBugsFiltered-html, resolve-all, run-master-testsuites, clean-local, pmd-html, pmd.pmd-all-html, ivy-local-version, project-name.clean-all-local, runFindBugs, console, pmd.pmd-all, run-one-test-plain, clean-all-local, project-name.resolve_delivered, project-name.report, project-name.load-ivy, project-name.runFindBugs-html, project-name.clean-lib, project-name.post-resolve-echo, project-name.dist-war, project-name.ivy-version, pmd.cpd-html, project-name.ivy-new-version, dist-jar, ivy-new-version, resolve_delivered, project-name.runFindBugsFiltered, project-name.copy-dependencies, project-name.publish-local-nodeps, post-resolve-echo, dist-onejar, clean-cache, project-name.run-tests-plain, create-javadoc, project-name.build, run-test, project-name.all, run-tests-plain, pmd.cpd, test, copy-dependencies, publish-local-nodeps, publish-local, project-name.pom, project-name.report-coverage-xml, report-coverage-xml, project-name.console, project-name.report-tests, project-name.test, project-name.instrument-classes, pmd.pmd, clean, project-name.publish-local, copy-dist, run-jar, dist-reports, project-name.build-tests, project-name.copy-dist, project-name.run-one-test, project-name.dist-reports, project-name.check-findbugs-filters, project-name.-missing-test-param, run-one-test-xml, run-one-test, report-master-testsuites,
project-name.runFindBugsUnfiltered-html, project-name.resolve, build-dep, project-name.dist-jar, project-name.runFindBugsUnfiltered, all, project-name.report-master-testsuites, project-name.build-dep, project-name.resolve-all, project-name.clean-local, pom, project-name.run-tests-html, eclipse-classpath-with-conf, project-name.run-master-testsuites, run-tests-xml, project-name.eclipse-classpath, project-name.run-test, project-name.run-jar, pmd-all-html, project-name.report-coverage, project-name.run-one-test-xml, ]
clean-lib:
load-ivy:
[taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found.
[antlib:org.apache.ivy.ant] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found.
BUILD FAILED
C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml:24: Problem: failed to create task or type antlib:org.apache.ivy.ant:settings
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-c:\apache-ant-1.9.0\lib
-C:\Users\localuser\.ant\lib
-a directory added on the command line with the -lib argument
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:487)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:419)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
at org.apache.tools.ant.Task.perform(Task.java:347)
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)
Total time: 0 seconds
I doubt this is an issue with the configuration specific to the project; I'm not the only developer on this project and the other developers have it working. More likely, it is something related to my system's configuration. They are running Linux and Mac OS, if that makes a difference. I suppose it could potentially be related to some files that are not being tracked by git, but I would think that one of the other developers would have noticed that.
I have tried updating the file paths in build.properties to use an absolute path rather than a relative one, as follows (based on this recommendation):
shared.base=file:///c:/workspace/project-name/core-build
instead of
shared.base=core-build
When I do that, I get the following error message:
Apache Ant(TM) version 1.9.0 compiled on March 5 2013
Trying the default build file: build.xml
Buildfile: C:\workspace\project-name\build.xml
Detected Java version: 1.6 in: c:\Program Files\Java\jdk1.6.0_25\jre
Detected OS: Windows 7
parsing buildfile C:\workspace\project-name\build.xml with URI = file:/C:/workspace/project-name/build.xml
Project base dir set to: C:\workspace\project-name
parsing buildfile jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
[property] Loading C:\workspace\project-name\build.properties
Importing file C:\workspace\project-name\file:\C:\workspace\project-name\project-name\core-build\xml\ant\build-basic-targets.xml from C:\workspace\project-name\build.xml
BUILD FAILED
C:\workspace\project-name\build.xml:5: Cannot find C:\workspace\project-name\file:\C:\workspace\project-name\project-name\core-build\xml\ant\build-basic-targets.xml imported from C:\workspace\project-name\build.xml
at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:181)
at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:162)
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:435)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82)
at org.apache.tools.ant.Main.runBuild(Main.java:826)
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)
Total time: 0 seconds
To that end, here are some relevant details from my system:
PATH = %AMDAPPSDKROOT%bin\x86_64;%AMDAPPSDKROOT%bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%MAVEN%;%SBT_HOME%;%IRONRUBY_11%;%JAVA_HOME%\bin;%GRAILS_HOME%\bin;%GROOVY_HOME%\bin;%SUBVERSION%\bin;%GIT%\cmd;C:\Utilities;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;%ANT_HOME%\bin
echo %PATH% = c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apache-maven-3.0.4\bin;C:\Program Files (x86)\sbt\;C:\Program Files (x86)\IronRuby 1.1\bin;C:\Program Files\Java\jdk1.6.0_25\bin;C:\Grails\grails-2.1.0\bin;C:\Program Files (x86)\Groovy\Groovy-2.1.1\bin;C:\Program Files (x86)\Subversion\bin;C:\Program Files (x86)\Git\cmd;C:\Utilities;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\apache-ant-1.9.0\bin;C:\Program Files (x86)\vim\vim73;C:\Ruby193\bin;C:\Python27
%ANT_HOME% = C:\apache-ant-1.9.0
%JAVA_HOME% = C:\Program Files\Java\jdk1.6.0_25
javac -version = 1.6.0_25
I have also attempted to use a new version of Ivy, ivy-2.3.0, but I encounter similar errors.
I think this section is the ivy resolve target:
<target name="resolve" depends="clean-lib, load-ivy" description="--> resolve and retrieve dependencies with ivy">
<echo message="Storing dependencies in lib dir: ${lib.dir}" />
<mkdir dir="lib"/>
<ivy:retrieve />
<ivy:deliver deliverpattern="ivy_delivered.xml" />
</target>
Paths
I've included relevant excerpts of the paths in the build.properties and other related files below:
// build.xml
<property file="build.properties" />
// build.properties
shared.base=core-build
shared.xml=${shared.base}/xml
// build-ivy-targets.xml (imported into build.xml)
<property name="ivy.settings.dir" value="${shared.xml}/ant/ivy" />
Ivy Configuration
<!-- build-ivy-targets.xml (stripped down quite a bit): -->
<project basedir="." default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<import file="build-ant-contrib-targets.xml" />
<import file="build-basic-targets.xml" />
<property file="placeholder.build.properties" />
<property name="ivy.settings.dir" value="${shared.xml}/ant/ivy" />
<property file="${ivy.settings.dir}/ivysettings.properties" />
<path id="ivy.lib.path">
<fileset dir="${shared.lib}">
<include name="ant-extensions/ivy*.jar" />
</fileset>
</path>
<path id="lib.jars">
<fileset id="lib.jars.fileset" dir="lib" erroronmissingdir="false">
<include name="*.jar" />
</fileset>
</path>
<!-- `ivy:settings file` is only set here: -->
<target name="load-ivy">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
<ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
</target>
<target name="resolve" depends="clean-lib, load-ivy" description="--> resolve and retrieve dependencies with ivy">
<echo message="Storing dependencies in lib dir: ${lib.dir}" />
<mkdir dir="lib"/>
<ivy:retrieve />
<ivy:deliver deliverpattern="ivy_delivered.xml" />
</target>
<target name="clean-lib" description="--> clean the project libraries directory (dependencies)">
<delete includeemptydirs="true" dir="${lib.dir}" />
</target>
</project>
I've figured out that the Apache Ivy error message means that somewhere it is failing to parse a directory and is instead reading it as a URL. What steps should I take to fix this?
Ivy on Windows needs the ivy-settings variable to be set differently than on Linux.
Change the line <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" /> to:
<ivy:settings url="file:/C://workspace//project-name//core-build//xml//ant//ivy//ivysettings.xml" />
It's important to note that two things change:
Rather than setting ivy.settings.file, you are setting ivy.settings.url
You are setting an absolute path rather than a relative one.
The problem is that ant is trying to resolve an import from a relative path rather than an absolute location. See this line in your error?
Cannot find C:\workspace\project-name\file:\C:\workspace\project-name\project-name\core-build\xml\ant\build-basic-targets.xml imported from C:\workspace\project-name\build.xml
Make the path to the imported file be a path relative to the build.xml's directory, like "project-name/core-build/xml/ant/basic-build-targets.xml", and your import statement look something like this:
<import file="${basedir}/${shared.base}"/>

JDO3.0 enhance failure in GAE 1.7.2

I use ant to build my GAE WebApp. This is the datanucleus target:
<target name="datanucleusenhance" depends="compile"
description="Performs enhancement on compiled data classes.">
<enhance_war war="war">
</enhance_war>
</target>
This is the error I got:
org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL
"file:/home/xxxx/.eclipse/org.eclipse.platform_4.2.0_1473617060/plugins/com.google.appengine.eclipse.sdkbundle_1.7.2/appengine-java-sdk-1.7.2/lib/opt/tools/datanucleus/v1/datanucleus-core-1.1.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/war/WEB-INF/lib/datanucleus-core-3.1.0-m5.jar."
I've tried this ant target:
<target name="datanucleusenhance" depends="compile" description="Performs enhancement on compiled data classes.">
<enhance_war war="war">
<args>
<arg value="-enhancerVersion" />
<arg value="v3.1.0" />
</args>
</enhance_war>
</target>
I've tried to delete "datanucleus-core-1.1.5.jar". The error then is:
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
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.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.NoClassDefFoundError: org/datanucleus/OMFContext
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:150)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.datanucleus.OMFContext
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at com.google.appengine.tools.enhancer.EnhancerLoader.loadClass(EnhancerLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 10 more
How can I use JDO3.0 with GAE1.7.2?
Using the GAE plugin for Intellij, I had to remove the default configured orm directory, and specifically add the higher version libraries.
The GAE SDK is organized as such:
/lib/user/orm (default persistence libraries I removed)
AND
/lib/opt/user/datanucleus/v2
To access this configuration in IntelliJ, from the context menu for my project:
{context menu} -> Open Module Settings -> Libraries -> AppEngine ORM
Use the [-] button to remove the jars within this directory: /lib/user/orm
Use the [+] button to add the jars within this directory: /lib/opt/user/datanucleus/v2
Got the answer. The correct ant target should be:
<target name="datanucleusenhance" depends="compile" description="Performs enhancement on compiled data classes.">
<enhance_war war="war">
<args>
<arg value="-enhancerVersion" />
<arg value="v2" />
</args>
</enhance_war>
</target>
the version is the GAE JDO/JPA plugin version.(Thanks DataNucleus!:)
You seem to be confusing which versions of dependent jars to use. GAE 1.7.2 uses GAE JDO/JPA plugin v2.x, which in turn needs DataNucleus 3.x. You evidently have (various) DataNucleus 1.x jars present.

Categories