java.lang.NoClassDefFoundError

View: New views
3 Messages — Rating Filter:   Alert me  

java.lang.NoClassDefFoundError

by Christopher Friedt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm encountering an Error[2] when trying to run a simple Hello class
with JamVM-1.5.3 and the GNU classpath-0.97.2 .

I've checked out the jamvm source, and indeed, jamvm always does
fall-back to using a classpath equal to "." [1].

JamVM/Classpath have been giving me this bug for quite some time, ever
since jamvm-1.5.2 came out. My last successful combination was [
jamvm-1.5.1, classpath-0.97.1 ].

Although the bug seemingly stems from the classpath, I also have the
same problem when using the following combinations:

[ jamvm-1.5.2, classpath-0.97.1 ]
[ jamvm-1.5.3, classpath-0.97.1 ]
[ jamvm-1.5.1, classpath-0.97.2 ]
[ jamvm-1.5.2, classpath-0.97.2 ]
[ jamvm-1.5.3, classpath-0.97.2 ]


The strange part, is that jamvm has obviously set its 'classpath'
variable internally (see [1],[2]), but when ClassLoader is
instantiated, urls=[] (this corresponds to the debug output 'max=0',
which is the length of the urls array).

Any suggestions?

Cheers,

Chris

[1] jamvm-1.5.3/src/class.c
======================================================
...
void setClassPath(char *cmdlne_cp) {
    char *env;
    classpath = cmdlne_cp ? cmdlne_cp :
                 ((env = getenv("CLASSPATH")) ? env : ".");
    printf( "classpath="\%s\"\n", classpath );
}
...
======================================================



[2] note, PWD=/home/cfriedt/workspace/Hello, and Hello.class exists there
======================================================
output of
'jamvm Hello' OR
'jamvm -cp ${PWD} Hello' OR
 'jamvm -cp . Hello' OR
'CLASSPATH=${PWD} jamvm Hello' OR
'CLASSPATH=. jamvm Hello' OR
'export CLASSPATH=${PWD}; jamvm Hello' OR
'export CLASSPATH=.; jamvm Hello'
======================================================
classpath="/home/cfriedt/workspace/Hello"
className='Hello'
resourceName='Hello.class'
max=0
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
   <<No stacktrace available>>
Caused by: java.lang.ClassNotFoundException: Hello not found in
java.lang.ClassLoader$1{urls=[], parent=null}
   at java.net.URLClassLoader.findClass(URLClassLoader.java:545)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:341)
   at java.lang.ClassLoader$1.loadClass(ClassLoader.java:1112)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:293)
======================================================

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jamvm-general mailing list
Jamvm-general@...
https://lists.sourceforge.net/lists/listinfo/jamvm-general

Re: java.lang.NoClassDefFoundError

by Robert Lougher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Christopher,

2009/4/24 Christopher Friedt <chrisfriedt@...>:
> Hi,
>
> I'm encountering an Error[2] when trying to run a simple Hello class
> with JamVM-1.5.3 and the GNU classpath-0.97.2 .
>

JamVM since 1.5.2 is only compatible with GNU Classpath-0.98.  It's
mentioned in both the README and the INSTALL file.  This is the
relevant bit from the README:

Class Libraries
===============

JamVM is designed to use the GNU classpath Java class library (see
http://www.gnu.org/software/classpath).  A number of classes are
reference classes which must be modified for a particular VM.  These are
provided and built along with JamVM (see INSTALL).  JamVM 1.5.3 works with
Classpath version 0.98 (the latest development snapshot).  It should also
work with the latest version direct from CVS (but check the Classpath
mailing lists for possible patches).  Later snapshots of Classpath may
also work, if no modifications have been made to the VM interface.

Note, JamVM 1.5.3 will not work with versions of Classpath earlier than
0.98, nor will it work with the class library from Sun or IBM's Virtual
Machines, or OpenJDK.

-----------------------------------

Unfortunately, JamVM appears to work with 0.97.2, the problems being
subtle things like the classpath being wrong.  It doesn't fail
obviously.  JamVM does have runtime checks at startup which checks
certain classes, methods and fields are present.  I will see if I can
come up with an additional check to trap 0.97.2.

> I've checked out the jamvm source, and indeed, jamvm always does
> fall-back to using a classpath equal to "." [1].
>
> JamVM/Classpath have been giving me this bug for quite some time, ever
> since jamvm-1.5.2 came out. My last successful combination was [
> jamvm-1.5.1, classpath-0.97.1 ].
>
> Although the bug seemingly stems from the classpath, I also have the
> same problem when using the following combinations:
>
> [ jamvm-1.5.2, classpath-0.97.1 ]
> [ jamvm-1.5.3, classpath-0.97.1 ]
> [ jamvm-1.5.1, classpath-0.97.2 ]
> [ jamvm-1.5.2, classpath-0.97.2 ]
> [ jamvm-1.5.3, classpath-0.97.2 ]
>

I am surprised that JamVM 1.5.1 didn't work with Classpath-0.97.2.  I
will check this combination.  The others are incompatible.

Rob.

P.S.  The incompatibilities stem from JamVM moving to use the new VM
interface classes for reflection that was added in GNU Classpath-0.98
(VMConstructor, VMMethod, VMField).  Previous versions of JamVM to
1.5.2 had their own implementation of Constructor, Method, etc, but
the native code in JamVM is no longer compatible with them.

>
> The strange part, is that jamvm has obviously set its 'classpath'
> variable internally (see [1],[2]), but when ClassLoader is
> instantiated, urls=[] (this corresponds to the debug output 'max=0',
> which is the length of the urls array).
>
> Any suggestions?
>
> Cheers,
>
> Chris
>
> [1] jamvm-1.5.3/src/class.c
> ======================================================
> ...
> void setClassPath(char *cmdlne_cp) {
>    char *env;
>    classpath = cmdlne_cp ? cmdlne_cp :
>                 ((env = getenv("CLASSPATH")) ? env : ".");
>    printf( "classpath="\%s\"\n", classpath );
> }
> ...
> ======================================================
>
>
>
> [2] note, PWD=/home/cfriedt/workspace/Hello, and Hello.class exists there
> ======================================================
> output of
> 'jamvm Hello' OR
> 'jamvm -cp ${PWD} Hello' OR
>  'jamvm -cp . Hello' OR
> 'CLASSPATH=${PWD} jamvm Hello' OR
> 'CLASSPATH=. jamvm Hello' OR
> 'export CLASSPATH=${PWD}; jamvm Hello' OR
> 'export CLASSPATH=.; jamvm Hello'
> ======================================================
> classpath="/home/cfriedt/workspace/Hello"
> className='Hello'
> resourceName='Hello.class'
> max=0
> Exception in thread "main" java.lang.NoClassDefFoundError: Hello
>   <<No stacktrace available>>
> Caused by: java.lang.ClassNotFoundException: Hello not found in
> java.lang.ClassLoader$1{urls=[], parent=null}
>   at java.net.URLClassLoader.findClass(URLClassLoader.java:545)
>   at java.lang.ClassLoader.loadClass(ClassLoader.java:341)
>   at java.lang.ClassLoader$1.loadClass(ClassLoader.java:1112)
>   at java.lang.ClassLoader.loadClass(ClassLoader.java:293)
> ======================================================
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensign option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Jamvm-general mailing list
> Jamvm-general@...
> https://lists.sourceforge.net/lists/listinfo/jamvm-general
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jamvm-general mailing list
Jamvm-general@...
https://lists.sourceforge.net/lists/listinfo/jamvm-general

Parent Message unknown Re: java.lang.NoClassDefFoundError

by Christopher Friedt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rob,

Thanks - I am ashamed to say, that I did not read the README !

Actually, I didn't even realize that classpath-0.98 was out already
... I just checked out my sources from CVS and I didn't even see it
there.

Cheers,

Chris

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jamvm-general mailing list
Jamvm-general@...
https://lists.sourceforge.net/lists/listinfo/jamvm-general