Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance not found; using Maven #40

Open
Tsangares opened this issue Jul 29, 2020 · 2 comments
Open

Instance not found; using Maven #40

Tsangares opened this issue Jul 29, 2020 · 2 comments
Assignees
Labels
🐞 bug Something isn't working
Projects

Comments

@Tsangares
Copy link

Describe the bug

I use maven and not gradle so I built the jar as described in the readme, then I installed the jar using maven cli:

mvn install:install-file -Dfile=wasmer-jni-amd64-linux-0.2.0.jar -DgroupId=org.wasmer -DartifactId=wasmer -Dversion=0.2.0 -Dpackaging=jar

This puts it in my local maven repo. Then I added it as a dependency:

  <dependency>
      <groupId>org.wasmer</groupId>
      <artifactId>wasmer</artifactId>
      <version>0.2.0</version>
    </dependency>

But when I run my code using the example SimpleExample.java almost exactly I recieve the error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/wasmer/Instance
    at com.clopen.Clopen.main(Clopen.java:15)
Caused by: java.lang.ClassNotFoundException: org.wasmer.Instance
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

Pretty much it compiles, using the wasmer-jni-amd64-linux-0.2.0.jar as a dependency but cannot find the org.wasmer.Instance object.

Maybe a solution to this is to add the program to the maven repository. I cannot use gradle because this test example of using rust to compile to wasm to run in java will be incorporated into a much larger maven project.

@Tsangares Tsangares added the 🐞 bug Something isn't working label Jul 29, 2020
@Hywan
Copy link
Contributor

Hywan commented Aug 17, 2020

Thanks for the bug report.

Did you inspect the content of the JAR? What do you have inside? I get this:

$ jar tf wasmer-jni-amd64-darwin-0.2.0.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/wasmer/
org/wasmer/Native.class
org/wasmer/exports/
org/wasmer/exports/Export.class
org/wasmer/exports/Function.class
org/wasmer/Instance.class
org/wasmer/Exports.class
org/wasmer/Memory.class
org/wasmer/Module.class
org/wasmer/native/
org/wasmer/native/darwin-amd64/
org/wasmer/native/darwin-amd64/libwasmer_jni.dylib

@Hywan Hywan self-assigned this Aug 17, 2020
@Hywan Hywan added this to 📬 Backlog in Kanban via automation Aug 17, 2020
@Hywan Hywan moved this from 📬 Backlog to 🌱 In progress in Kanban Aug 17, 2020
@zacharywhitley
Copy link

I think I found the source of the problem os.arch isn't consistent and different jvm's report different values. My mac is reporting "x86_64" I think just checking for both values would fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
Kanban
  
🌱 In progress
Development

No branches or pull requests

3 participants