ikvmnet / ikvm

A Java Virtual Machine and Bytecode-to-IL Converter for .NET
Other
1.15k stars 109 forks source link

Stuck on Eclipse BaSyx SDK #530

Closed arteeh closed 1 month ago

arteeh commented 1 month ago

My goal is to use the BaSyx SDK from a C# application. Created a .net 8 console app for testing IKVM.

My references look like this:

<ItemGroup>
        <PackageReference Include="IKVM" Version="8.8.0" />
        <PackageReference Include="IKVM.Image.JDK" Version="8.8.0" />
        <PackageReference Include="IKVM.Image.JRE" Version="8.8.0" />
        <PackageReference Include="IKVM.Maven.Sdk" Version="1.6.9" />
        <IkvmReference Include="basyx.sdk-1.5.1.jar" />
        <!--<MavenReference Include="org.eclipse.basyx:basyx.sdk" Version="1.5.1" />-->
</ItemGroup>

At first I tried the MavenReference. When I try to build, I get the following error:

Click to open `IKVM.Maven.Sdk.targets(96, 9): Could not find artifact org.apache.logging.log4j:log4j-api-java9:pom:2.11.2 in central (https://repo1.maven.org/maven2/)` `IKVM.Maven.Sdk.targets(96, 9): Could not find artifact org.apache.logging.log4j:log4j-api-java9:pom:2.11.2 in Eclipse Paho Repo (https://repo.eclipse.org/content/repositories/paho-releases/)` `IKVM.Maven.Sdk.targets(96, 9): Could not find artifact org.apache.logging.log4j:log4j-api-java9:pom:2.11.2 in jboss (https://repository.jboss.org/nexus/content/groups/public/)` `IKVM.Maven.Sdk.targets(96, 9): Could not find artifact org.apache.logging.log4j:log4j-api-java9:pom:2.11.2 in redhat (https://maven.repository.redhat.com/ga/)` `IKVM.Tasks.targets(31, 9): warning IKVMC0127: Assembly "C:\Users\madejong\AppData\Local\Temp\ikvm\cache\1\b36bfc46e628e6eb84c1829b8eed5091\jakarta.activation.dll" is ignored as previously loaded assembly "C:\Users\madejong\AppData\Local\Temp\ikvm\cache\1\447cc2e596282cc3a2e9b707bc98c2d2\jakarta.activation.dll" has the same identity "jakarta.activation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58"` `IKVM.Tasks.targets(31, 9): warning IKVMC0132: Duplicate assembly reference "jakarta.activation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58"` `IKVM.Tasks.targets(31, 9): fatal error IKVMC5045: Link error: Method "org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.isReadable(Ljava.lang.Class;Ljava.lang.reflect.Type;[Ljava.lang.annotation.Annotation;Ljavax.ws.rs.core.MediaType;)Z" has an argument type "javax.ws.rs.core.MediaType, java.ws.rs, Version=2.0.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58" and tries to override method "com.fasterxml.jackson.jaxrs.base.ProviderBase.isReadable(Ljava.lang.Class;Ljava.lang.reflect.Type;[Ljava.lang.annotation.Annotation;Ljavax.ws.rs.core.MediaType;)Z" that has an argument type "javax.ws.rs.core.MediaType, java.ws.rs, Version=2.1.0.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58"` `IKVM.Tasks.targets(31, 9): [MSB4181] The "IkvmCompiler" task returned false but did not log an error.`

I found this similar issue about log4j-api-java9 but it did not help me any further.

Then I tried IkvmReference, where i downloaded basyx.sdk-1.5.1.jar from the Assets section on this page. It builds fine and in Rider I can see "basyx.sdk" pop up as an implicit assembly, but then I can't seem to use anything. If I try any usings like using org.eclipse.basyx.aas.registration.api;, I just get errors that the namespace 'eclipse' does not exist in the namespace 'org'.

In a page in the BaSyx documentation I found that Java 11 is a requirement for building the SDK. By looking around the github issues here I found that IKVM only supports Java versions up to 8. Could this be the cause and will I not be able to run BaSyx SDK on IKVM?

arteeh commented 1 month ago

I also found the comment about multi-release feature in the JDK 9 issue, which may relate to the MavenReference not working.

I'll close this since I'm somewhat confident that the cause is IKVM only supporting old versions of Java, and BaSyx relying on newer features of Java.