tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rolf Schumacher <mailingl...@august.de>
Subject calling ant launcher
Date Sat, 08 Apr 2006 18:51:38 GMT
Dear Tomcat professionals,

I tried to automate some installation over the Web
I got a class cast exception when trying to launch Ant from a servlet.
The program works fine if I execute it from the command line.
In a servlet under Tomcat it causes a

java.lang.ClassCastException: org.apache.tools.ant.Main
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:275)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:96)

I looked up line 275 in Launcher.java:

270        URLClassLoader loader = new URLClassLoader(jars);
271        Thread.currentThread().setContextClassLoader(loader);
272        Class mainClass = null;
273        try {
274             mainClass = loader.loadClass(MAIN_CLASS);
275            AntMain main = (AntMain) mainClass.newInstance();
276            main.startAnt(newArgs, null, null);

Do you have an idea why the loader does load something different
that usually can be casted to AntMain?

Any help appreaciated.

Rolf


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message