-->
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.  [ 8 posts ] 
Author Message
 Post subject: [SOLVED] Hibernate-core Windows problem
PostPosted: Thu May 20, 2010 10:49 am 
Regular
Regular

Joined: Wed Mar 10, 2010 4:48 am
Posts: 106
I have an application which includes 15 external jar files listed below.
If I DO NOT include hibernate-core.jar I get this error:
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.core.KeyFactory
   at org.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:308)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043)
   at util.SessionHandler.<clinit>(SessionHandler.java:9)
   at main.RegisterMain.main(RegisterMain.java:31)

When I DO include hibernate-core.jar the problem is solved on Mac OSX, but not on Windows 7 and XP.
Does anyone has an idea why this is?

Does anyone know of other differences between platforms Hibernate can come across?

The included jars:
    antlr-2.7.6.jar
    c3p0-0.9.1.2.jar
    cglib-2.2.jar
    commons-collections-3.1.jar
    commons-lang-2.5.jar
    commons-logging-1.1.1.jar
    dom4j-1.6.1.jar
    ehcache-1.5.0.jar
    hibernate3.jar
    hibernate-core.jar
    javassist-3.9.0.GA.jar
    jta-1.1.jar
    log4j-1.2.15.jar
    slf4j-api-1.5.11.jar
    slf4j-log4j12-1.5.11.jar


Last edited by aukemid on Fri May 21, 2010 4:03 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Hibernate-core Windows problem
PostPosted: Fri May 21, 2010 3:06 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
hibernate3.jar
hibernate-core.jar

that's wrong, you either use hibernate-core, or use hibernate3.jar. They're likely originating from different versions.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate-core Windows problem
PostPosted: Fri May 21, 2010 3:13 am 
Regular
Regular

Joined: Wed Mar 10, 2010 4:48 am
Posts: 106
If I remove hibernate-core.jar I get this error:
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.core.KeyFactory
   at org.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:308)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1043)
   at util.SessionHandler.<clinit>(SessionHandler.java:9)
   at main.RegisterMain.main(RegisterMain.java:33)

If I remove hibernate3.jar (keep hibernate-core) I get this error:
Code:
ERROR - (ConnectionProviderFactory.java:99) - Could not instantiate connection provider
java.lang.ClassNotFoundException: org.hibernate.connection.C3P0ConnectionProvider
   at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:169)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:96)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)
   at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:448)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
   at util.SessionHandler.<clinit>(SessionHandler.java:9)
   at main.RegisterMain.main(RegisterMain.java:33)
Exception in thread "main" java.lang.ExceptionInInitializerError
   at main.RegisterMain.main(RegisterMain.java:33)
Caused by: org.hibernate.HibernateException: Could not instantiate connection provider: org.hibernate.connection.C3P0ConnectionProvider
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:100)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)
   at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:448)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
   at util.SessionHandler.<clinit>(SessionHandler.java:9)
   ... 1 more


Top
 Profile  
 
 Post subject: Re: Hibernate-core Windows problem
PostPosted: Fri May 21, 2010 3:29 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
If I remove hibernate3.jar (keep hibernate-core) I get this error:

hibernate-core is a newer version (blame on you you're not posting versions) and it's now modular since some years :)
C3P0ConnectionProvider is optional and provided in a separate jar.
Using maven you would add:
Code:
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-c3p0</artifactId>
  <version>3.5.2-Final</version>
</dependency>

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate-core Windows problem
PostPosted: Fri May 21, 2010 3:39 am 
Regular
Regular

Joined: Wed Mar 10, 2010 4:48 am
Posts: 106
s.grinovero wrote:
hibernate-core is a newer version (blame on you you're not posting versions) and it's now modular since some years :)
I'm sorry, but I have no idea which versions I have. All other jars have the version in the name of the file. These don't.
s.grinovero wrote:
C3P0ConnectionProvider is optional and provided in a separate jar.

In the first post I have listed the jar files I include. c3p0 is one of them.

I really need to solve this problem, but I have no idea how. If I use all newest versions it doesn't work. If I use the versions that come with the hibernate package it also doesn't work. Is there an overview of which versions of jar files can work together?


Top
 Profile  
 
 Post subject: Re: Hibernate-core Windows problem
PostPosted: Fri May 21, 2010 3:50 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
I'm sorry, but I have no idea which versions I have. All other jars have the version in the name of the file. These don't.

you can unzip your jar and look into the META-INF/MANIFEST.MF file, we make sure to write it there too to prevent this kind of issues. Maven descriptors are there too. BTW hibernate does also log the version while starting.

Quote:
In the first post I have listed the jar files I include. c3p0 is one of them.

c3p0 is one jar, but you're missing hibernate-c3p0 which is the bridge adapting the first to the latter.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate-core Windows problem
PostPosted: Fri May 21, 2010 4:02 am 
Regular
Regular

Joined: Wed Mar 10, 2010 4:48 am
Posts: 106
It's solved. Thanks a lot.

I used version Hibernate-Version: 3.0.beta4

I had no idea there was a hibernate-c3p0 link needed. I thought this was inside the Hibernate jar.

Now instead of Hibernate3, I use hibernate-core and hibernate-c3p0-3.3.0.GA.


Top
 Profile  
 
 Post subject: Re: [SOLVED] Hibernate-core Windows problem
PostPosted: Fri May 21, 2010 4:17 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
I used version Hibernate-Version: 3.0.beta4 ... hibernate-c3p0-3.3.0.GA

I'd recommend you make sure you use matching versions as core & hibernate-c3p0,
and also to avoid 3.0.beta4 that's very old.
Use something like this:
http://repository.sourcesense.com/nexus/index.html#nexus-search;gav~org.hibernate~~3.3.2.GA~~

_________________
Sanne
http://in.relation.to/


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