IKVM on Linux

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

IKVM on Linux

by Corneil du Plessis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a project where I build a DLL using the following list of jars:

backport-util-concurrent-3.0.jar
cglib-nodep-2.1_3.jar
commons-beanutils.jar
commons-collections.jar
commons-lang.jar
commons-logging.jar
dom4j-1.6.1.jar
drools-api-5.0.1.jar
drools-core-5.0.1.jar
ehcache-1.4.1.jar
jdom-1.0.jar
jsr107cache-1.0.jar
log4j-1.2.15.jar
mvel2-2.0.10.jar
spring-aop.jar
spring-beans.jar
spring-context-support.jar
spring-context.jar
spring-core.jar
stax-1.2.0.jar
stax-api-1.0.1.jar
xstream-1.3.1.jar

I get the following error using ikvm -0.40.0.1 on Linux but not on Windows, I have also tried ikvm -0.40.0.3

Link Error: Method "javax.xml.stream.XMLStreamWriter.getNamespaceContext()Ljavax.xml.namespace.NamespaceContext;" has a return type "javax.xml.namespace.NamespaceContext, IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58" instead of type "javax.xml.namespace.NamespaceContext, IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58" as expected by "com.thoughtworks.xstream.io.xml.StaxWriter"

I would like to be able to build the DLL as part of my build process using Hudson on Linux.
I do have mono installed on Linux but I am using ikvm from the downloaded distribution and not in ikvm. Is there any other settings required to prevent a clash with ikvm/mono?

Regards

Corneil


------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVM on Linux

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Consider removing the stax jars. I think they duplicate stuff that's already present in the OpenJDK library.
 


From: Corneil du Plessis [mailto:corneil@...]
Sent: 14 August 2009 12:40
To: ikvm-developers@...
Cc: jeroen@...
Subject: [Ikvm-developers] IKVM on Linux

I have a project where I build a DLL using the following list of jars:

backport-util-concurrent-3.0.jar
cglib-nodep-2.1_3.jar
commons-beanutils.jar
commons-collections.jar
commons-lang.jar
commons-logging.jar
dom4j-1.6.1.jar
drools-api-5.0.1.jar
drools-core-5.0.1.jar
ehcache-1.4.1.jar
jdom-1.0.jar
jsr107cache-1.0.jar
log4j-1.2.15.jar
mvel2-2.0.10.jar
spring-aop.jar
spring-beans.jar
spring-context-support.jar
spring-context.jar
spring-core.jar
stax-1.2.0.jar
stax-api-1.0.1.jar
xstream-1.3.1.jar

I get the following error using ikvm -0.40.0.1 on Linux but not on Windows, I have also tried ikvm -0.40.0.3

Link Error: Method "javax.xml.stream.XMLStreamWriter.getNamespaceContext()Ljavax.xml.namespace.NamespaceContext;" has a return type "javax.xml.namespace.NamespaceContext, IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58" instead of type "javax.xml.namespace.NamespaceContext, IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58" as expected by "com.thoughtworks.xstream.io.xml.StaxWriter"

I would like to be able to build the DLL as part of my build process using Hudson on Linux.
I do have mono installed on Linux but I am using ikvm from the downloaded distribution and not in ikvm. Is there any other settings required to prevent a clash with ikvm/mono?

Regards

Corneil


------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVM on Linux

by Corneil du Plessis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The same IKVM/OpenJDK on Windows works fine.
I have determined that using ikvm that ships with Mono compiles all the jars fine.

On Fri, 2009-08-14 at 15:50 +0100, Michael Kay wrote:
Consider removing the stax jars. I think they duplicate stuff that's already present in the OpenJDK library.
 
Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay





From: Corneil du Plessis [mailto:corneil@...]
Sent: 14 August 2009 12:40
To: ikvm-developers@...
Cc: jeroen@...
Subject: [Ikvm-developers] IKVM on Linux



I have a project where I build a DLL using the following list of jars:

backport-util-concurrent-3.0.jar
cglib-nodep-2.1_3.jar
commons-beanutils.jar
commons-collections.jar
commons-lang.jar
commons-logging.jar
dom4j-1.6.1.jar
drools-api-5.0.1.jar
drools-core-5.0.1.jar
ehcache-1.4.1.jar
jdom-1.0.jar
jsr107cache-1.0.jar
log4j-1.2.15.jar
mvel2-2.0.10.jar
spring-aop.jar
spring-beans.jar
spring-context-support.jar
spring-context.jar
spring-core.jar
stax-1.2.0.jar
stax-api-1.0.1.jar
xstream-1.3.1.jar

I get the following error using ikvm -0.40.0.1 on Linux but not on Windows, I have also tried ikvm -0.40.0.3

Link Error: Method "javax.xml.stream.XMLStreamWriter.getNamespaceContext()Ljavax.xml.namespace.NamespaceContext;" has a return type "javax.xml.namespace.NamespaceContext, IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58" instead of type "javax.xml.namespace.NamespaceContext, IKVM.OpenJDK.XML, Version=0.40.0.1, Culture=neutral, PublicKeyToken=13235d27fcbfff58" as expected by "com.thoughtworks.xstream.io.xml.StaxWriter"

I would like to be able to build the DLL as part of my build process using Hudson on Linux.
I do have mono installed on Linux but I am using ikvm from the downloaded distribution and not in ikvm. Is there any other settings required to prevent a clash with ikvm/mono?

Regards

Corneil


------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

IKVM and resources

by Corneil du Plessis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How can I determine if the xml and properties files from a JAR is in the DLLs?
The classloaders does not seem to be able to find them?

I am a bit of a newbie when it comes to .Net/Mono tools etc.

Regards

Corneil
------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVM and resources

by dawid.weiss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can use Reflector to inspect the DLL and see if it has your
resources. The problem may be that you're using an incorrect class
loader to look for your resource (rather than the resource itself).

Dawid

P.S. Reflector: http://www.red-gate.com/products/reflector/

On Mon, Aug 17, 2009 at 5:32 PM, Corneil du Plessis<corneil@...> wrote:

> How can I determine if the xml and properties files from a JAR is in the
> DLLs?
> The classloaders does not seem to be able to find them?
>
> I am a bit of a newbie when it comes to .Net/Mono tools etc.
>
> Regards
>
> Corneil
> ------------------------------------------------------------------------------
> 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
> _______________________________________________
> Ikvm-developers mailing list
> Ikvm-developers@...
> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
>
>

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVM and resources

by Corneil du Plessis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the tip.
I notice all the resources are in the dll but the names are prefixed with ikvm__

On Mon, 2009-08-17 at 22:19 +0200, Dawid Weiss wrote:
You can use Reflector to inspect the DLL and see if it has your
resources. The problem may be that you're using an incorrect class
loader to look for your resource (rather than the resource itself).

Dawid

P.S. Reflector: http://www.red-gate.com/products/reflector/

On Mon, Aug 17, 2009 at 5:32 PM, Corneil du Plessis<corneil@...> wrote:
> How can I determine if the xml and properties files from a JAR is in the
> DLLs?
> The classloaders does not seem to be able to find them?
>
> I am a bit of a newbie when it comes to .Net/Mono tools etc.
>
> Regards
>
> Corneil
> ------------------------------------------------------------------------------
> 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
> _______________________________________________
> Ikvm-developers mailing list
> Ikvm-developers@...
> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
>
>

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Parent Message unknown Re: IKVM and resources

by dawid.weiss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> It there anything special I have to do to ensure the IKVM ClassLoader is in
> place?

Jeroen would be probably the best person to address this one. My
understanding is that class loaders in IKVM are not automatically
"shared" between assemblies (see option -sharedclassloader in
ikvmc)... or, to put it more clearly, there is no single class loader
that has all assemblies underneath.

> The Spring code is executed but when the ClassPathXmlApplicationContext
> tries to load a resource from the classpath which is in my DLL is cannot be
> found.

I don't know about Spring, but try to get a handle to the class that
exists in the same JAR as the resources you're trying to load and use
that class's class loader.

MyClazz.class.getClassLoader().getResource("my-resource")

should work from your main method (return non-null URL). If it doesn't
work, it must be some other issue.

Dawid

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVM and resources

by Corneil du Plessis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My hunch about the ClasssLoaders seems to be correct and I am making some progress.

On Tue, 2009-08-18 at 10:11 +0200, Dawid Weiss wrote:
> It there anything special I have to do to ensure the IKVM ClassLoader is in
> place?

Jeroen would be probably the best person to address this one. My
understanding is that class loaders in IKVM are not automatically
"shared" between assemblies (see option -sharedclassloader in
ikvmc)... or, to put it more clearly, there is no single class loader
that has all assemblies underneath.

> The Spring code is executed but when the ClassPathXmlApplicationContext
> tries to load a resource from the classpath which is in my DLL is cannot be
> found.

I don't know about Spring, but try to get a handle to the class that
exists in the same JAR as the resources you're trying to load and use
that class's class loader.

MyClazz.class.getClassLoader().getResource("my-resource")

should work from your main method (return non-null URL). If it doesn't
work, it must be some other issue.

Dawid

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

IKVM and classloaders

by Corneil du Plessis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It seems that calls to java.lang.Class.forName fails when the classes are in a different assembly.

If the class being loaded it not in the assembly of the caller what happens then?



------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

IKVMC and System.Core.dll

by Calin Naghi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
Could somebody help me to change the IKVMC source code in order to force
it NOT to use System.Core.dll (which is from 3.5 framework) when it
builds IKVM.OpenJDK.Core.dll, on a machine which has .NET framework 3.5
installed. I checked the code in CompilerClassLoader.cs and I changed
some stuff but still no luck. Maybe somebody can give me a hint where I
should make any changes...?
Thanks in advance.
Calin.

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVMC and System.Core.dll

by Jeroen Frijters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Calin,

It should be fairly simple (if building ikvm can ever be considered simple). The build process is already constructed in such a way that it should work on a system that doesn't have System.Core.dll installed, so you could try that. Alternatively, you can delete the following line from ikvm/openjdk/response.txt:

    ../classpath/System.Core.jar

You'll get a warning during the build that cli.System.Runtime.CompilerServices.ExtensionAttribute isn't found, but you can ignore that.

If you do a build for the first time, don't forget to do a "nant clean" first to remove the strong named binaries.

Regards,
Jeroen

> -----Original Message-----
> From: Calin Naghi [mailto:cnaghi@...]
> Sent: Tuesday, August 18, 2009 3:49 PM
> To: ikvm-developers@...
> Subject: [Ikvm-developers] IKVMC and System.Core.dll
>
> Hi all,
> Could somebody help me to change the IKVMC source code in order to
> force it NOT to use System.Core.dll (which is from 3.5 framework) when
> it builds IKVM.OpenJDK.Core.dll, on a machine which has .NET framework
> 3.5 installed. I checked the code in CompilerClassLoader.cs and I
> changed some stuff but still no luck. Maybe somebody can give me a hint
> where I should make any changes...?
> Thanks in advance.
> Calin.
>
> -----------------------------------------------------------------------
> -------
> 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
> _______________________________________________
> Ikvm-developers mailing list
> Ikvm-developers@...
> https://lists.sourceforge.net/lists/listinfo/ikvm-developers

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVM and classloaders

by Jeroen Frijters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Corneil du Plessis wrote:
> It seems that calls to java.lang.Class.forName fails when the classes
> are in a different assembly.

That's not quite correct. What happens is that Class.forName(String) uses the caller's ClassLoader (just like in Java), if that class loader or any of the class loaders it delegates to cannot find the class, then the Class.forName() fails.

For more on class loaders in IKVM.NET please read:
http://weblog.ikvm.net/PermaLink.aspx?guid=4e0b7f7c-6f5d-42a3-a4d6-5d05a99c84ff
http://weblog.ikvm.net/PermaLink.aspx?guid=8a457a80-1e5f-4182-8f78-b2cd67845553
http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68

Regards,
Jeroen

------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: IKVM and classloaders

by Corneil du Plessis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I must apologise I did eventually find the right solution and now I have multiple dlls with classes being loaded properly and it works the same on JVM and IKVM.

On Tue, 2009-08-18 at 16:35 +0200, Jeroen Frijters wrote:
Corneil du Plessis wrote:
> It seems that calls to java.lang.Class.forName fails when the classes
> are in a different assembly.

That's not quite correct. What happens is that Class.forName(String) uses the caller's ClassLoader (just like in Java), if that class loader or any of the class loaders it delegates to cannot find the class, then the Class.forName() fails.

For more on class loaders in IKVM.NET please read:
http://weblog.ikvm.net/PermaLink.aspx?guid=4e0b7f7c-6f5d-42a3-a4d6-5d05a99c84ff
http://weblog.ikvm.net/PermaLink.aspx?guid=8a457a80-1e5f-4182-8f78-b2cd67845553
http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68

Regards,
Jeroen


------------------------------------------------------------------------------
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
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers