You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by EJ Ciramella <ec...@archivas.com> on 2005/06/22 22:15:26 UTC
different classloader behavior
I've written a custom SQLCondition and use it to monitor a particular
field in a db. This condition needs the postgres.jar in the
classpath, so, on my local machine (an iMac), the target looks like
this:
<target name="testsql">
<path id="classpath">
<pathelement path="lib/postgresql.jar"/>
<pathelement location="classes"/>
</path>
<typedef name="sqlcondition"
classname="org.archivas.condition.SQLCondition"
classpathref="classpath"/>
<waitfor maxwait="25" maxwaitunit="minute" checkevery="10"
checkeveryunit="second" timeoutproperty="toolong">
<sqlcondition value="waiting for client connection"
connectionString="jdbc:postgresql://someurl/"
username="someuser"
password="somepass"
dbname="grind_web"
tablename="grinder_status"
hostname="lnx-072.archivas.com"/>
</waitfor>
</target>
This works just fine.
When I jar up my condition and place it in ant_home/lib, I made the
following changes to the test build server (a slackware linux box):
<path id="sqlclasspath">
<pathelement path="/usr/local/pgsql/share/java/postgresql.jar"/>
</path>
<typedef name="sqlcondition"
classname="org.archivas.condition.SQLCondition"
classpathref="sqlclasspath"/>
<waitfor maxwait="25" maxwaitunit="minute" checkevery="10"
checkeveryunit="second" timeoutproperty="toolong">
<sqlcondition value="waiting for client connection"
connectionString="jdbc:postgresql://someurl/"
username="someuser"
password="somepass"
dbname="grind_web"
tablename="grinder_status"
hostname="lnx-072.archivas.com"/>
</waitfor>
But this fails:
build-full:
[waitfor] java.lang.ClassNotFoundException: org.postgresql.Driver
[waitfor] at java.net.URLClassLoader.findClass
(URLClassLoader.java:375)
[waitfor] at java.lang.ClassLoader.loadClass(ClassLoader.java:
562)
[waitfor] at java.lang.ClassLoader.loadClass(ClassLoader.java:
494)
[waitfor] at java.lang.Class.forName1(Native Method)
[waitfor] at java.lang.Class.forName(Class.java:180)
[waitfor] at org.archivas.condition.SQLCondition.getConnection
(SQLCondition.java:142)
[waitfor] at org.archivas.condition.SQLCondition.getSelectValue
(SQLCondition.java:61)
[waitfor] at org.archivas.condition.SQLCondition.eval
(SQLCondition.java:52)
[waitfor] at org.apache.tools.ant.taskdefs.WaitFor.execute
(WaitFor.java:117)
[waitfor] at sun.reflect.NativeMethodAccessorImpl.invoke0
(Native Method)
[waitfor] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:85)
[waitfor] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
[waitfor] at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
[waitfor] at java.lang.reflect.Method.invoke(Method.java:391)
[waitfor] at org.apache.tools.ant.TaskAdapter.execute
(TaskAdapter.java:123)
[waitfor] at org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:275)
[waitfor] at org.apache.tools.ant.Task.perform(Task.java:364)
[waitfor] at org.apache.tools.ant.Target.execute(Target.java:341)
[waitfor] at org.apache.tools.ant.Target.performTasks
(Target.java:369)
[waitfor] at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1216)
[waitfor] at org.apache.tools.ant.Project.executeTarget
(Project.java:1185)
[waitfor] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:40)
[waitfor] at org.apache.tools.ant.Project.executeTargets
(Project.java:1068)
[waitfor] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[waitfor] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[waitfor] at org.apache.tools.ant.launch.Launcher.run
(Launcher.java:246)
[waitfor] at org.apache.tools.ant.launch.Launcher.main
(Launcher.java:67)
BUILD FAILED
/home/source/build-engineering-main.xml:65:
java.lang.NullPointerException
What am I doing wrong?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org