0

I followed the FAQ, but I'm running Ubuntu 10 server so J6 is the best I can get. When I start gwan 4.2.13 (sudo ./gwan) I get "hello.java: to use .java scripts, install Java"

 echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-openjdk/bin

java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.1) (6b27-1.12.1-2ubuntu0.10.04.2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

I tried the Java purge in the FAQ and re-installed J6, but still no luck.

Any ideas?

Gil
  • 3,279
  • 1
  • 15
  • 25
sday
  • 1,041
  • 14
  • 22
  • I tried logging back in and noticed the PATH and JAVA_HOME didn't stick so I put them in the /etc/profile and now the path info is "sticky" as in survives a logout but still no dice. – sday Feb 15 '13 at 18:04
  • Also tried /etc/environment which according the ubuntu is the preferred place for system wide environment variables. https://help.ubuntu.com/community/EnvironmentVariables – sday Feb 15 '13 at 19:10
  • I found what looks like a fairly comprehensive set of instructions for installing the 1.7 jdk at: http://www.nabisoft.com/tutorials/glassfish/installing-glassfish-311-on-ubuntu – sday Feb 16 '13 at 18:36
  • Now gwan actually recognizes I have java, but tells me: loadingException in thread "main" java.lang.UnsupportedClassVersionError: hello : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivilege – sday Feb 16 '13 at 18:42
  • After looking at some of the JNI docs it looks like gwan is crashing while trying to load the JVM. (who knows) http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp9502 – sday Feb 17 '13 at 16:36
  • Having no configuration files is a beautiful thing... if it works. I was able to use the above nabisoft documentation to flawlessly install and start Glassfish. Guess I'll use it since I can't get gwan working. – sday Feb 17 '13 at 16:38

1 Answers1

0

According to your report, the error is:

"Unsupported major.minor version 51.0 at java.lang.ClassLoader"

This is NOT a crash, this is a Java version incompatibility triggered during the very first step of loading the JVM as explaned here.

Your server is running a lower Java version then the one used to compile your Servlet and vice versa. The Java documentation explains that the version number shown is the version of the JRE that the class file is compatible with:

J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

That error is independent from G-WAN: it's a Java version issue. To resolve it, just install the CORRESPONDING JVM and JDK.

This error could happen with any program using Java: mixing versions creates Java incompatibilities, and there's nothing G-WAN can do about that.

Community
  • 1
  • 1
Gil
  • 3,279
  • 1
  • 15
  • 25
  • Saying that it is "independent from G-WAN" is not conclusive. Other executables on the system that are using the same JAVA environmental variables are successfully loading the JVM. I don't know what the problem is, but I most certainly haven't ruled out G-WAN as the problem... With respect to integration with Java, G-WAN is not a mature application so it is most certainly suspect. Is it something specific with my configuration? Very likely, but other more mature Java capable applications do not experience the same issues under my configuration. – sday Feb 18 '13 at 19:15
  • At this point I can no longer continue as I've run out of ideas. I just don't have a deep enough understanding of 64-bit Linux and the JVM nor the time to dig really deep. Nothing against G-WAN, I love the philosophy behind it, I just need to move forward trying to determine what will be the best platform for my Java Web App needs. Thanks for the input. – sday Feb 18 '13 at 19:15
  • What you need is to contact the G-WAN support and provide your gwan.log file, among other information. THEN, having the *relevant* information, they will be able to help you. – Gil Feb 19 '13 at 17:42
  • Done. Thanks. I'll be sure to post the resolution for anyone else trying to use Java with gwan running into the same roadblocks as me. – sday Feb 19 '13 at 23:05
  • I see you edited your answer with more details. I now see what you're saying and I'll have to see if I can resolve that. I've installed several versions and it could very well be that. On a side note, I installed a clean copy of Ubuntu 12.04 and openjdk7. Worked perfectly the first time. – sday Mar 06 '13 at 01:45
  • This other question you asked seems to show that your issue was resolved: http://stackoverflow.com/questions/15236914/gwan-not-re-compiling-java-files – Gil Mar 06 '13 at 07:57