Bug 30611 - java.lang.InstantiationException - starting ANT
Summary: java.lang.InstantiationException - starting ANT
Status: RESOLVED INVALID
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.6.2
Hardware: Sun Solaris
: P3 major (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-12 01:54 UTC by Tarang
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tarang 2004-08-12 01:54:31 UTC
setenv PATH
/usr/people/cip/local/apache/apache-ant-1.6.2/bin:/usr/local/j2sdk1.4.2_04/bin:/usr/people/cip/bea81/weblogic81/server/bin:/usr/local/j2sdk1.4.2_04/jre/bin:/usr/local/j2sdk1.4.2_04/bin:/usr/cip/Database/mysql/bin:/usr/cip/Database/mysql/bin:/opt/ssh/bin:/sbin:/usr/bin:/usr/sbin:/etc:/usr/openwin/bin:/usr/local/bin:/usr/local/teTeX/bin:/usr/apps/bin:/usr/WorkShop/bin:/usr/ccs/bin:/usr/ucb:/usr/apps/purify/releases/purify-5.2-solaris2:/usr/local/X11/bin:/usr/people/ccs/bin/solaris:/usr/people/ccs/bin/solaris
java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
ant -buildfile ./build.xml -logfile ./../buildlogs/build.2004.08.11.18.30.15.log
java.lang.InstantiationException: org.apache.tools.ant.Main
        at java.lang.Class.newInstance0(Class.java:293)
        at java.lang.Class.newInstance(Class.java:261)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:195)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

 Whats up with this ?
Comment 1 Steve Loughran 2004-08-12 08:55:52 UTC
Wierd. 

"Thrown when an application tries to use the Java new construct to instantiate
an abstract class or an interface.

Normally, this error is caught by the compiler; this error can only occur at run
time if the definition of a class has incompatibly changed. "

This is a linkage error of some form or other. I would hypothesise that
somewhere on your classpath you have an old copy of ant.jar, an incompatible
copy of ant.sh, or the like

1. what is CLASSPATH?

2. set the env variable ant_exec_debug , run ant and see whats get printed. 
Comment 2 Conor MacNeill 2004-08-12 14:35:59 UTC
Yes this is odd.

I've added some code to print out the root cause of the InstantiationException,
which will be useful in general. I can build a version for you to try if you are
keen to see what the root cause is.
Comment 3 peter reilly 2004-08-12 14:48:20 UTC
It is not that odd.
If one has an old ant.jar in the CLASSPATH, (in this case
most likely within the weblogic jar file), one gets this
exact exception for example:
> ant -version
Apache Ant version 1.7alpha compiled on August 12 2004
> CLASSPATH=~/apps/apache-ant-1.5.4/lib/ant.jar ant -version
java.lang.InstantiationException: org.apache.tools.ant.Main
        at java.lang.Class.newInstance0(Class.java:335)
        at java.lang.Class.newInstance(Class.java:303)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:195)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
>
Comment 4 Tarang 2004-08-13 00:18:28 UTC
The problem occurs with having "weblogic.jar" in the classpath. This does have
the weblogic ANT tasks in the packaging, but does not have the ANT classes as
found in an "ant.jar" file.

 However when I add the ANT 1.6 jar file (repackaged with "Class-path" defined
in the MANIFEST.MF to include the 31 other ant optional jar files) ahead in the
classpath as follows:

setenv CLASSPATH ${ANT_HOME}/lib/ant.jar:${CLASSPATH}

 I see the following :

${ANT_HOME}/bin/ant -h
/usr/people/cip/local/apache/apache-ant-1.6.2/bin/ant [script options] [options]
[target [target2 [target3] ..]]
Script Options:
  --help, --h            print this message and ant help
  --noconfig             suppress sourcing of /etc/ant.conf,
                         $HOME/.ant/ant.conf, and $HOME/.antrc
                         configuration files
  --usejikes             enable use of jikes by default, unless
                         set explicitly in configuration files
  --execdebug            print ant exec line generated by this
                         launch script
  
Invalid implementation version between Ant core and Ant optional tasks.
 core    : 1.6.2
 optional: 1.5


 I'm not clear how I really ensure that what was once the "optional.jar"
Comment 5 Tarang 2004-08-13 00:18:55 UTC
The problem occurs with having "weblogic.jar" in the classpath. This does have
the weblogic ANT tasks in the packaging, but does not have the ANT classes as
found in an "ant.jar" file.

 However when I add the ANT 1.6 jar file (repackaged with "Class-path" defined
in the MANIFEST.MF to include the 31 other ant optional jar files) ahead in the
classpath as follows:

setenv CLASSPATH ${ANT_HOME}/lib/ant.jar:${CLASSPATH}

 I see the following :

${ANT_HOME}/bin/ant -h
/usr/people/cip/local/apache/apache-ant-1.6.2/bin/ant [script options] [options]
[target [target2 [target3] ..]]
Script Options:
  --help, --h            print this message and ant help
  --noconfig             suppress sourcing of /etc/ant.conf,
                         $HOME/.ant/ant.conf, and $HOME/.antrc
                         configuration files
  --usejikes             enable use of jikes by default, unless
                         set explicitly in configuration files
  --execdebug            print ant exec line generated by this
                         launch script
  
Invalid implementation version between Ant core and Ant optional tasks.
 core    : 1.6.2
 optional: 1.5


 I'm not clear how I really ensure that what was once the "optional.jar"
Comment 6 Peter Reilly 2004-09-08 10:38:28 UTC
Removing this as you are trying to set up your
own env.


You could try to remove the ant classes from weblogic.jar.