Discussion:
[Ikvm-developers] java -jar works, but ikvm -jar fails to find dependencies
Paul Chambre
2016-11-09 20:07:08 UTC
Permalink
Hi folks,

I'm trying to convert a jar to a dll, but that's failing to
load/initialize. To narrow down the problem, I tried running the jar from
java and from ikvm.

I have to pass a number of -D properties to the jvm to run the jar. I put
these into a batch file and made two copies... one using java and the other
using ikvm. The java version runs correctly, but the ikvm version fails
with class not found exceptions for core runtime items from rt.jar (e.g.
sun.nio.ch.WindowsSelectorImpl).

The ikvm version is 8.1.5717.
The JRE version is 1.8.0_60.

I am running in my C# app's bin\debug directory, with all of the jar files,
and all of the ikvm bin files, copied locally. Copying rt.jar locally did
not make a difference.

Thanks,
Paul
Paul Chambre
2016-11-10 18:43:39 UTC
Permalink
By the way, the failure to find the class is being initated by
Class.forName().

I also tried extracting rt.jar and adding the extracted path to -cp. That
didn't help either.
Post by Paul Chambre
Hi folks,
I'm trying to convert a jar to a dll, but that's failing to
load/initialize. To narrow down the problem, I tried running the jar from
java and from ikvm.
I have to pass a number of -D properties to the jvm to run the jar. I put
these into a batch file and made two copies... one using java and the other
using ikvm. The java version runs correctly, but the ikvm version fails
with class not found exceptions for core runtime items from rt.jar (e.g.
sun.nio.ch.WindowsSelectorImpl).
The ikvm version is 8.1.5717.
The JRE version is 1.8.0_60.
I am running in my C# app's bin\debug directory, with all of the jar
files, and all of the ikvm bin files, copied locally. Copying rt.jar
locally did not make a difference.
Thanks,
Paul
--
Paul Chambre

Senior Solutions Architect
(719) 465-6097

Illumon - Big Value From Big Data
Volker Berlin
2016-11-10 19:55:18 UTC
Permalink
Hi Paul,

The class sun.nio.ch.WindowsSelectorImpl is not part of the IKVM. Do you
have a stacktrace?

Volker
Post by Paul Chambre
By the way, the failure to find the class is being initated by
Class.forName().
I also tried extracting rt.jar and adding the extracted path to -cp.
That didn't help either.
Hi folks,
I'm trying to convert a jar to a dll, but that's failing to
load/initialize. To narrow down the problem, I tried running the
jar from java and from ikvm.
I have to pass a number of -D properties to the jvm to run the
jar. I put these into a batch file and made two copies... one
using java and the other using ikvm. The java version runs
correctly, but the ikvm version fails with class not found
exceptions for core runtime items from rt.jar (e.g. sun.nio.ch
<http://sun.nio.ch>.WindowsSelectorImpl).
The ikvm version is 8.1.5717.
The JRE version is 1.8.0_60.
I am running in my C# app's bin\debug directory, with all of the
jar files, and all of the ikvm bin files, copied locally. Copying
rt.jar locally did not make a difference.
Thanks,
Paul
--
Paul Chambre
Senior Solutions Architect
(719) 465-6097
Illumon - Big Value From Big Data
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Ikvm-developers mailing list
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
Paul Chambre
2016-11-10 20:01:46 UTC
Permalink
[Nov 10 12:49:48.540] INFO - Static: Starting FastNIODriver Scheduler:
threads: 2, maxThreads: 1250, workTimeout/spinsOnSelect: 100,
spinsUntilPark: 1000, doSpinSelect: false
Exception in thread "main" com.walleyetrading.base.verify.AssertionFailure:
Assertion failed: asserted java.lang.ClassNotFoundException is never
caught, instead
java.lang.ClassNotFoundException(sun.nio.ch.WindowsSelectorImpl) caught.
at com.walleyetrading.base.verify.Assert.fail(Assert.java:81)
at
com.walleyetrading.base.verify.Assert.exceptionNeverCaught(Assert.java:199)
at
com.walleyetrading.io.NioUtil.reduceSelectorGarbage(NioUtil.java:90)
at
com.fishlib.net.impl.nio.FastNIODriver.createDrivers(FastNIODriver.java:67)
at
com.fishlib.net.impl.nio.FastNIODriver.createDrivers(FastNIODriver.java:55)
at com.fishlib.net.impl.nio.NIODriver.init(NIODriver.java:109)
at com.fishlib.net.impl.nio.NIODriver.init(NIODriver.java:99)
at com.fishlib.net.CommBase.getScheduler(CommBase.java:336)
at
com.walleyetrading.walleyedb.tables.remotequery.QueryDispatcherConnectionImpl.<init>(QueryDispatcherConnectionImpl.java:52)
at
com.walleyetrading.walleyedb.tables.remotequery.QueryDispatcherConnectionImpl.getConnection(QueryDispatcherConnectionImpl.java:382)
at
com.walleyetrading.walleyedb.tables.remotequery.QueryDispatcherConnectionImpl.getConnection(QueryDispatcherConnectionImpl.java:359)
at
com.walleyetrading.walleyedb.tables.remotequery.QueryDispatcherConnectionImpl.getConnection(QueryDispatcherConnectionImpl.java:351)
at
com.walleyetrading.walleyedb.tables.remotequery.RemoteQueryClient.<init>(RemoteQueryClient.java:76)
at
com.walleyetrading.walleyedb.tables.remotequery.RemoteQueryClient.<init>(RemoteQueryClient.java:73)
at
com.illumon.integrations.common.IrisDbGroovySession.<init>(IrisDbGroovySession.java:73)
at irisnet.Solution.main(Solution.java:16)
Caused by: java.lang.ClassNotFoundException: sun.nio.ch.WindowsSelectorImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:440)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:375)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:493)
at IKVM.Internal.ClassLoaderWrapper.LoadClassImpl(Unknown Source)
at IKVM.Internal.ClassLoaderWrapper.LoadClass(Unknown Source)
at Java_java_lang_Class.forName0(Unknown Source)
at java.lang.Class.forName(Class.java:302)
at
com.walleyetrading.io.NioUtil.reduceSelectorGarbage(NioUtil.java:58)
... 13 more

The odd thing is that, shortly before the failing call, we call:

Class<?> selectorImplClass=Class.forName("sun.nio.ch.SelectorImpl");
Require.instanceOf(selector, "selector", selectorImplClass);


and that suceeeds.





On Thu, Nov 10, 2016 at 12:55 PM, Volker Berlin <
Post by Volker Berlin
Hi Paul,
The class sun.nio.ch.WindowsSelectorImpl is not part of the IKVM. Do you
have a stacktrace?
Volker
By the way, the failure to find the class is being initated by
Class.forName().
I also tried extracting rt.jar and adding the extracted path to -cp. That
didn't help either.
Post by Paul Chambre
Hi folks,
I'm trying to convert a jar to a dll, but that's failing to
load/initialize. To narrow down the problem, I tried running the jar from
java and from ikvm.
I have to pass a number of -D properties to the jvm to run the jar. I put
these into a batch file and made two copies... one using java and the other
using ikvm. The java version runs correctly, but the ikvm version fails
with class not found exceptions for core runtime items from rt.jar (e.g.
sun.nio.ch.WindowsSelectorImpl).
The ikvm version is 8.1.5717.
The JRE version is 1.8.0_60.
I am running in my C# app's bin\debug directory, with all of the jar
files, and all of the ikvm bin files, copied locally. Copying rt.jar
locally did not make a difference.
Thanks,
Paul
--
Paul Chambre
Senior Solutions Architect
(719) 465-6097
Illumon - Big Value From Big Data
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
------------------------------------------------------------
------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Ikvm-developers mailing list
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
--
Paul Chambre

Senior Solutions Architect
(719) 465-6097

Illumon - Big Value From Big Data
Volker Berlin
2016-11-10 20:31:29 UTC
Permalink
Hi Paul,

Why you call this? This is specific to one Java implementation. This is
a private class of the Oracle JDK. This will not work with IKVM. IKVM
use the implementation of the .NET framework for IO operations.

Volker
Post by Paul Chambre
Class<?> selectorImplClass=Class.forName("sun.nio.ch.SelectorImpl");
Require.instanceOf(selector,"selector", selectorImplClass);
and that suceeeds.
Paul Chambre
2016-11-10 20:49:00 UTC
Permalink
Our application, so far, is specific to one Java implementation. In this
case, we're calling into the selectors to modify their fields collections
to reduce garbage generated by the selectors' iterators.

Is there something I can look at at runtime, like java.vendor, to
distinguish that I'm running under ikvm and maybe skip this (and probably
other) optimizations?
Post by Volker Berlin
Hi Paul,
Why you call this? This is specific to one Java implementation. This is a
private class of the Oracle JDK. This will not work with IKVM. IKVM use the
implementation of the .NET framework for IO operations.
Volker
Class<?> selectorImplClass=Class.forName("sun.nio.ch.SelectorImpl");
Require.instanceOf(selector, "selector", selectorImplClass);
and that suceeeds.
------------------------------------------------------------
------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Ikvm-developers mailing list
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
--
Paul Chambre

Senior Solutions Architect
(719) 465-6097

Illumon - Big Value From Big Data
Paul Chambre
2016-11-10 22:30:00 UTC
Permalink
I modified the call to skip out if the java.vendor property doesn't start
with "Oracle". That allows my jar to run under ikvm.

In C#, though, it still fails to load. I get what looks like a partial
stack trace:

The type initializer for
'com.walleyetrading.common.service.ServiceFactoryImpl' threw an exception.
at irisnet.Solution..ctor() at
com.illumon.integrations.common.IrisDbGroovySession..ctor(String
description, Boolean initializeStandaloneClientServices) at
com.illumon.integrations.common.IrisDbGroovySession.initializeStandaloneClientServices()
at
com.walleyetrading.common.service.ServiceFactory.setServiceProfile(String
profileName) at
com.walleyetrading.common.service.ServiceFactory.getFactoryInstance() at
com.walleyetrading.common.service.ServiceFactoryImpl..ctor()org.apache.log4j.LoggerThe
type initializer for 'com.walleyetrading.common.service.ServiceFactoryImpl'
threw an exception.

Thanks again for the help,
Paul
Post by Paul Chambre
Our application, so far, is specific to one Java implementation. In this
case, we're calling into the selectors to modify their fields collections
to reduce garbage generated by the selectors' iterators.
Is there something I can look at at runtime, like java.vendor, to
distinguish that I'm running under ikvm and maybe skip this (and probably
other) optimizations?
On Thu, Nov 10, 2016 at 1:31 PM, Volker Berlin <
Post by Volker Berlin
Hi Paul,
Why you call this? This is specific to one Java implementation. This is a
private class of the Oracle JDK. This will not work with IKVM. IKVM use the
implementation of the .NET framework for IO operations.
Volker
Class<?> selectorImplClass=Class.forName("sun.nio.ch.SelectorImpl");
Require.instanceOf(selector, "selector", selectorImplClass);
and that suceeeds.
------------------------------------------------------------
------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Ikvm-developers mailing list
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
--
Paul Chambre
Senior Solutions Architect
(719) 465-6097
Illumon - Big Value From Big Data
--
Paul Chambre

Senior Solutions Architect
(719) 465-6097

Illumon - Big Value From Big Data
Volker Berlin
2016-11-10 23:08:36 UTC
Permalink
Which exception occur? I can not see it in your stack.

Volker
Post by Paul Chambre
I modified the call to skip out if the java.vendor property doesn't
start with "Oracle". That allows my jar to run under ikvm.
In C#, though, it still fails to load. I get what looks like a partial
The type initializer for
'com.walleyetrading.common.service.ServiceFactoryImpl' threw an exception.
at irisnet.Solution..ctor() at
com.illumon.integrations.common.IrisDbGroovySession..ctor(String
description, Boolean initializeStandaloneClientServices) at
com.illumon.integrations.common.IrisDbGroovySession.initializeStandaloneClientServices()
at
com.walleyetrading.common.service.ServiceFactory.setServiceProfile(String
profileName) at
com.walleyetrading.common.service.ServiceFactory.getFactoryInstance()
at
com.walleyetrading.common.service.ServiceFactoryImpl..ctor()org.apache.log4j.LoggerThe
type initializer for
'com.walleyetrading.common.service.ServiceFactoryImpl' threw an exception.
Thanks again for the help,
Paul
Our application, so far, is specific to one Java implementation.
In this case, we're calling into the selectors to modify their
fields collections to reduce garbage generated by the selectors'
iterators.
Is there something I can look at at runtime, like java.vendor, to
distinguish that I'm running under ikvm and maybe skip this (and
probably other) optimizations?
On Thu, Nov 10, 2016 at 1:31 PM, Volker Berlin
Hi Paul,
Why you call this? This is specific to one Java
implementation. This is a private class of the Oracle JDK.
This will not work with IKVM. IKVM use the implementation of
the .NET framework for IO operations.
Volker
Post by Paul Chambre
Class<?> selectorImplClass=Class.forName("sun.nio.ch.SelectorImpl");
Require.instanceOf(selector,"selector", selectorImplClass);
and that suceeeds.
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access
to Intel Xeon Phi processor-based developer platforms. With
one year of Intel Parallel Studio XE. Training and support
from Colfax. Order your platform today.
http://sdm.link/xeonphi
_______________________________________________
Ikvm-developers mailing list
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
<https://lists.sourceforge.net/lists/listinfo/ikvm-developers>
--
Paul Chambre
Senior Solutions Architect
(719) 465-6097 <tel:%28719%29%20465-6097>
Illumon - Big Value From Big Data
--
Paul Chambre
Senior Solutions Architect
(719) 465-6097
Illumon - Big Value From Big Data
Paul Chambre
2016-11-10 23:22:51 UTC
Permalink
It's a noob issue. I didn't realize that ikvmc doesn't evaluate dependency
jars and can't use them at runtime. The problem now is that I have like 60
jars that my app seems to depend on, and, if I pass them all into ikvmc, it
exceeds the limits of the zip library.

In this case, though, it was complaining about log4j, and, after I added
the log4j jar file, I got a version that moves on to throwing an exception
at the next missing jar file...

On the other hand, if create dlls for each of my dependency jar files, and
add references to those in my C# app, will that work as well?
Post by Volker Berlin
Which exception occur? I can not see it in your stack.
Volker
I modified the call to skip out if the java.vendor property doesn't start
with "Oracle". That allows my jar to run under ikvm.
In C#, though, it still fails to load. I get what looks like a partial
The type initializer for 'com.walleyetrading.common.service.ServiceFactoryImpl'
threw an exception.
at irisnet.Solution..ctor() at com.illumon.integrations.
common.IrisDbGroovySession..ctor(String description, Boolean
initializeStandaloneClientServices) at com.illumon.integrations.
common.IrisDbGroovySession.initializeStandaloneClientServices() at
com.walleyetrading.common.service.ServiceFactory.setServiceProfile(String
profileName) at com.walleyetrading.common.service.ServiceFactory.getFactoryInstance()
at com.walleyetrading.common.service.ServiceFactoryImpl..
ctor()org.apache.log4j.LoggerThe type initializer for
'com.walleyetrading.common.service.ServiceFactoryImpl' threw an exception.
Thanks again for the help,
Paul
Post by Paul Chambre
Our application, so far, is specific to one Java implementation. In this
case, we're calling into the selectors to modify their fields collections
to reduce garbage generated by the selectors' iterators.
Is there something I can look at at runtime, like java.vendor, to
distinguish that I'm running under ikvm and maybe skip this (and probably
other) optimizations?
On Thu, Nov 10, 2016 at 1:31 PM, Volker Berlin <
Post by Volker Berlin
Hi Paul,
Why you call this? This is specific to one Java implementation. This is
a private class of the Oracle JDK. This will not work with IKVM. IKVM use
the implementation of the .NET framework for IO operations.
Volker
Class<?> selectorImplClass=Class.forName("sun.nio.ch.SelectorImpl");
Require.instanceOf(selector, "selector", selectorImplClass);
and that suceeeds.
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon
Phi processor-based developer platforms. With one year of Intel Parallel
Studio XE. Training and support from Colfax. Order your platform today.
http://sdm.link/xeonphi _______________________________________________
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
--
Paul Chambre
Senior Solutions Architect
(719) 465-6097
Illumon - Big Value From Big Data
--
Paul Chambre
Senior Solutions Architect
(719) 465-6097
Illumon - Big Value From Big Data
------------------------------------------------------------
------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Ikvm-developers mailing list
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
--
Paul Chambre

Senior Solutions Architect
(719) 465-6097

Illumon - Big Value From Big Data
Loading...