You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Antoine Levy-Lambert <le...@tiscali-dsl.de> on 2003/05/22 13:33:29 UTC

class loading problems/class.forName()

I have the following problem :
Environment : JDK 1.4, Win2000
I am developing some custom ant tasks, which are using MQ Series for Java.
The custom ant tasks use fscontext.jar and providerutil.jar, two JNDI jar files supplied by Sun.
I have to put these two jar files in my classpath before starting ant, otherwise my build fails.
set CLASSPATH=%MQ_JAVA_INSTALL_PATH%\lib\fscontext.jar;%MQ_JAVA_INSTALL_PATH%\lib\providerutil.jar
Classes contained in these two jar files are almost certainly instantiated in a class of jndi.jar with a call of Class.forName()
Is there a workaround to avoid having to set the classpath manually ? I do not have problems with other classes which are not loaded via Class.forName.
I have found these two bug reports which are maybe related to what I experience :
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17576
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6606

Would scripting calls to AntClassLoader#forceLoadClass in my build script solve the problem ? If yes, does someone have an example of how to do it ? Or would a workaround be to run the java task beforehand, giving it as main class the jndi driver name for instance ?

Antoine