Re: [Ikvm-developers] Illegal Access Error
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2011-06-04 07:16:03
|
Chris,
An UnsatisfiedLinkError is, just like in Java, most likely caused by the native library not being found.
Some questions:
- What version of IKVM are you using?
- What operating system are you running?
- If Windows, have you tried running on .NET instead of Mono?
- If not Windows, why is com.idrt.Win32PortManager being used?
- Is it an x64 version of the operating system?
Regards,
Jeroen
> -----Original Message-----
> From: Chris Booth [mailto:cl...@br...]
> Sent: Friday, June 03, 2011 6:54 PM
> To: Jeroen Frijters; ikv...@li...
> Subject: RE: [Ikvm-developers] Illegal Access Error
>
> Jeroen,
>
> I appreciate your quick response. I was assuming it was something of
> that nature; however, as this is my first time making use of IKVMC I am
> still in the process learning the full scope of its use.
>
> After compiling the files with no warnings, I've thrown the files, all
> their dependencies, and what appears to be the appropriate IKVM DLLs
> (OpenJDK.Beans, OpenJDK.Core, OpenJDK.Util, and Runtime) into a unity
> project. When executing a simple test class to verify functionality, I
> am receiving the following error:
>
> TypeLoadException: Could not load type
> 'sun.security.util.SecurityConstants' from assembly 'IKVM.OpenJDK.Core,
> Version=0.46.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58'.
> java.util.logging.LogManager$3.run ()
> Rethrow as TypeInitializationException: An exception was thrown by
> the type initializer for com.idrt.PortManager
> com.idrt.Glove..ctor ()
> ReadGlove.doExample () (at Assets/ReadGlove.cs:37)
> ReadGlove.Update () (at Assets/ReadGlove.cs:30)
>
> Under the assumption that it might have required IKVM.OpenJDK.Security,
> I included that file along with the apparent dependency
> IKVM.Runtime.JNI.
> With these two libraries included, I am receiving an
> UnsatisfiedLinkError:
>
> UnsatisfiedLinkError:
> com/ice/jni/registry/RegistryKey.openSubKey(Ljava/lang/String;I)Lcom/ice
> /j
> ni/registry/RegistryKey;
> IKVM.Runtime.JNI+Frame.GetFuncPtr (ikvm.internal.CallerID callerID,
> System.String clazz, System.String name, System.String sig)
> com.ice.jni.registry.RegistryKey.openSubKey (System.String str,
> Int32 i)
> com.ice.jni.registry.Registry.openSubkey
> (com.ice.jni.registry.RegistryKey topKey, System.String keyName, Int32
> access)
> com.idrt.Win32PortManager.getAvailablePorts ()
> com.idrt.PortManager.getAvailablePorts ()
> com.idrt.Glove..ctor ()
> ReadGlove.doExample () (at Assets/ReadGlove.cs:37)
> ReadGlove.Update () (at Assets/ReadGlove.cs:30)
> (Note: this error is only present when the offending line is executed)
>
> An uneducated guess here might be that it mono is having issues with the
> unmanaged code. Does this sound reasonable, or off the mark? I'm
> hoping I haven't gotten to this point only to find out that there's an
> issue with using the IKVM with my version of mono (2.6).
>
> -----Original Message-----
> From: Jeroen Frijters [mailto:je...@su...]
> Sent: Friday, June 03, 2011 3:15 AM
> To: Chris Booth; ikv...@li...
> Subject: RE: [Ikvm-developers] Illegal Access Error
>
> Hi Chris,
>
> This happens because you're splitting up the package com.idrt between to
> different assemblies (and hence class loaders).
>
> The solution is to compile both jars at the same time, that way ikvmc
> can see that you're doing this and add the appropriate
> InternalsVisibleToAttribute.
>
> Like this (all on one line):
>
> ikvmc -target:library { -r:DLLs\RXTXcomm.dll -r:DLLs\jsr082_1.1.dll -
> r:DLLs\cldc_1.1.dll AcceleGloveSDK.jar } { AcceleGloveSDK-Win.jar }
>
> You'll still get two different output assemblies, but AcceleGloveSDK.dll
> will have the InternalsVisibleToAttribute to allow AcceleGloveSDK-
> Win.dll access to the package private types and members.
>
> Another option that may be useful is -sharedclassloader as that will
> make sure that even though you have two different assemblies, at runtime
> they will share a single class loader (which is often assumed by code
> like
> this):
>
> ikvmc -sharedclassloader -target:library { ... } { ... }
>
> Regards,
> Jeroen
>
> > -----Original Message-----
> > From: Chris Booth [mailto:cl...@br...]
> > Sent: Friday, June 03, 2011 2:13 AM
> > To: ikv...@li...
> > Subject: [Ikvm-developers] Illegal Access Error
> >
> > Hello,
> >
> >
> >
> > I'm working on converting the SDK for a project, and am trying to
> > figure out the cause (and resolution to) an illegal access error which
> > I receive when executing the following:
> >
> > > ikvmc -target:library -r:DLLs\AcceleGloveSDK.dll .\AcceleGloveSDK-
> > Win.jar
> >
> > Note IKVMC0002: output file is "AcceleGloveSDK-Win.dll"
> >
> > Warning IKVMC0103: unable to compile class "com.idrt.Win32PortManager"
> > (illegal access error "Class com.idrt.Win32PortManager cannot access
> > its superinterface com.idrt.PortManager$PortManagerInstance")
> >
> >
> >
> >
> >
> > The reference was compiled (successfully) via:
> >
> > > ikvmc -target:library -r:DLLs\RXTXcomm.dll -r:DLLs\jsr082_1.1.dll -
> > r:DLLs\cldc_1.1.dll .\AcceleGloveSDK.jar
> >
> > Note IKVMC0002: output file is "AcceleGloveSDK.dll"
> >
> >
> >
> > The code in question is:
> >
> > [AcceleGloveSDK-Win.jar]
> >
> > public class Win32PortManager implements
> > PortManager.PortManagerInstance { . . . }
> >
> >
> >
> > Where PortManager.PortManagerInstance is defined as:
> >
> > [AcceleGloveSDK.jar]
> >
> > static abstract interface PortManagerInstance { . . . }
> >
> >
> >
> > The interface is defined within a separate jar file, but is still
> > within the same package.
> >
> >
> >
> > As far as I can tell, IKVMC is unable to access the abstract instance
> > when AcceleGloveSDK.dll is included as a reference. Has anyone
> > experienced similar issues when attempting to reference interfaces
> > defined in a separate jar file?
> >
> >
> >
> > Regards,
> >
> >
> >
> > Chris
|