• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Won't Fix
  • DGC
  • drb
  • Reporter: horkhe
  • November 13, 2008
  • 0
  • Watchers: 0
  • April 10, 2009
  • December 19, 2008

Description

If JAVA_HOME is missing from the system environment than dso-java fails with a meaningless message:

Starting Terracotta client… 2008-11-11 13:20:28,712 INFO - Terracotta 2.7.0, as of 20081001-101002 (Revision 10251 by cruise@WXPMO0 from 2.7) 2008-11-11 13:20:29,462 INFO - Configuration loaded from the file at ‘c:\Program Files\AvroraTi\tc-config.xml’. 2008-11-11 13:20:29,774 INFO - Log file: ‘c:\Program Files\AvroraTi\terracotta\client-logs\terracotta-client.log’. 2008-11-11 13:20:35,286 INFO - Statistics buffer: ‘c:\Program Files\AvroraTi\terracotta\client-statistics\20081111132034786’. 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(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Comments

Fiona OShea 2008-11-13

Can we do the following

  1. Check to see if JAVA_HOME is valid
  2. Give a clear error message.

Juris Galang 2008-12-19

The following is an exchange between Juris, TimEck, and Alex Miller regarding the issue (most recent response at the top):


Well, I think I would update the jira with the JAVA_HOME stuff and also the suggested likely problem of java main class being compiled with a different jdk. It’s probably worth trying that scenario to see if you can duplicate the error. If so, I’d recommend we close as “won’t fix”.

On Dec 18, 2008, at 3:22 PM, Juris Galang wrote:

It’s not our place to try to make that any friendlier (the same thing would happen w/o TC).

I think is spot-on.

BTW, we do throw an error is JAVA_HOME is not set, here’s a couple of examples of what happens:

./start-demo-server.sh /Users/jgalang/Code/Terracotta/dso/2.7/code/base/build/dist/terracotta-2.7.3-snapshot/samples/../bin/start-tc-server.sh: the JAVA_HOME environment variable is not defined correctly

./bin/dso-env.sh ./bin/dso-env.sh: the JAVA_HOME environment variable is not defined correctly

I wonder if the user somehow has JAVA_HOME defined and is simply overwriting it with the appropriate version.

On Dec 18, 2008, at 1:12 PM, Tim Eck wrote:

Sounds good. If one of you can find them and link them, that would be good.

What do you think about my assessment of the actual problem the user was experiencing?

—–Original Message—– From: Alex Miller [mailto:[email protected]] Sent: Thursday, December 18, 2008 1:11 PM To: Tim Eck Cc: ‘Juris Galang’ Subject: Re: [Transparency] [JIRA] Assigned: (CDV-1050) dso-java throws UnsupportedClassVersionError when JAVA_HOME is not defined

There are (I think) some separate jiras regarding JAVA_HOME in our scripts. If it is required, and you haven’t set it, then we should throw an error message.

On Dec 18, 2008, at 3:04 PM, Tim Eck wrote:

I had some thoughts on this, but after reading the bug again, I’m not sure this is our problem really. I think maybe his java main class was built with a later VM than the he was running with. It’s not our place to try to make that any friendlier (the same thing would happen w/o TC).

Do we require JAVA_HOME to be defined for us in our scripts? That might already be the case, I’m not sure though.

The person filing the bug seems to think he gets that error iff JAVA_HOME isn’t defined. Does that add up?

—–Original Message—– From: Juris Galang [mailto:[email protected]] Sent: Thursday, December 18, 2008 10:56 AM To: Tim Eck Cc: Juris Galang; Alex Miller Subject: Re: [Transparency] [JIRA] Assigned: (CDV-1050) dso-java throws UnsupportedClassVersionError when JAVA_HOME is not defined

No idea yet what to do with it - if you’ve got suggestions please comment on the JIRA.

On Dec 18, 2008, at 10:42 AM, Tim Eck wrote:

Before you “fix” this, can you let us know exactly what you’re going to do? thx


Juris Galang 2008-12-19

The error is because the user was likely using an older VM version. The JAVA_HOME is probably always set - it was just being overwritten with the path to the appropriate VM version.

To recreate:

  1. Set JAVA_HOME to point to a 1.5 or 1.6 installation.
  2. Download the kit (or checkout and do a ./tcbuild dist)
  3. Go to the sample/ directory of the kit.
  4. do ./start-demo-server.sh — and the server will start.
  5. Press Ctrl+C to stop the server.
  6. Now set JAVA_HOME to point to a 1.4 insallation.
  7. You will need to edit bin/start-tc-server.sh – remove or comment out the following piece of code (it’s a 1.5+ only VM arg - it has no bearing on the current issue):

    -XX:+HeapDumpOnOutOfMemoryError

  8. Now do: ./start-demo-server.sh — and the server wont start, and the VM will spit out the ff message:

./start-demo-server.sh Exception in thread “main” java.lang.UnsupportedClassVersionError: com/tc/server/TCServerMain (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

nadeem ghani 2009-03-12

export JAVA_HOME= bin/start-tc-server.sh bin/start-tc-server.sh: the JAVA_HOME environment variable is not defined correctly