teavm
teavm copied to clipboard
Failed to execute goal org.teavm:teavm-maven-plugin Index 0 out of bounds for length 0
Hi! I'm getting the following error
[ERROR] Failed to execute goal org.teavm:teavm-maven-plugin:0.6.1:compile (web-client) on project solomonoffcli: Unexpected error occurred: Index 0 out of bounds for length 0 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.teavm:teavm-maven-plugin:0.6.1:compile (web-client) on project solomonoffcli: Unexpected error occurred
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unexpected error occurred
at org.teavm.maven.TeaVMCompileMojo.executeWithBuilder (TeaVMCompileMojo.java:295)
at org.teavm.maven.TeaVMCompileMojo.execute (TeaVMCompileMojo.java:238)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at org.teavm.model.classes.VirtualTableBuilder.buildResultForClass (VirtualTableBuilder.java:367)
at org.teavm.model.classes.VirtualTableBuilder.buildResultForClass (VirtualTableBuilder.java:412)
at org.teavm.model.classes.VirtualTableBuilder.buildResultForClasses (VirtualTableBuilder.java:353)
at org.teavm.model.classes.VirtualTableBuilder.buildResult (VirtualTableBuilder.java:339)
at org.teavm.model.classes.VirtualTableBuilder.build (VirtualTableBuilder.java:86)
at org.teavm.backend.wasm.WasmTarget.createVirtualTableProvider (WasmTarget.java:794)
at org.teavm.backend.wasm.WasmTarget.emit (WasmTarget.java:334)
at org.teavm.vm.TeaVM.build (TeaVM.java:419)
at org.teavm.tooling.TeaVMTool.generate (TeaVMTool.java:414)
at org.teavm.tooling.builder.InProcessBuildStrategy.build (InProcessBuildStrategy.java:247)
at org.teavm.maven.TeaVMCompileMojo.executeWithBuilder (TeaVMCompileMojo.java:289)
at org.teavm.maven.TeaVMCompileMojo.execute (TeaVMCompileMojo.java:238)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
It appears when I set
<plugin>
<groupId>org.teavm</groupId>
<artifactId>teavm-maven-plugin</artifactId>
<version>${teavm.version}</version>
<executions>
<execution>
<id>web-client</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<targetType>WEBASSEMBLY</targetType> <--- this line
and my Java code looks as follows:
public static void main(String[] args) {
}
@Export(name = "thePurposeOfLife")
public static int getThePurposeOfLife() {
return 43;
}
Any suggestions what to do about it? Thanks for any help in advance!
Same problem. I was testing quarkus and teavm integration. With 0.5.1 no problem but with 0.6.1 or dev builds, no chance. Thanks for any help.
With 0.7.0-SNAPSHOT.It works, if i add the lines in team-core > VirtualTableBuilder (line ~367):
private void buildResultForClass(String className, Context context, VirtualTable parent) {
TableBuilder table = tables.get(className);
ClassReader cls = classes.get(className);
if(className.equals("java.lang.Throwable")) {
return;
}
..
The problem comes from: method: fillInStackTrace()Ljava/lang/Throwable; className: java.lang.Throwable
I cannot suggest a correction because I do not know the framework well enough but in any case the problem is here.
With 0.7.0-SNAPSHOT.It works, if i add the lines in team-core > VirtualTableBuilder (line ~367):
Can you provide the code you are trying to compile with TeaVM? Also, what's the reason to use Wasm instead of JS?
I was looking for a good framework to compile webassembly from java. The code:
https://github.com/jbrionne/quarkus-webassembly-jdk11
Just exploring !
@jbrionne but what is the purpose of this 'good framework'? What's the purpose of compiling Java to Wasm?
It is only in the context of a simple personal technological watch. The webassembly could bring interesting elements in terms of security compared to docker / podman. There is the "Krustlet" project which uses webassembly with kubernetes for example. And why 'java', just because I have a good background on it.
@konsoletyper You don't seem very enamored with wasm. I'm running into the same issue reported here. I'm exploring using wasm to write user defined functions for a database and wasm provides a nice polygot and sandboxed solution. It seems like it it would be a lot better than something like this https://github.com/linkedin/transport
I could just write them in Rust but the database is in Java and it would be nice to offer them a way to write functions in Java as well.