processing of -javaagent failed

Help
2010-10-27
2013-04-17
  • Hi,

    I started to use jip1.2 with jdk 1.5.0_03

    I used the following on the commandline:

    $JAVA_HOME/bin/java '-javaagent:/home/eraonel/pub/jip-1.2/profile/profile.jar' -Dprofile.properties=/home/eraonel/pub/jip-1.2/profile/roam.profile.properties -classpath $CLASSPATH org.junit.runner.JUnitCore  se.ericsson.wcdma.rnc.roam.testenv.testcases.generated.AllTests

    Then I get the following ouput:

    Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:133)
    FATAL ERROR in native method: processing of -javaagent failed

    I googled and found the following:

    http://www.javalobby.org/java/forums/t19309.html

    It states the following ( about manifest):

    "This sure looks like a classpath problem (and boy did I think it was for a *long* time working on this article) before I found this bug: Bug 6274276 about the problem i just described. You *must* have the mandatory one space before the class name, and *no* spaces after the classname - only a carriage return. Also, remember that the manifest should end in a blank line (hence why the manifest above has extra blank space below it). "

    Could
        

     
  • Sorry I missed the last part:

    Could this be the reason that it is failing or is it the jvm 1.5.0_03 manifest parser that is buggy?

    br,

    //mike

     
  • Andrew Wilcox
    Andrew Wilcox
    2010-10-27

    Hi Mike,

    I recall running into this issue when I first started working on JIP. The current manifest file conforms to the article you quoted except that it ends in a new line rather than a carriage return. I seriously doubt that \n v. \r is your issue, but you can always download the source, change the manifest, do a build and see if that helps.

    Another possibility is that it's truly a class version problem. Getting the source and doing a build in your environment would fix that if that's really the issue.

    I noticed that you put single quotes around the javaagent parameter:

    '-javaagent:/home/eraonel/pub/jip-1.2/profile/profile.jar'

    You shouldn't need the quotes, so you might try invoking Java without them.

    Although it probably won't help, you can try running java with

    -verbose:class

    This should give you an indication if any of the JIP classes are getting loaded.

    If any of these things fixes your problem, please post the solution for the benefit of others. If none of these fixes your issue, let me know and we'll do another round of trouble shooting.

    Andrew.

     
  • Hi,

    I used the source and compiled it with jdk 1.5.0_03 that I use. And now it works!

    Thanks for help.