-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate 3 execution error
PostPosted: Tue Feb 08, 2005 7:04 am 
Beginner
Beginner

Joined: Mon Jan 31, 2005 7:53 am
Posts: 32
Location: Madrid - Spain
Hi mates, although I'm not a long-experienced hibernate user, I've been working on it for a few weeks. I've used several tools to generate my project's mapping files (*.hbm.xml) and the configuration file (hibernate.cfg.xml). I've also adjusted some classes to my needs and the right mapping files as well.


The problem comes when I try to test the whole thing. For this purpose, I've done a class called TestCorePackage. When I execute it I always get the same error at line
Code:
Configuration conf = new Configuration();


The following code is a snipped of the mentioned class:


Code:

public static void main(String[] args)
    {
        System.out.println("Executing main method...");

        // Load configuration data from hibernate.cfg.xml file
        File cfgfile = new File("C:\\eclipse\\workspace\\test\\config\\hibernate\\hibernate.cfg.xml");
        Configuration conf = new Configuration(); // <---- HERE IT CRASHES!!!
        System.out.println("Configuration object created!");

        conf = conf.configure(cfgfile);
        System.out.println("Configuration loaded!");
       
        File core_mappings = new File( "C:\\eclipse\\workspace\\test\\lib\\hibernate-core-mappings.jar" );
        System.out.println("Mapping files loaded!");
       
        conf.addJar(core_mappings);
        SessionFactory sf = conf.buildSessionFactory();
        System.out.println("DONE!");

   

        ... more code ...

  }



The output is:

Code:
Executing main method...
java.lang.UnsupportedClassVersionError: org/hibernate/cfg/Configuration (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)
   at com.fresh.uvs.entity.tests.TestCorePackage.main(TestCorePackage.java:45)
Exception in thread "main"


Do you know why is this happing?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 7:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
i accidently released the latest version compiled on JDK 1.5.

Recompile it on your JDK and you'll be ready to go.

(just type "ant" in the hibernate-3.xxx dir.)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 2:42 pm 
Beginner
Beginner

Joined: Mon Jan 31, 2005 7:53 am
Posts: 32
Location: Madrid - Spain
It worked!!

Well, since I'm working under Windows, I run the build.bat file and then I created a new hibernate3beta3.jar from the build/classes directory created when the whole proccess finishes. Then I swapped it for the one I had.

Thanks a lot Gavin!! ;D[/quote]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.