13 May 2013

Unsupported major.minor version 51.0

Problem: Unsupported major.minor version 51.0.

Cause: The compiled application is not compatible with the JDK version of the application server.

Solution: Compile the source code again using the correct JDK version as of the application server.

The reported major numbers are:

J2SE 8 = 52,
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

8 May 2013

Eclipse is running in a JRE, but a JDK is required

Problem: Eclipse is running in a JRE, but a JDK is required.

Cause:

  1. The ServiceReference can be null if no HelloService is registered, resulting in NullPointerException on line 6.
  2. The HelloService object cannot be got, due to missing permissions, possible timing issues if the HelloService unregisters between lines 5 and 6, causing NullPointerException on line 6.
  3. The HelloService may have become unusable, resulting in any RuntimeException subclass, most likely IllegalStateException on line 6.

Solution: Add the following at the beginning of eclipse.ini
-vm C:\Program Files\Java\jdk1.6.0_31\jre\bin\server

-vm C:\Program Files\Java\jdk1.6.0_31\jre\bin\server -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms40m -Xmx512m -XX:MaxPermSize=256m

Failed to lazily initialize a collection of role: could not initialize proxy - no Session

Problem: When lazy loading in used in Hibernate, it fails to initialize a collection of role.

failed to lazily initialize a collection of role: could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session

Cause: The session was closed, so it can't load the actual contents of the collection.

Solution: add an @Transactional annotation to it, or the entry point from which it is called.