Getting Hibernate 3.1.12 to work with JSDK 1.4

I had some trouble to get the latest Hibernate release to work. I have to use JSDK 1.4 but I got the following error message when I started my application:

HTTP Status 500 –

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.UnsupportedClassVersionError: org/hibernate/cfg/SecondPass (Unsupported major.minor version 49.0)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:763)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:348)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

root cause

java.lang.UnsupportedClassVersionError: org/hibernate/cfg/SecondPass (Unsupported major.minor version 49.0)
java.lang.ClassLoader.defineClass0(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:537)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
org.hibernate.cfg.Configuration.add(Configuration.java:386)
org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
com.truition.db.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:48)
com.truition.db.dao.UploadsDAO.getByStatus(UploadsDAO.java:77)
com.truition.philipsXmlImportWeb.controller.uploadsController.handleRequest(uploadsController.java:214)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:723)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:348)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.

org.springframework.web.util.NestedServletException: Handler processing failed;
nested exception is java.lang.UnsupportedClassVersionError: org/hibernate/cfg/Se
condPass (Unsupported major.minor version 49.0)
java.lang.UnsupportedClassVersionError: org/hibernate/cfg/SecondPass (Unsupporte
d major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webapp
ClassLoader.java:1634)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoa
der.java:860)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1307)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1189)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at org.hibernate.cfg.Configuration.add(Configuration.java:386)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427
)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.jav
a:1465)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.jav
a:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at com.truition.db.HibernateSessionFactory.currentSession(HibernateSessi

I have f ound in the Hibernate forums that I need to recompile with JSDK 1.4, but that didn’t work imediatelly.

I had to do the following change to the build.cmd file in the Hibernate directory:

from:

java -cp „lib/ant-launcher-1.6.5.jar“ org.apache.tools.ant.launch.Launcher -lib lib %1 %2 %3 %4 %5

to:

C:\Programme\Java\j2sdk1.4.2_09\jre\bin\java -cp „lib/ant-launcher-1.6.5.jar;C:\Programme\Java\j2sdk1.4.2_09\lib\tools.jar;C:\Programme\Java\j2sdk1.4.2_09\jre\lib\rt.jar“ org.apache.tools.ant.launch.Launcher -lib lib %1 %2 %3 %4 %5

In the new version I use the java.exe from JSDK 1.4 and I also had to add rt.jar and tools.jar to the classpath.
After that I could compile without problems.

Dieser Beitrag wurde unter Allgemein, Software-Development veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Eine Antwort auf Getting Hibernate 3.1.12 to work with JSDK 1.4

  1. Pingback: baccarat

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

CAPTCHA-Bild

*