question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to execute goal org.teavm:teavm-maven-plugin Index 0 out of bounds for length 0

See original GitHub issue

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!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
konsoletypercommented, Dec 30, 2020

@jbrionne but what is the purpose of this ‘good framework’? What’s the purpose of compiling Java to Wasm?

0reactions
zacharywhitleycommented, Mar 18, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Index 0 out of bounds for length 0 [duplicate] - Stack Overflow
You are executing this java class without arguments. In that case, args[0] does now exist, and thus the Exception with Error message.
Read more >
[Solved] Index 0 out of bounds for length 0 - CodeProject
The mission is to return a new array only with all the number that not equals to the number I chose. but i...
Read more >
How to Fix the Array Index Out Of Bounds Excepiton in Java
It occurs when a program attempts to access an invalid index in an array i.e. an index that is less than 0, or...
Read more >
"Index 0 out of bounds for length 0" error message.
I attempted an exercise to learn how to program Quadratic formulas, but keep getting an error message when I run the program that...
Read more >
'System.ListException: List index out of bounds' error
If we attempt to access an element at row 0, The code will throw an error if no data exist at row 0....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found