This page is no longer maintained — Please continue to the home page at www.scala-lang.org

scala/collection/mutable/ArrayBuffer + IntelliJIDea ClassFormatException

3 replies
edmondo1984
Joined: 2011-09-14,
User offline. Last seen 28 weeks 3 days ago.
Dear All,

I am trying to launch a scala executable from Intellij Idea 10.5.2. Normally Idea wraps the execution around its CommandLineWrapper, but since I want to do some profiling I have removed the dynamic classpath option from the ide.

Now, when I launch my program I obtain the following exception

Exception in thread "main" java.lang.ClassFormatError: Invalid index 3 in LocalVariableTable in class file scala/collection/mutable/ArrayBuffer
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)


Do you have any idea on what does it mean and how to solve it?
Thank you for your unvaluable help.

Best Regards
Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: scala/collection/mutable/ArrayBuffer + IntelliJIDea ClassFo
On Wed, Oct 12, 2011 at 9:29 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
I am trying to launch a scala executable from Intellij Idea 10.5.2. Normally Idea wraps the execution around its CommandLineWrapper, but since I want to do some profiling I have removed the dynamic classpath option from the ide.

Now, when I launch my program I obtain the following exception

Exception in thread "main" java.lang.ClassFormatError: Invalid index 3 in LocalVariableTable in class file scala/collection/mutable/ArrayBuffer
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
You should be able to see the command line, including a references to the scala-library.jar. Run this directly from the command line to reproduce the problem independently from the IDE. Be explicity about which 'java' executable you are using. Then you should post a transcript of that session, showing the command line and the error together.
-jason



edmondo1984
Joined: 2011-09-14,
User offline. Last seen 28 weeks 3 days ago.
Re: scala/collection/mutable/ArrayBuffer + IntelliJIDea ClassFo
I got it guys...it is because of javaagent

-javaagent:D:\JRat\shiftone-jrat-1-beta1\shiftone-jrat.jar

which I attached for profiling....

Now the question changed: can you suggest a method of profiling a scala app ?:)) With VisualVM, for example, is there a way to start a java/scala app and attach it from the beginning? Or you can just attach to a running instance?

Best Regards




2011/10/12 Jason Zaugg <jzaugg@gmail.com>
On Wed, Oct 12, 2011 at 9:29 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
I am trying to launch a scala executable from Intellij Idea 10.5.2. Normally Idea wraps the execution around its CommandLineWrapper, but since I want to do some profiling I have removed the dynamic classpath option from the ide.

Now, when I launch my program I obtain the following exception

Exception in thread "main" java.lang.ClassFormatError: Invalid index 3 in LocalVariableTable in class file scala/collection/mutable/ArrayBuffer
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
You should be able to see the command line, including a references to the scala-library.jar. Run this directly from the command line to reproduce the problem independently from the IDE. Be explicity about which 'java' executable you are using. Then you should post a transcript of that session, showing the command line and the error together.
-jason




Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: scala/collection/mutable/ArrayBuffer + IntelliJIDea ClassFo
On Wed, Oct 12, 2011 at 9:39 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
I got it guys...it is because of javaagent

-javaagent:D:\JRat\shiftone-jrat-1-beta1\shiftone-jrat.jar

which I attached for profiling....

Now the question changed: can you suggest a method of profiling a scala app ?:)) With VisualVM, for example, is there a way to start a java/scala app and attach it from the beginning? Or you can just attach to a running instance?

I use and recommend YourKit [1]. It can connect to a running application that is started with the correct command line; or more conveniently, it integrates into IntelliJ so you can execute 'Profile' in addition to 'Run' and 'Debug'.
-jason
[1] http://www.yourkit.com/

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland