-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 
Author Message
 Post subject: java.lang.UnsupportedClassVersionError
PostPosted: Mon Jan 31, 2005 9:41 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Hi

I just want to give the latest Hibernate 3.0 Beta a chance.
Unfortunately I constantly keep getting a UnsupportedClassVersionError.

I created a new Eclipse project, added all *.jars from the lib plus the hibernate3. jar.

My guess is, that there's somehow a hibernate2.jar hanging a round, but I cannot find it.
I already checked the CLASSPATH environment variable.
I'm also sure I'm using org.hibernate instead of net.sf.hibernate.

Any ideas?
Ernst


Hibernate version:
3.0 beta 3

Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="field">
   <class name="li.pluess.hibernate.playground.ClassA">
      <id name="myId">
         <generator class="uuid.hex"/>
      </id>
      <version name="myVersion"/>
      <property name="myName"/>
   </class>
</hibernate-mapping>


Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
   <session-factory>
      <property name="show_sql">true</property>
      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
      <property name="hibernate.connection.url">jdbc:mysql://localhost/playground</property>
      <property name="hibernate.connection.username">root</property>
      <mapping resource="li/pluess/hibernate/playground/ClassA.hbm.xml"/>
   </session-factory>
</hibernate-configuration>



Code between sessionFactory.openSession() and session.close():
Code:
    Session s = HibernateUtil.getSession();
    HibernateUtil.beginTransaction();
   
    HibernateUtil.commitTransaction();
    HibernateUtil.closeSession();


Full stack trace of any exception that occurs:
Code:
java.lang.UnsupportedClassVersionError: org/hibernate/HibernateException (Unsupported major.minor version 49.0)
   at java.lang.ClassLoader.defineClass0(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
   at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
   at java.lang.Class.getDeclaredMethods0(Native Method)
   at java.lang.Class.privateGetDeclaredMethods(Class.java:1627)
   at java.lang.Class.privateGetPublicMethods(Class.java:1655)
   at java.lang.Class.getMethod0(Class.java:1744)
   at java.lang.Class.getMethod(Class.java:963)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:357)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:398)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)


Name and version of the database you are using:
MySql 4


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 10:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm - looks like the last H3 is compiled with jdk 1.5 (bad gavin!)
This is not necessary.

Best advise now is to check it out from cvs and do the build your self with jdk 1.4 (or simply run it with jdk 1.5)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 10:35 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Thanks Max

Just found the same answer myself.
Recompiling with JDSK 1.4.1 helps.

Ernst


Top
 Profile  
 
 Post subject: New 1.4 jar?
PostPosted: Mon Jan 31, 2005 6:22 pm 
Newbie

Joined: Fri Oct 03, 2003 6:47 am
Posts: 15
Hi,
Would be great if anyone could post a J2SE 1.4 compatible version of the Hibernate jar.

Thanks in advance...

My symptom is following...

Code:
    [javac] bad class file: C:\jakarta\hibernate-3.0\hibernate3.jar(org/hibernate/HibernateException.class)
    [javac] class file has wrong version 49.0, should be 48.0
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac] import org.hibernate.HibernateException;


I work with both 1.4 and Java 5 and it works great in Tiger...

// Torben


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 31, 2005 6:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Ugh. Me Very Bad.

We will have to re-do this w/e releases, I guess.

Bugger.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 11:06 am 
Senior
Senior

Joined: Tue Aug 03, 2004 2:11 pm
Posts: 142
Location: Somerset
gavin wrote:
Ugh. Me Very Bad.


Is this the same error ? Looks like my h3 test is on hold ;-)


[03/02/05 14:52:03:074 GMT] 16f6d891 ExceptionUtil E CNTR0020E: Non-application exception occurred while processing method "getList" on bean "BeanId(TargetBroker#StandingDataEJB.jar#StandingData, null)". Exception data: java.lang.LinkageError: LinkageError while defining class: org.hibernate.criterion.Criterion
Could not be defined due to: org/hibernate/criterion/Criterion (Unsupported major.minor version 49.0)
This is often caused by having a class defined at multiple
locations within the classloader hierarchy. Other potential causes
include compiling against an older or newer version of the class
that has an incompatible method signature.
Dumping the current context classloader hierarchy:
==> indicates defining classloader
==>[0]
com.ibm.ws.classloader.CompoundClassLoader@79249899
Local ClassPath: C:\workspaces\brokerp6\TargetBrokerEJB\ejbModule;C:\workspaces\brokerp6\BusinessValidationEJB\ejbModule;C:\workspaces\brokerp6\StandingDataEJB\ejbModule;C:\workspaces\brokerp6\DiaryEJB\ejbModule;C:\workspaces\brokerp6\DiaryEntityBeans\ejbModule;C:\workspaces\brokerp6\ThirdPartyAdaptersEJB\ejbModule;C:\workspaces\brokerp6\TargetValidatorCore\bin;C:\workspaces\brokerp6\TargetBroker\log4j-1.2.8.jar;C:\workspaces\brokerp6\TwofishEncyptionModule\bin;C:\workspaces\brokerp6\StandingDataBusinessClasses\bin;C:\workspaces\brokerp6\TargetBrokerBusinessClasses\bin;C:\workspaces\brokerp6\TargetCommonCode\bin;C:\workspaces\brokerp6\BusinessValidationBusinessClasses\bin;C:\workspaces\brokerp6\RexxJava\bin;C:\workspaces\brokerp6\TargetBroker\spring.jar;C:\workspaces\brokerp6\TargetBroker\commons-lang.jar;C:\workspaces\brokerp6\TargetBroker\hibernate2.jar;C:\workspaces\brokerp6\TargetBroker\commons-beanutils.jar;C:\workspaces\brokerp6\DiaryBusinessClasses\bin;C:\workspaces\brokerp6\TargetBroker\commons-collections-3.1.jar;C:\workspaces\brokerp6\ThirdPartyAdaptersBusinessClasses;C:\workspaces\brokerp6\Notes\src;C:\workspaces\brokerp6\TargetBroker\hibernate3.jar;C:\workspaces\brokerp6\TargetBroker\jcommon-0.9.3.jar;C:\workspaces\brokerp6\TargetBroker\jfreechart-0.9.18.jar;C:\workspaces\brokerp6\TargetBroker\cglib-full-2.0.1.jar;C:\workspaces\brokerp6\TargetBroker\commons-logging.jar;C:\workspaces\brokerp6\TargetBroker\dom4j-1.4.jar;C:\workspaces\brokerp6\TargetBroker\ehcache-0.7.jar;C:\workspaces\brokerp6\TargetBroker\odmg-3.0.jar;C:\workspaces\brokerp6\TargetBroker\castor-0.9.5.4.jar;C:\workspaces\brokerp6\TargetBroker\xerces.jar;C:\workspaces\brokerp6\TargetBroker\jdbc-se2.0.jar;C:\workspaces\brokerp6\TargetBroker\jndi.jar;C:\workspaces\brokerp6\TargetBroker\jta1.0.1.jar;C:\workspaces\brokerp6\DiaryWeb\Log4j.jar;C:\workspaces\brokerp6\DiaryWeb\StandingDataEJBUtility.jar;C:\workspaces\brokerp6\DocumentEnquiryWeb\Log4j.jar;C:\workspaces\brokerp6\DocumentEnquiryBusinessClasses\bin;C:\workspaces\brokerp6\DocumentEnquiryBusinessClasses\Log4j.jar;C:\workspaces\brokerp6\TargetBroker\pulsar.3.0.jar;
Delegation Mode: PARENT_FIRST
[1] com.ibm.ws.classloader.ExtJarClassLoader@1945409690 Local ClassPath: C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1.2\runtimes\base_v51\lib\app; Delegation Mode: PARENT_LAST
[2] com.ibm.ws.classloader.ProtectionClassLoader@361f989b
[3] com.ibm.ws.bootstrap.ExtClassLoader@3d63589b
[4] sun.misc.Launcher$AppClassLoader@3d74989b
[5] sun.misc.Launcher$ExtClassLoader@3d70989b
---Original exception---
java.lang.UnsupportedClassVersionError: org/hibernate/criterion/Criterion (Unsupported major.minor version 49.0)

_________________
On the information super B road


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 11:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
same error - recompile h3 your self or run with jdk 1.5 or wait for a release that is compiled with 1.4

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: org.hibernate.hql.antlr missing source
PostPosted: Thu Feb 03, 2005 12:02 pm 
Senior
Senior

Joined: Tue Aug 03, 2004 2:11 pm
Posts: 142
Location: Somerset
If I try and compile under 1.4, it turns out the package below is missing form the source code shipped with the latest beta....

org.hibernate.hql.antlr

which means that loads of classes of won't compile as they are missing imports like the following

import org.hibernate.hql.antlr.SqlTokenTypes;

_________________
On the information super B road


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 2:20 pm 
Newbie

Joined: Mon Mar 07, 2005 7:18 pm
Posts: 16
Hi,

I'm using java 1.3. Do I've to recompile too? - cause I'm getting the UnSupportedClassVersionError when I generate code using hbm2javatask.

Thanks,
Ram Juno.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 7:28 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
I suddenly get the same exception.
Does anybody know where I can download hibernate3.jar which is compiled under 1.4.2 ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 8:46 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
If you have java 1.3 or java 1.4 you have to download the source form cvs and recompile the jar file yourself using a compatible jvm

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 8:51 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
Blah!

I was afraid of that. I tried to run build but it didn't quite work. I will have to look more closly at it later.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 9:13 am 
Beginner
Beginner

Joined: Mon Sep 04, 2006 7:18 am
Posts: 45
I created a jar using 1.4.2 with eclipse on hibernate3 and I used this on my project. However I get the same exception. It must be something else?

Any ideas anyone?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.