You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by kaushal <ka...@gmail.com> on 2006/08/02 00:04:30 UTC
Problem with Javassist to look up core class
I am using ikvm to convert jave code to dll file. This java code uses some
thirdparty jar files (eg. log4j.jar, hibernate.jar etc). I use ikvmc to
create .dll file. There is no problem with creating dll.
Then, I am calling some function of that dll from the C# sharp code. I am
using Mono to compile and run C# code. But it gives me following error.
org.apache.hivemind.ApplicationRuntimeException: Unable to create class
$Runnable_10cca565a6b as subclass of java.lang.Object: Unable to lookup
java.lang.Object: java.lang.Object
at
org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy
(SingletonServiceModel.java:142)
at
org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getService(SingletonServiceModel.java:72)
at
org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java
:273)
at
org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:324)
at
org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:305)
at org.apache.hivemind.impl.RegistryInfrastructureImpl.getService
(RegistryInfrastructureImpl.java:210)
at
org.apache.hivemind.impl.RegistryInfrastructureImpl.startup(RegistryInfrastructureImpl.java:437)
at org.apache.hivemind.impl.RegistryBuilder.constructRegistry
(RegistryBuilder.java:139)
at
com.quartetfs.fwk.container.hivemind.Registry.buildRegistry(Registry.java:93)
at
com.quartetfs.fwk.container.hivemind.Registry.<init>(Registry.java:44)
at java.lang.reflect.Method.Invoke(Method.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:347)
at
com.quartetfs.fwk.container.Registry.createRegistry(Registry.java:45)
at
com.quartetfs.fwk.container.Registry.createRegistry(Registry.java:33)
at com.quartetfs.fwk.container.Registry.init(Registry.java:53)
at com.quartetfs.fwk.container.Registry.getRegistry(Registry.java
:67)
at cli.HelloWorld.Main(Unknown Source)
Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to create
class $Runnable_10cca565a6b as subclass of java.lang.Object: Unable to
lookup java.lang.Object : java.lang.Object
at
org.apache.hivemind.service.impl.ClassFactoryImpl.newClass(ClassFactoryImpl.java:49)
at org.apache.hivemind.impl.ProxyBuilder.<init>(ProxyBuilder.java)
at
org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxyClass
(SingletonServiceModel.java:192)
... 17 more
Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to lookup
java.lang.Object: java.lang.Object
at org.apache.hivemind.service.impl.CtClassSource.getCtClass
(CtClassSource.java:41)
at
org.apache.hivemind.service.impl.CtClassSource.newClass(CtClassSource.java:62)
... 20 more
Caused by: javassist.NotFoundException: java.lang.Object
at javassist.ClassPool.get (ClassPool.java:295)
... 22 more
C:\sample>
Thanks in advance for your help.
Kaushal
--
View this message in context: http://www.nabble.com/Problem-with-Javassist-to-look-up-core-class-tf2036568.html#a5604098
Sent from the HiveMind - Dev forum at Nabble.com.
RE: Problem with Javassist to look up core class
Posted by James Carman <ja...@carmanconsulting.com>.
Well, it'd be kind of hard to debug what you're doing. I, myself, am not
familiar with what kind of environment is created when you generate those
DLLs from Java code. I don't know if all the same facilities are available
(thread context classloader for example).
-----Original Message-----
From: kaushal [mailto:kaushal79@gmail.com]
Sent: Wednesday, August 02, 2006 12:01 PM
To: dev@hivemind.apache.org
Subject: Re: Problem with Javassist to look up core class
Hi Knut,
Thanks for your reply. Code that i have works fine in java. it throws the
exception when i try to call it from C# function.
Thanks
kaushal
--
View this message in context:
http://www.nabble.com/Problem-with-Javassist-to-look-up-core-class-tf2036568
.html#a5616843
Sent from the HiveMind - Dev forum at Nabble.com.
Re: Problem with Javassist to look up core class
Posted by kaushal <ka...@gmail.com>.
Hi Knut,
Thanks for your reply. Code that i have works fine in java. it throws the
exception when i try to call it from C# function.
Thanks
kaushal
--
View this message in context: http://www.nabble.com/Problem-with-Javassist-to-look-up-core-class-tf2036568.html#a5616843
Sent from the HiveMind - Dev forum at Nabble.com.
Re: Problem with Javassist to look up core class
Posted by Knut Wannheden <kn...@gmail.com>.
Kaushal,
This is a class loader issue. Javassist isn't finding the
java.lang.Object class. It is configured with a classloader which
should have the system class loader as its parent. So either that
isn't the case or java.lang.Object isn't found by the system class
loader.
Try setting up the thread's context class loader before constructing
the HiveMind registry. Use the class loader which loaded the HiveMind
classes or the java.lang.Object class. E.g.
Thread.currentThread().setContextClassLoader(RegistryBuilder.class.getClassLoader());
HTH,
--knut
On 8/2/06, kaushal <ka...@gmail.com> wrote:
>
> I am using ikvm to convert jave code to dll file. This java code uses some
> thirdparty jar files (eg. log4j.jar, hibernate.jar etc). I use ikvmc to
> create .dll file. There is no problem with creating dll.
> Then, I am calling some function of that dll from the C# sharp code. I am
> using Mono to compile and run C# code. But it gives me following error.
>
> org.apache.hivemind.ApplicationRuntimeException: Unable to create class
> $Runnable_10cca565a6b as subclass of java.lang.Object: Unable to lookup
> java.lang.Object: java.lang.Object
> at
> org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy
> (SingletonServiceModel.java:142)
> at
> org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getService(SingletonServiceModel.java:72)
> at
> org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java
> :273)
> at
> org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:324)
> at
> org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:305)
> at org.apache.hivemind.impl.RegistryInfrastructureImpl.getService
> (RegistryInfrastructureImpl.java:210)
> at
> org.apache.hivemind.impl.RegistryInfrastructureImpl.startup(RegistryInfrastructureImpl.java:437)
> at org.apache.hivemind.impl.RegistryBuilder.constructRegistry
> (RegistryBuilder.java:139)
> at
> com.quartetfs.fwk.container.hivemind.Registry.buildRegistry(Registry.java:93)
> at
> com.quartetfs.fwk.container.hivemind.Registry.<init>(Registry.java:44)
> at java.lang.reflect.Method.Invoke(Method.java)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:347)
> at
> com.quartetfs.fwk.container.Registry.createRegistry(Registry.java:45)
> at
> com.quartetfs.fwk.container.Registry.createRegistry(Registry.java:33)
> at com.quartetfs.fwk.container.Registry.init(Registry.java:53)
> at com.quartetfs.fwk.container.Registry.getRegistry(Registry.java
> :67)
> at cli.HelloWorld.Main(Unknown Source)
> Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to create
> class $Runnable_10cca565a6b as subclass of java.lang.Object: Unable to
> lookup java.lang.Object : java.lang.Object
> at
> org.apache.hivemind.service.impl.ClassFactoryImpl.newClass(ClassFactoryImpl.java:49)
> at org.apache.hivemind.impl.ProxyBuilder.<init>(ProxyBuilder.java)
> at
> org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxyClass
> (SingletonServiceModel.java:192)
> ... 17 more
> Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to lookup
> java.lang.Object: java.lang.Object
> at org.apache.hivemind.service.impl.CtClassSource.getCtClass
> (CtClassSource.java:41)
> at
> org.apache.hivemind.service.impl.CtClassSource.newClass(CtClassSource.java:62)
> ... 20 more
> Caused by: javassist.NotFoundException: java.lang.Object
> at javassist.ClassPool.get (ClassPool.java:295)
> ... 22 more
> C:\sample>
>
> Thanks in advance for your help.
>
> Kaushal
> --
> View this message in context: http://www.nabble.com/Problem-with-Javassist-to-look-up-core-class-tf2036568.html#a5604098
> Sent from the HiveMind - Dev forum at Nabble.com.
>
>