java.lang.NoClassDefFoundError: wrong name

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

java.lang.NoClassDefFoundError: wrong name

by Michael Lawson (mshindo) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

I am trying to use a class that I have created that is located in a seperate Jar file in my class path. I can use this with standalone java without any problems. I have tried several methods of  including/importing this into my Jython program, all without any success and rather strange error messages.

First method:
from DhtPairs import KeyPBO

which returns
>>> from DhtPairs import KeyPBO
Traceback (innermost last):
  File "<console>", line 1, in ?
ImportError: no module named DhtPairs

and also:
from KeyPBO import Key
>>> import KeyPBO
Traceback (innermost last):
  File "<console>", line 1, in ?
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:700)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:244)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.python.core.SyspathJavaLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
        at org.python.core.Py.findClassEx(Unknown Source)
        at org.python.core.SysPackageManager.findClass(Unknown Source)
        at org.python.core.PackageManager.findClass(Unknown Source)
        at org.python.core.SysPackageManager.findClass(Unknown Source)
        at org.python.core.PyJavaPackage.__findattr__(Unknown Source)
        at org.python.core.PackageManager.lookupName(Unknown Source)
        at org.python.core.JavaImporter.find_module(Unknown Source)
        at org.python.core.JavaImporter.find_module(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: KeyPBO (wrong name: DhtPairs/KeyPBO)

Can anyone offer suggestions ?

--
Michael Lawson (mshindo)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: java.lang.NoClassDefFoundError: wrong name

by Leo Soto M. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 5, 2009 at 12:38 AM, Michael Lawson (mshindo)
<michael@...> wrote:

> Hey,
>
> I am trying to use a class that I have created that is located in a seperate
> Jar file in my class path. I can use this with standalone java without any
> problems. I have tried several methods of  including/importing this into my
> Jython program, all without any success and rather strange error messages.
>
> First method:
> from DhtPairs import KeyPBO
>
> which returns
>>>> from DhtPairs import KeyPBO
> Traceback (innermost last):
>   File "<console>", line 1, in ?
> ImportError: no module named DhtPairs
>
> and also:
> from KeyPBO import Key
>>>> import KeyPBO
> Traceback (innermost last):
>   File "<console>", line 1, in ?
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:700)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:244)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:169)
>         at org.python.core.SyspathJavaLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
>         at org.python.core.Py.findClassEx(Unknown Source)
>         at org.python.core.SysPackageManager.findClass(Unknown Source)
>         at org.python.core.PackageManager.findClass(Unknown Source)
>         at org.python.core.SysPackageManager.findClass(Unknown Source)
>         at org.python.core.PyJavaPackage.__findattr__(Unknown Source)
>         at org.python.core.PackageManager.lookupName(Unknown Source)
>         at org.python.core.JavaImporter.find_module(Unknown Source)
>         at org.python.core.JavaImporter.find_module(Unknown Source)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>
> java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: KeyPBO
> (wrong name: DhtPairs/KeyPBO)
>
> Can anyone offer suggestions ?

Can you attach the jar file with the Java classes? (or publish on the web?)

Regards,
--
Leo Soto M.
http://blog.leosoto.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: java.lang.NoClassDefFoundError: wrong name

by Michael Lawson (mshindo) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Attached is the file. Its a rather simple package, basically just simply one class that has been generated by google protocol buffers.


On Fri, Nov 6, 2009 at 6:13 AM, Leo Soto M. <leo.soto@...> wrote:
On Thu, Nov 5, 2009 at 12:38 AM, Michael Lawson (mshindo)
<michael@...> wrote:
> Hey,
>
> I am trying to use a class that I have created that is located in a seperate
> Jar file in my class path. I can use this with standalone java without any
> problems. I have tried several methods of  including/importing this into my
> Jython program, all without any success and rather strange error messages.
>
> First method:
> from DhtPairs import KeyPBO
>
> which returns
>>>> from DhtPairs import KeyPBO
> Traceback (innermost last):
>   File "<console>", line 1, in ?
> ImportError: no module named DhtPairs
>
> and also:
> from KeyPBO import Key
>>>> import KeyPBO
> Traceback (innermost last):
>   File "<console>", line 1, in ?
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:700)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>         at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:244)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:169)
>         at org.python.core.SyspathJavaLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
>         at org.python.core.Py.findClassEx(Unknown Source)
>         at org.python.core.SysPackageManager.findClass(Unknown Source)
>         at org.python.core.PackageManager.findClass(Unknown Source)
>         at org.python.core.SysPackageManager.findClass(Unknown Source)
>         at org.python.core.PyJavaPackage.__findattr__(Unknown Source)
>         at org.python.core.PackageManager.lookupName(Unknown Source)
>         at org.python.core.JavaImporter.find_module(Unknown Source)
>         at org.python.core.JavaImporter.find_module(Unknown Source)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>
> java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: KeyPBO
> (wrong name: DhtPairs/KeyPBO)
>
> Can anyone offer suggestions ?

Can you attach the jar file with the Java classes? (or publish on the web?)

Regards,
--
Leo Soto M.
http://blog.leosoto.com



--
Michael Lawson (mshindo)



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

DhtPairs.jar (8K) Download Attachment

Re: java.lang.NoClassDefFoundError: wrong name

by oti-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael,

KeyPBO.class is top level inside the .jar file,
but javap -c reveals:
  public final class DhtPairs.KeyPBO extends java.lang.Object
which makes me believe it should be in package DhtPairs.

best wishes,
Oti.

On Thu, Nov 5, 2009 at 8:46 PM, Michael Lawson (mshindo)
<michael@...> wrote:

> Attached is the file. Its a rather simple package, basically just simply one
> class that has been generated by google protocol buffers.
>
>
> On Fri, Nov 6, 2009 at 6:13 AM, Leo Soto M. <leo.soto@...> wrote:
>>
>> On Thu, Nov 5, 2009 at 12:38 AM, Michael Lawson (mshindo)
>> <michael@...> wrote:
>> > Hey,
>> >
>> > I am trying to use a class that I have created that is located in a
>> > seperate
>> > Jar file in my class path. I can use this with standalone java without
>> > any
>> > problems. I have tried several methods of  including/importing this into
>> > my
>> > Jython program, all without any success and rather strange error
>> > messages.
>> >
>> > First method:
>> > from DhtPairs import KeyPBO
>> >
>> > which returns
>> >>>> from DhtPairs import KeyPBO
>> > Traceback (innermost last):
>> >   File "<console>", line 1, in ?
>> > ImportError: no module named DhtPairs
>> >
>> > and also:
>> > from KeyPBO import Key
>> >>>> import KeyPBO
>> > Traceback (innermost last):
>> >   File "<console>", line 1, in ?
>> >         at java.lang.ClassLoader.defineClass1(Native Method)
>> >         at java.lang.ClassLoader.defineClass(ClassLoader.java:700)
>> >         at
>> > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>> >         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>> >         at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>> >         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>> >         at java.security.AccessController.doPrivileged(Native Method)
>> >         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>> >         at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:244)
>> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
>> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
>> >         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399)
>> >         at java.lang.Class.forName0(Native Method)
>> >         at java.lang.Class.forName(Class.java:169)
>> >         at org.python.core.SyspathJavaLoader.loadClass(Unknown Source)
>> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
>> >         at org.python.core.Py.findClassEx(Unknown Source)
>> >         at org.python.core.SysPackageManager.findClass(Unknown Source)
>> >         at org.python.core.PackageManager.findClass(Unknown Source)
>> >         at org.python.core.SysPackageManager.findClass(Unknown Source)
>> >         at org.python.core.PyJavaPackage.__findattr__(Unknown Source)
>> >         at org.python.core.PackageManager.lookupName(Unknown Source)
>> >         at org.python.core.JavaImporter.find_module(Unknown Source)
>> >         at org.python.core.JavaImporter.find_module(Unknown Source)
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >         at
>> >
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >         at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >         at java.lang.reflect.Method.invoke(Method.java:597)
>> >
>> > java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: KeyPBO
>> > (wrong name: DhtPairs/KeyPBO)
>> >
>> > Can anyone offer suggestions ?
>>
>> Can you attach the jar file with the Java classes? (or publish on the
>> web?)
>>
>> Regards,
>> --
>> Leo Soto M.
>> http://blog.leosoto.com
>
>
>
> --
> Michael Lawson (mshindo)
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Jython-users mailing list
> Jython-users@...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users