You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Chris Stillwell <Ch...@wcom.com> on 2001/03/08 19:46:19 UTC

NullPointerException

Anybody have any suggestions as to where to look for this problem?
I am in the process of trying to install Ant 1.3 on an AIX box.
This is the result of trying to run it the first time using a simple build
file that just echos some messages.

Buildfile: build.xml
 [property] Error in class org.apache.tools.ant.taskdefs.Property

BUILD FAILED

/home/databus/build.xml:15: java.lang.reflect.InvocationTargetException
--- Nested Exception ---
java.lang.reflect.InvocationTargetException: java.lang.NullPointerException
--- Nested Exception ---
java.lang.NullPointerException
        at
org.apache.tools.ant.taskdefs.Property.addProperty(Property.java:276)
        at org.apache.tools.ant.taskdefs.Property.execute(Property.java:165)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:82)
        at
org.apache.tools.ant.ProjectHelper$TaskHandler.finished(ProjectHelper
.java:482)
        at
org.apache.tools.ant.ProjectHelper$AbstractHandler.endElement(Project
Helper.java:204)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java:1415)
        at com.sun.xml.parser.Parser.content(Parser.java:1499)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java:1400)
        at com.sun.xml.parser.Parser.parseInternal(Parser.java:492)
        at com.sun.xml.parser.Parser.parse(Parser.java:284)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:155)
        at org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:117)
        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
a:85)
        at org.apache.tools.ant.Main.runBuild(Main.java:403)
        at org.apache.tools.ant.Main.main(Main.java:149)

Total time: 2 seconds


RE: Resolved: NullPointerException & Problems running on AIX

Posted by Chris Stillwell <Ch...@wcom.com>.
Its not that the bootstrap script is wrong so much as IBM in their infinite
wisdom seem to have a non-standard setup for the Java install.  This causes
problems with things in the script like:

if [ ! -x "$JAVA_HOME/bin/java" ] ; then
  echo "Error: JAVA_HOME is not defined correctly."
  echo "  We cannot execute JAVA_HOME/bin/java"
  exit
fi

because that's not where java is executed from, its in
${JAVA_HOME}/jre/sh/java

So I commented out the above check and set JAVA=${JAVA_HOME}/jre/sh/java and
then modified any occurrences of ${JAVA_HOME}/bin/java with just ${JAVA}.
Similarly javac is not in ${JAVA_HOME}/bin/javac but rather
${JAVA_HOME}/sh/javac so I had to set the JAVAC environment variable
appropriately.

Chris

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: Wednesday, March 14, 2001 1:48 AM
To: ant-user@jakarta.apache.org
Subject: Re: Resolved: NullPointerException & Problems running on AIX


Chris Stillwell <Ch...@wcom.com> wrote:

> All of the problems I was experiencing with Ant 1.3 on our AIX box
> have gone away

great!

> after hacking the bootstrap build script to run on our AIX box,

Has the bootstrap script been wrong? If so, I'd like to see a copy of
yours to make the distributed version work out of the box.

Stefan


Re: Resolved: NullPointerException & Problems running on AIX

Posted by Stefan Bodewig <bo...@apache.org>.
Chris Stillwell <Ch...@wcom.com> wrote:

> All of the problems I was experiencing with Ant 1.3 on our AIX box
> have gone away

great!

> after hacking the bootstrap build script to run on our AIX box,

Has the bootstrap script been wrong? If so, I'd like to see a copy of
yours to make the distributed version work out of the box.

Stefan

Resolved: NullPointerException & Problems running on AIX

Posted by Chris Stillwell <Ch...@wcom.com>.
All of the problems I was experiencing with Ant 1.3 on our AIX box have gone
away after hacking the bootstrap build script to run on our AIX box, and
rebuilding Ant from the source distribution. Hmmmm, let's see now, that's
"Write once run ... "

Chris Stillwell



Re: NullPointerException

Posted by Nico Seessle <ni...@apache.org>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Friday, March 09, 2001 4:16 PM
Subject: Re: NullPointerException


> I think Diane and Nico have access to AIX boxes, I currently have not.

Generally yes, but unfortunately it has only JDK 1.1.6 on it. I tried to
download JDK 1.2.2 from IBM and install it but it requires a bunch of
prerequisites I really don't like to install on it. I tried it with JDK
1.1.6 and it seems to work.

Nico



Re: NullPointerException

Posted by Diane Holt <ho...@yahoo.com>.
--- Stefan Bodewig <bo...@apache.org> wrote:
> Stefan Bodewig <bo...@apache.org> wrote:
> 
> > Chris Stillwell <Ch...@wcom.com> wrote:
> > 
> >> I am only seeing this problem on AIX.  I was able to "get around"
> >> this error by setting the CLASSPATH in the ant script to include
> >> the rt.jar as such: CLASSPATH=/usr/java_dev2/jre/lib/rt.jar
> 
> What does java -version tell you? Are you running the java executable
> you want to run?

That's my suspicion as well. Try setting $JAVACMD to the full-path of your
java executable (eg., export JAVACMD=/usr/java_dev2/bin/java).

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

RE: NullPointerException

Posted by Chris Stillwell <Ch...@wcom.com>.
Here is the java -version output:

java -version
java version "1.2.2"
Classic VM (J2RE 1.2.2 IBM build ca122-19991217 (JIT enabled: jitc))

I also have these environment variables set in .profile

PATH=/usr/java_dev2/jre/sh:/usr/java_dev2/sh:/usr/bin:/etc:/usr/sbin:/usr/uc
b:$HOME/bin:/usr/bin/X11:/sbin:/usr/ant/bin:.
JAVA_HOME=/usr/java_dev2
export JAVA_HOME
JAVACMD=$JAVA_HOME/jre/sh/java
export JAVACMD
ANT_HOME=/usr/ant
export ANT_HOME

Chris



Re: NullPointerException

Posted by Stefan Bodewig <bo...@apache.org>.
Stefan Bodewig <bo...@apache.org> wrote:

> Chris Stillwell <Ch...@wcom.com> wrote:
> 
>> I am only seeing this problem on AIX.  I was able to "get around"
>> this error by setting the CLASSPATH in the ant script to include
>> the rt.jar as such: CLASSPATH=/usr/java_dev2/jre/lib/rt.jar
> 
> Should happen automatically, when you set JAVA_HOME to
> /usr/java_dev2/

Nonsense, sorry. 

rt.jar will be in your CLASSPATH anyway (well, not in the environment
variable, but the VM will use it automatically) on any JDK >= 1.2.

What does java -version tell you? Are you running the java executable
you want to run?

Stefan

Re: NullPointerException

Posted by Stefan Bodewig <bo...@apache.org>.
Chris Stillwell <Ch...@wcom.com> wrote:

> I am only seeing this problem on AIX.  I was able to "get around"
> this error by setting the CLASSPATH in the ant script to include the
> rt.jar as such: CLASSPATH=/usr/java_dev2/jre/lib/rt.jar

Should happen automatically, when you set JAVA_HOME to /usr/java_dev2/

> I get different errors after doing this.

I've seen them - and am as puzzled as Glenn is.

> However, I would expect a ClassNotFoundException and not a
> NullPointerException with a missing jar.

I couldn't agree more.

> Currently we use a big hairy makefile, but I would like to convert
> to Ant as it has some features we want to take advantage of.

I think Diane and Nico have access to AIX boxes, I currently have not.
But I have pinged a friend who _maybe_ could provide me with one - I'm
afraid this won't happen before next week, sorry.

Stefan

Re: Problem with includesfile in jar task.

Posted by Stefan Bodewig <bo...@apache.org>.
Chris Stillwell <Ch...@wcom.com> wrote:

> I noticed that if a filename within the file specified by the
> includesfile attribute contains any trailing blanks, then the file
> is not included in the jar and no errors are indicated.  I can
> easily fix my file, but I would think that whichever method is
> reading in these file patterns would do a trim to truncate trailing
> blanks.

Why? This would make it impossible to include a file whose name ends
in a blank - I agree it would be silly to name a file like this, but
Ant shouldn't assume that nobody does silly things.

> I would also like to know if it is possible to have the jar task
> fail if a file is not found and can't be loaded.

No. The only required piece would be the manifest file - and even this
doesn't work as expected, see KC Baltz's report from a few days ago.

The only option I see is to check for these files with an available
task and couple it to a fail task.

Stefan

Problem with includesfile in jar task.

Posted by Chris Stillwell <Ch...@wcom.com>.
I noticed that if a filename within the file specified by the includesfile
attribute contains any trailing blanks, then the file is not included in the
jar and no errors are indicated.  I can easily fix my file, but I would
think that whichever method is reading in these file patterns would do a
trim to truncate trailing blanks.

I would also like to know if it is possible to have the jar task fail if a
file is not found and can't be loaded.  The whenempty attribute should fail
when the entire jar is empty, but what about when the jar is missing some
required piece(s).

Chris Stillwell


RE: rmic and stubversion=1.2

Posted by Chris Stillwell <Ch...@wcom.com>.
Thanks, with using -verbose I was able to figure it out.  The class I'm
running rmic on is an inner class, so it is really out in the directory as
ngn.databus.admin.JiniFinder$MyEventListener not
ngn.databus.admin.JiniFinder.MyEventListener even though programmatically it
is referred to in its dot separated form.  I just changed my target as
follows an it seems to work:
  <target name="rmic" depends="prepare" description="rmic">
    <rmic classname="ngn.databus.admin.JiniFinder$$MyEventListener"
          base="${classes}"
	  classpath="${dest}:${jini_libs}"
	  stubversion="1.2"/>
  </target>

Chris


-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: Wednesday, March 14, 2001 9:55 AM
To: ant-user@jakarta.apache.org
Subject: Re: rmic and stubversion=1.2


Chris Stillwell <Ch...@wcom.com> wrote:

> Yes, that's what I'm saying.

Could you please run ant -verbose? It should say something like

XYZ.class added as XYZ_Stub.class doesn't exist.

or

XYZ.class added as XYZ_Stub.class is outdated.

And it should not be talking about _Skel files with stubversion="1.2".

Stefan


Re: rmic and stubversion=1.2

Posted by Stefan Bodewig <bo...@apache.org>.
Chris Stillwell <Ch...@wcom.com> wrote:

> Yes, that's what I'm saying.

Could you please run ant -verbose? It should say something like

XYZ.class added as XYZ_Stub.class doesn't exist.

or

XYZ.class added as XYZ_Stub.class is outdated.

And it should not be talking about _Skel files with stubversion="1.2".

Stefan

RE: rmic and stubversion=1.2

Posted by Chris Stillwell <Ch...@wcom.com>.
From: Stefan Bodewig [mailto:bodewig@apache.org]
>Chris Stillwell <Ch...@wcom.com> wrote:
>
>> I am seeing that rmic is always compiling the stub even when the
>> class file has not changed.
>
>This is supposed to be fixed in Ant 1.3. Are you saying it isn't?
Yes, that's what I'm saying.  I verified it this morning. Here is the target
I'm using:

  <target name="rmic" depends="prepare" description="rmic">
    <rmic classname="ngn.databus.admin.JiniFinder.MyEventListener"
          base="${classes}"
	  classpath="${dest}:${jini_libs}"
	  stubversion="1.2"/>
  </target>
I even removed the depends on a compile step to ensure the class doesn't get
recompiled.
Here is the output of the build:
D:\Projects\DatabusPrototype>ant -f admin-jar.xml rmic
Buildfile: admin-jar.xml

prepare:

rmic:
     [rmic] RMI Compiling 1 class to D:\Projects\DatabusPrototype\classes

BUILD SUCCESSFUL

Total time: 2 seconds

At this point the stub file is a day newer than the class file, but it
recompiles the stub every time.  Here's the output of the -version command
just to be sure I'm running 1.3.
D:\Projects\DatabusPrototype>ant -version
Ant version 1.3 compiled on March 2 2001


Chris Stillwell


Re: rmic and stubversion=1.2

Posted by Stefan Bodewig <bo...@apache.org>.
Chris Stillwell <Ch...@wcom.com> wrote:

> I am seeing that rmic is always compiling the stub even when the
> class file has not changed.

This is supposed to be fixed in Ant 1.3. Are you saying it isn't?

Stefan

rmic and stubversion=1.2

Posted by Chris Stillwell <Ch...@wcom.com>.
I am seeing that rmic is always compiling the stub even when the class file
has not changed.  Searching the archives I saw a reference to a problem when
using stubversion=1.2.  This reference was back in December.  Is this still
an outstanding bug or was the fix dropped in 1.3?  See:
http://marc.theaimsgroup.com/?l=ant-user&m=97594370705928&w=2


Thanks,

Chris Stillwell


RE: NullPointerException

Posted by Chris Stillwell <Ch...@wcom.com>.
Below is the test build.xml I am using to verify installation of Ant.  I am
only seeing this problem on AIX.  I was able to "get around" this error by
setting the CLASSPATH in the ant script to include the rt.jar as such:
CLASSPATH=/usr/java_dev2/jre/lib/rt.jar
I get different errors after doing this. See the email "Problems running on
AIX" on this list for details. However, I would expect a
ClassNotFoundException and not a NullPointerException with a missing jar.
As I said I am only seeing these problems on AIX.  I have successfully
installed Ant on NT and Solaris and it is working fine there.  Unfortunately
our source and builds are all on an AIX box.  Currently we use a big hairy
makefile, but I would like to convert to Ant as it has some features we want
to take advantage of.

Chris

==== build.xml ====
<project name="Test" default="help" basedir=".">

  <!-- set global properties for this build -->

  <property name="src"  value="${basedir}/src" />
  <property name="lib" value="${basedir}/lib" />
  <property name="dest" value="${basedir}/classes" />


  <!-- ========================================================= -->
  <!-- Help - Default targe                                      -->
  <!-- ========================================================= -->
  <target name="help">
     <echo>
      This is a Test build file for Ant.
      Usage: ant "target-name"
     </echo>
  </target>

  <target name="prepare">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <!-- mkdir dir="${build}" /-->
  </target>
</project>


-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: Friday, March 09, 2001 1:21 AM
To: ant-user@jakarta.apache.org
Subject: Re: NullPointerException


Chris Stillwell <Ch...@wcom.com> wrote:

> This is the result of trying to run it the first time using a simple
> build file that just echos some messages.

Could you please show us the build file?

The stack trace is a mystery to me as it indicates you'd have no
project, which in turn is impossible.

Stefan


Re: NullPointerException

Posted by Stefan Bodewig <bo...@apache.org>.
Chris Stillwell <Ch...@wcom.com> wrote:

> This is the result of trying to run it the first time using a simple
> build file that just echos some messages.

Could you please show us the build file?

The stack trace is a mystery to me as it indicates you'd have no
project, which in turn is impossible.

Stefan

Re: Problems running on AIX

Posted by Glenn McAllister <gl...@somanetworks.com>.
Chris Stillwell wrote:

> The interesting thing is that I'm not trying to run the vajexport task.
> If I remove the jakarta-ant-1.3-optional.jar, then everything works fine.

Hmm... that sounds very odd.

> Here is the test build.xml I'm running:
>
> <project name="Test" default="help" basedir=".">
>
>   <!-- set global properties for this build -->
>
>   <property name="src"  value="${basedir}/src" />
>   <property name="lib" value="${basedir}/lib" />
>   <property name="dest" value="${basedir}/classes" />
>
>   <!--
> =================================================================== -->
>   <!-- Help - Default
>       -->
>   <!--
> =================================================================== -->
>   <target name="help">
>      <echo>
>       This is a Test build file for Ant.
>       Usage: ant "target-name"
>      </echo>
>   </target>
>
>   <target name="prepare">
>     <!-- Create the time stamp -->
>     <tstamp/>
>     <!-- Create the build directory structure used by compile -->
>     <!-- mkdir dir="${build}" /-->
>   </target>
> </project>
>

I got the 1.3 dist and the optional jar.  I tried your build file but didn't
encounter the error.  I even added a reference to the vajexport task, and the
error I got was the standard "unable to load" bit.  The caveat to that is I'm
running Linux, not AIX.

Can anyone else running AIX (presumably 4.x.x or later) verify this bug.  I
haven't had access to an AIX box for some time now.

Glenn


RE: Problems running on AIX

Posted by Chris Stillwell <Ch...@wcom.com>.
The interesting thing is that I'm not trying to run the vajexport task.
If I remove the jakarta-ant-1.3-optional.jar, then everything works fine.

Here is the test build.xml I'm running:

<project name="Test" default="help" basedir=".">

  <!-- set global properties for this build -->

  <property name="src"  value="${basedir}/src" />
  <property name="lib" value="${basedir}/lib" />
  <property name="dest" value="${basedir}/classes" />


  <!--
=================================================================== -->
  <!-- Help - Default
      -->
  <!--
=================================================================== -->
  <target name="help">
     <echo>
      This is a Test build file for Ant.
      Usage: ant "target-name"
     </echo>
  </target>

  <target name="prepare">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <!-- mkdir dir="${build}" /-->
  </target>
</project>


-----Original Message-----
From: glenn@dryline-fw.wireless-sys.com
[mailto:glenn@dryline-fw.wireless-sys.com]On Behalf Of Glenn McAllister
Sent: Thursday, March 08, 2001 4:08 PM
To: ant-user@jakarta.apache.org
Subject: Re: Problems running on AIX


Chris Stillwell wrote:

> I get the following exception running ant when the
> jakarta-ant-1.3-optional.jar is in the
> $ANT_HOME/lib directory.  Any ideas?
>
> Buildfile: build.xml
> Exception in thread "main" java.lang.VerifyError: (class:
> org/apache/tools/ant/t
> askdefs/optional/ide/VAJExport, method: getWorkspaceScanner signature:
> ()Lorg/ap
> ache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner;) Incompatible
> object a
> rgument for function call
>         at java.lang.Class.forName1(Native Method)
>         at java.lang.Class.forName(Class.java:134)
>         at org.apache.tools.ant.Project.init(Project.java:163)
>         at org.apache.tools.ant.Main.runBuild(Main.java:387)
>         at org.apache.tools.ant.Main.main(Main.java:149)
> nwvibm00-e1 : /home/databus $

Why are you trying to run the vajexport task from outside VAJ?  It depends
on the workspace classes that are (effectively) only available from within
the IDE.  You can't use this task from a command line build file.  The
easiest way to use it is to load everything into your repository, then use
Wolf's et. al.'s build launcher.

See http://jakarta.apache.org/ant/manual/Integration/VAJAntTool.html for
details.

Glenn



Re: Problems running on AIX

Posted by Glenn McAllister <gl...@somanetworks.com>.
Chris Stillwell wrote:

> I get the following exception running ant when the
> jakarta-ant-1.3-optional.jar is in the
> $ANT_HOME/lib directory.  Any ideas?
>
> Buildfile: build.xml
> Exception in thread "main" java.lang.VerifyError: (class:
> org/apache/tools/ant/t
> askdefs/optional/ide/VAJExport, method: getWorkspaceScanner signature:
> ()Lorg/ap
> ache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner;) Incompatible
> object a
> rgument for function call
>         at java.lang.Class.forName1(Native Method)
>         at java.lang.Class.forName(Class.java:134)
>         at org.apache.tools.ant.Project.init(Project.java:163)
>         at org.apache.tools.ant.Main.runBuild(Main.java:387)
>         at org.apache.tools.ant.Main.main(Main.java:149)
> nwvibm00-e1 : /home/databus $

Why are you trying to run the vajexport task from outside VAJ?  It depends
on the workspace classes that are (effectively) only available from within
the IDE.  You can't use this task from a command line build file.  The
easiest way to use it is to load everything into your repository, then use
Wolf's et. al.'s build launcher.

See http://jakarta.apache.org/ant/manual/Integration/VAJAntTool.html for
details.

Glenn


Problems running on AIX

Posted by Chris Stillwell <Ch...@wcom.com>.
I get the following exception running ant when the
jakarta-ant-1.3-optional.jar is in the
$ANT_HOME/lib directory.  Any ideas?

Buildfile: build.xml
Exception in thread "main" java.lang.VerifyError: (class:
org/apache/tools/ant/t
askdefs/optional/ide/VAJExport, method: getWorkspaceScanner signature:
()Lorg/ap
ache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner;) Incompatible
object a
rgument for function call
        at java.lang.Class.forName1(Native Method)
        at java.lang.Class.forName(Class.java:134)
        at org.apache.tools.ant.Project.init(Project.java:163)
        at org.apache.tools.ant.Main.runBuild(Main.java:387)
        at org.apache.tools.ant.Main.main(Main.java:149)
nwvibm00-e1 : /home/databus $