-->
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.  [ 4 posts ] 
Author Message
 Post subject: NoClassDefFoundError with PowerPc server but work with intel
PostPosted: Wed May 13, 2009 6:48 am 
Newbie

Joined: Thu Jul 24, 2008 10:25 am
Posts: 4
Hello,

I'm testing a web application, which uses Hibernate 3, postgres 8.3, JSF 1.2 and acegi, on two servers:
- First server: processor intel dual (64 bits) core, Mac OS 10.5
- Second server: processor power pc (32 bits), Mac OS 10.4

My application is compatible with the first one, but it is not compatible with second.

Logs messages display NoClassDefFoundError. These messages are generated by "session = connexion.currentSession();", but connexion classe existe and currentSession is a static access.

So, I looked for the Hibernate FAQ and I find this message:

Quote:
I get a ClassNotFoundException or NoClassDefFoundError

You are missing a third-party library Hibernate needs, check lib/README.txt in the Hibernate distribution first. You need all classes that are listed as required for runtime. Another much more exotic reason might be a static initializer block of one of the needed classes (error during load) or a security-related issue (policy doesn't allow loading).


What does it mean? Either a static initializer block from the application classe cannot be initialized or a Hibernate jar classe cannot be initialized?

So what can I do to solve it?


Top
 Profile  
 
 Post subject: Re: NoClassDefFoundError with PowerPc server but work with intel
PostPosted: Wed May 13, 2009 7:39 am 
Newbie

Joined: Wed Jan 21, 2009 4:26 pm
Posts: 12
See => You are missing a third-party library Hibernate needs

Hibernate requires some libs. Check your download hibernate.zip. There is a folder descriped as required...
Add also these required libs (jars) to your classpath


Top
 Profile  
 
 Post subject: Re: NoClassDefFoundError with PowerPc server but work with intel
PostPosted: Wed May 13, 2009 11:11 am 
Newbie

Joined: Thu Jul 24, 2008 10:25 am
Posts: 4
I checked all Hibernate library and none are missing (antlr, commons-logging,dom4j,javassist,jta,slf4j,Hibernate). Perhaps, I need a other library for a powerPC server?

Quote:
Another much more exotic reason might be a static initializer block of one of the needed classes (error during load) or a security-related issue (policy doesn't allow loading).


In my opinion, it's the exotic reason. "Connexion.currentSession()" and sessionFactory are static functions and tomcat couldn't find Connexion.

Connexion classe:

Code:
package com.dao.connexion;

import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;

public class connexion
{
   private static final SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
   public static final ThreadLocal<Session> session = new ThreadLocal<Session>();
   
   public static Session currentSession() throws HibernateException
   {
      Session s = (Session) session.get();
      if (s == null)
      {
         s = sessionFactory.openSession();
         session.set(s);
      }
      return s;
   }
   public static void closeSession() throws HibernateException
   {
      Session s = (Session) session.get();
      session.set(null);
      if (s != null) s.close();
   }
}

As you can see, Connexion should initialize the Hibernate Session factory.

When I run the ligne "connexion.currentSession();", the application never enter into connexion and Logs messages display NoClassDefFoundError. (Only for a powerPC server)


Top
 Profile  
 
 Post subject: Re: NoClassDefFoundError with PowerPc server but work with intel
PostPosted: Thu May 14, 2009 5:05 am 
Newbie

Joined: Thu Jul 24, 2008 10:25 am
Posts: 4
I found the error, Power Pc works with JVM 5 Mac and its doesn't work with JDBC4. So, I must used JDBC3. Now, my sessionFactory can be initialized.

Now, I have got a other error, the connection could not be open.


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