-->
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.  [ 9 posts ] 
Author Message
 Post subject: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Tue Aug 04, 2009 5:38 am 
Newbie

Joined: Tue Aug 04, 2009 5:29 am
Posts: 5
I got the following error
java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)V

while trying the Annotations.
I am using the jar files as:
hibernate-annotations.jar-3.4.0
hibernate-commons-annotations.jar-3.4.0
log4j.jar-1.2.15
slf4j-log4j13-1.0.jar
slf4j-api.jar 3.4.0

I have one utils class as:
Code:
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
  private static final SessionFactory sessionFactory;
  static {
    try {
      // Create the SessionFactory from hibernate.cfg.xml
      sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
    } catch (Throwable ex) {
      // Make sure you log the exception, as it might be swallowed
      System.err.println("Initial SessionFactory creation failed." + ex);
      throw new ExceptionInInitializerError(ex);
    }
  }

  public static SessionFactory getSessionFactory() {
    return sessionFactory;
  }
}


The flow is always catched in the line:
Code:
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();

and gives the above mentioned error. I am beginner in the hibernate field.
Please let me know what is the problem and how could it be solved.
Thanks,


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Tue Aug 04, 2009 7:05 am 
Beginner
Beginner

Joined: Wed Jul 29, 2009 3:43 pm
Posts: 22
Check for multiple versions of jars in your classpath.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Wed Aug 05, 2009 11:54 pm 
Newbie

Joined: Tue Aug 04, 2009 5:29 am
Posts: 5
can it be the case the jar file is missing some classes or may be incomplete?


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Thu Aug 06, 2009 1:02 am 
Newbie

Joined: Tue Aug 04, 2009 5:29 am
Posts: 5
I changed the log4j to 1.2.15 but still I got stucked in the following issue:

Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

I am using the hibernate3.jar and hibernate annotations 3.4.0.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Thu Aug 06, 2009 4:27 am 
Beginner
Beginner

Joined: Wed Jul 29, 2009 3:43 pm
Posts: 22
Try log4j-1.2.9.jar .


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Thu Aug 06, 2009 5:57 am 
Newbie

Joined: Tue Aug 04, 2009 5:29 am
Posts: 5
Thanks everybody, I got the solution.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Thu Aug 06, 2009 6:19 am 
Beginner
Beginner

Joined: Wed Jul 29, 2009 3:43 pm
Posts: 22
rameshraj wrote:
Thanks everybody, I got the solution.


Was there more to it than just the jar version??


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Thu Aug 06, 2009 7:36 am 
Newbie

Joined: Tue Aug 04, 2009 5:29 am
Posts: 5
Yes the main problem is from the jar files, which might not be stable.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Lja
PostPosted: Thu Aug 06, 2009 8:11 am 
Beginner
Beginner

Joined: Wed Jul 29, 2009 3:43 pm
Posts: 22
rameshraj wrote:
Yes the main problem is from the jar files, which might not be stable.

I think the issue here is compatibility and not stability. Different version of Hibernate are written against different 3rd party jars , so if you include a different version of a 3rd party jar , you will get weird runtime exceptions.


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