Skip to main content

ClassNotFoundException

5 replies [Last post]
k_pa
Offline
Joined: 2008-05-20
Points: 0

Hello all,

I have compiled phoneME Advanced MR2 for my own board based on a PXA270.
I have a Linux 2.6.20 Kernel and I use Qtopia core 4.3. All are compiled with gcc version 4.1.2 in EABI mode.

I have compiled phoneMe from cdc/build/linux-arm-bulverde that is the makefile for PXA270 and I use this single line:
make -f GNUmakefile CVM_TARGET_TOOLS_PREFIX=arm-linux-gnueabi- USE_AAPCS=true CVM_ARM_HAS_WMMX=true CVM_OPTIMIZED=true CVM_CLASSLOADING=true CVM_SERIALIZATION=true CVM_REFLECT=true CVM_DYNAMIC_LINKING=true CVM_JIT=false CVM_JIT_REGISTER_LOCALS=true J2ME_CLASSLIB=foundation OPT_PKGS=all

After compilation I have copied the binaries cvm and the HelloWorld.java test application on my board. When I start cvm with cvm HelloWorld I have the following error:

java.lang.ClassNotFoundException: sun.net.www.protocol.jar.Handler
at java.lang.ClassLoader.loadBootstrapClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.misc.Launcher$Factory.createURLStreamHandler(Unknown Source)
at sun.misc.URLClassPath.(Unknown Source)
at java.net.URLClassLoader.(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.(Unknown Source)
at sun.misc.Launcher$ExtClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.getExtClassLoader(Unknown Source)
at sun.misc.Launcher.(Unknown Source)
at sun.misc.Launcher$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at sun.misc.Launcher.(Unknown Source)
at java.lang.Class.runStaticInitializers(Unknown Source)
at java.lang.ClassLoader.initSystemClassLoader(Unknown Source)
at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
java.lang.InternalError: could not load jarsystem protocol handler
at sun.misc.Launcher$Factory.createURLStreamHandler(Unknown Source)
at sun.misc.URLClassPath.(Unknown Source)
at java.net.URLClassLoader.(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.(Unknown Source)
at sun.misc.Launcher$ExtClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.getExtClassLoader(Unknown Source)
at sun.misc.Launcher.(Unknown Source)
at sun.misc.Launcher$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at sun.misc.Launcher.(Unknown Source)
at java.lang.Class.runStaticInitializers(Unknown Source)
at java.lang.ClassLoader.initSystemClassLoader(Unknown Source)
at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)

Do you have some idea what I do wrong or what is the problem ?
Does I need to copy more file than only the binary cvm on my target ?

Thanks in advance for any help.

K-pa

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
k_pa
Offline
Joined: 2008-05-20
Points: 0

I have recompiled all directly from the svn trunk.
I have copied the bin (cvm) and all the lib directories to my target. Now when I start the CVM with my HelloWorld class in argument I have different error:

root@colibri:/usr/local/phoneme$ ./bin/cvm /home/root/HelloWorld
java.lang.ClassNotFoundException: /home/root/HelloWorld
at sun.misc.Launcher$AppClassLoader.findContainer(Native Method)
at sun.misc.Launcher$AppClassLoader.access$400(Unknown Source)
at sun.misc.Launcher$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at sun.misc.Launcher$AppClassLoader.doClassFind(Unknown Source)
at sun.misc.Launcher$AppClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.CVM.runMain(Unknown Source)

Do you have some idea of what is the problem in this case ?

Thanks K-pa

Message was edited by: k_pa

jiangli_zhou
Offline
Joined: 2006-10-16
Points: 0

Your cvm command line doesn't look right. If your HelloWorld.class is in /home/root directory, use -cp to specify the path. The main class name should not include the path. Try following command:

./bin/cvm -cp /home/root HelloWorld

k_pa
Offline
Joined: 2008-05-20
Points: 0

Thank you very much !

Now everything work well.

jiangli_zhou
Offline
Joined: 2006-10-16
Points: 0

Most likely it's because it cannot find the foundation.jar. Make sure the lib/ directory is copied to the board, so lib/foundation.jar exists.

k_pa
Offline
Joined: 2008-05-20
Points: 0

I have copied the lib directories to my board. I have respected the structure: cvm in /usr/java/bin directories and all the lib in /usr/java/lib. I have added both directories in the path but when I launch my HelloWorld class I have the same wrong issue.

Do you have another idea ? Need I to indicate to cvm where are the foundation ?

Thanks in advance