Community
Participate
Working Groups
I made a package (I will attach it to this bug with the name bug.zip) which shows a sample Java program that correctly runs when compiled with javac and have classloading problems every time it is compiled with ajc. Please see the file README.TO.DEMONSTRATE.BUG inside the bug.zip archive for detailed (although simple) instructions on reproducing the bug. There are two shell scripts attached to make things easier. Please keep me informed of the status of this issue.
Created attachment 5431 [details] PART 1 of 3 - Sample code and scripts to demonstrate ajc compiler bug. See the contained file README.TO.DEMONSTRATE.BUG for information.
Created attachment 5432 [details] PART 2 of 3 - Sample code and scripts to demonstrate ajc compiler bug. See the contained file README.TO.DEMONSTRATE.BUG for information
Created attachment 5433 [details] PART 3 of 3 - Sample code and scripts to demonstrate ajc compiler bug. See the contained file README.TO.DEMONSTRATE.BUG for information.
Sorry for the big files. I wanted to make something easy to reproduce and self-contained.
What version of the compiler are you using? I can't reproduce this with the 1.1.0 released compiler. When I run compile_and_test_class_with_ajc, I see "The test case worked!". Are you using an older version of ajc?
I am using j2sdk1.4.1_01 and I just noticed something which might help you to reproduce the bug: The JAVA_HOME environment variable must be set to <place-where-java-is-located>/j2sdk1.4.1_01 for the problem to appear. * The version I am using is really 1.1.0... * You should have seen an exception instead of the "The test case worked!" message. * If you still cannot reproduce the bug, I will happily provide access to my system to show it if you wish.
I still can't duplicate this bug. The only difference I can see with our systems is that I'm running under Windows XP instead of Linux. My detailed Java version info is: C:\aspectj\scratch\bug>java -version java version "1.4.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01) Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) Under this configuration I can't duplicate this bug. I'm cc'ing this to George Harley who I know has easy access to both Windows and Linux boxes to see if he has better luck reproducing it on one or both of those systems.
OK, I can look at this one tomorrow (Thursday 24th July). My Linux Java is : java version "1.4.1_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_05-b01) Java HotSpot(TM) Client VM (build 1.4.1_05-b01, mixed mode)
Raising to P2 to be sure that we investigate before 1.1.1 release. Investigation may result either in a fix or a lowering of priority.
I couldn't resist trying to see if the error showed up for me before I left the office for the day. Using the test case supplied in the zip files all went OK when it was compiled and run with the 1.4.1 JDK. However, when I compiled it with the 1.1.0 ajc and ran it on the 1.4.1 JVM I got the following ... Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/parsers/AbstractDOMParser at testcase.ShowBug.main(ShowBug.java:49) I saw the same runtime behaviour when running the class with a 1.3.1 JVM. Like I said, I can look into this further tomorrow. Is the above exception what you are seeing in your environment ?
George, I don't want to keep you any later tonight, but tommorrow could you do the same test on a Windows XP box to verify if this is a Linux-only bug or if I'm somehow special in not being able to reproduce it?
The exception reported by George is exactly what I got running the bug-reproducer now. However, In the original environment (I am working in the development of software which source code I unfortunately cannot disclose) the compiler generated invalid class files some times. Again, if any of you need a test environment in which the bug shows up every time access the http://pinheiros.ic.unicamp.br:40000 address in any java-enabled browser and mail me for the password - I have a X session (inside VNC) laying there.
The test case is failing for me on Windows XP as well but in a different way to the previously observed Linux failure. On Windows XP with a 1.4.1_02 Java and a 1.1.0 AspectJ when I ran the ajc script supplied in the test case zip I got what looked like a silent failure : the script was launched and then just returned without any information. That is, no success message and no error messages. With the addition of a print statement or two to the script it became clear that the call to ajc never completed and caused the entire script to exit before any attempt was made to run the class. I added the -verbose flag to a command line call to ajc (compiling testcase\ShowBug.java, the same source file as specified in the test script) and got the following ... C:\39959\bug>ajc -verbose testcase\ShowBug.java zipfile classpath entry does not exist: c:\sun-jdk-141-02\jre\lib\i18n.jar directory classpath entry does not exist: c:\sun-jdk-141-02\jre\classes compiling C:\39959\bug\testcase\ShowBug.java compiling C:\39959\bug\.\util\xml\Item.java compiling C:\39959\bug\.\util\xml\AttributeNotFoundException.java compiling C:\39959\bug\.\util\xml\ChildNotFoundException.java compiling C:\39959\bug\.\util\xml\ItemList.java compiling C:\39959\bug\.\util\xml\TextNotFoundAtBeginningException.java compiling C:\39959\bug\.\util\xml\NoSuchItemRuntimeException.java weaving might need to weave [UnwovenClassFile(C:\39959\bug\testcase\ShowBug$1.class, tes tcase.ShowBug$1), UnwovenClassFile(C:\39959\bug\testcase\ShowBug.class, testcase .ShowBug), UnwovenClassFile(C:\39959\bug\.\util\xml\Item.class, util.xml.Item), UnwovenClassFile(C:\39959\bug\.\util\xml\AttributeNotFoundException.class, util. xml.AttributeNotFoundException), UnwovenClassFile(C:\39959\bug\.\util\xml\ChildN otFoundException.class, util.xml.ChildNotFoundException), UnwovenClassFile(C:\39 959\bug\.\util\xml\ItemList.class, util.xml.ItemList), UnwovenClassFile(C:\39959 \bug\.\util\xml\TextNotFoundAtBeginningException.class, util.xml.TextNotFoundAtB eginningException), UnwovenClassFile(C:\39959\bug\.\util\xml\NoSuchItemRuntimeEx ception.class, util.xml.NoSuchItemRuntimeException)](world=false) (For the above the CLASSPATH in my environment was C:\aspectj1.1. 0-final\lib\aspectjrt.jar;.) In another XP window with a 1.3.1_08 Java (and identical environmental CLASSPATH) I got the very same behaviour when running the testcase script (silent exit from the script somewhere in the ajc call). I repeated the ajc command with verbose and saw the following ... C:\39959\bug>ajc -verbose testcase\ShowBug.java directory classpath entry does not exist: c:\sun-jdk-131-08\jre\classes compiling C:\39959\bug\testcase\ShowBug.java compiling C:\39959\bug\.\util\xml\Item.java compiling C:\39959\bug\.\util\xml\AttributeNotFoundException.java compiling C:\39959\bug\.\util\xml\ChildNotFoundException.java compiling C:\39959\bug\.\util\xml\ItemList.java compiling C:\39959\bug\.\util\xml\TextNotFoundAtBeginningException.java compiling C:\39959\bug\.\util\xml\NoSuchItemRuntimeException.java weaving might need to weave [UnwovenClassFile(C:\39959\bug\testcase\ShowBug$1.class, tes tcase.ShowBug$1), UnwovenClassFile(C:\39959\bug\testcase\ShowBug.class, testcase .ShowBug), UnwovenClassFile(C:\39959\bug\.\util\xml\Item.class, util.xml.Item), UnwovenClassFile(C:\39959\bug\.\util\xml\AttributeNotFoundException.class, util. xml.AttributeNotFoundException), UnwovenClassFile(C:\39959\bug\.\util\xml\ChildN otFoundException.class, util.xml.ChildNotFoundException), UnwovenClassFile(C:\39 959\bug\.\util\xml\ItemList.class, util.xml.ItemList), UnwovenClassFile(C:\39959 \bug\.\util\xml\TextNotFoundAtBeginningException.class, util.xml.TextNotFoundAtB eginningException), UnwovenClassFile(C:\39959\bug\.\util\xml\NoSuchItemRuntimeEx ception.class, util.xml.NoSuchItemRuntimeException)](world=false) In both windows the ajc compile step did actually produce a .class file and when it was run the following was returned ... C:\39959\bug>java testcase.ShowBug Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/par sers/AbstractDOMParser at testcase.ShowBug.main(ShowBug.java:49) i.e. identical to the final outcome seen earlier on Linux. Jim, are you using an ajc from out of the CVS HEAD ? Maybe this has been fixed post-1.1.0 ?
This problem occurred when a command line compile did not specify a "- classpath" option. In that case BuildArgParser loaded System.getProperty ("java.class.path"). However, in the launch script aspectjtools.jar is already added to the VM's classpath. We remove all occurrences of "aspectjtools.jar" from the detected classpath. This should enable bootstrapping ajc.