Results 1 to 6 of 6
- 08-04-2009, 11:31 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 42
- Rep Power
- 0
java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apach
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:
The flow is always catched in the line:Java 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; } }
and gives the above mentioned error. I am beginner in the hibernate field.Java Code:sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
Please let me know what is the problem and how could it be solved.
Thanks,
- 08-04-2009, 11:42 AM #2
Member
- Join Date
- Aug 2009
- Location
- Kharkov, Ukraine
- Posts
- 29
- Rep Power
- 0
Seems like you are trying to use slf4j adapter for log4j 1.3 with log4j 1.2.log4j.jar-1.2.15
slf4j-log4j13-1.0.jar
Full stack trace can tell this for sure.
- 08-06-2009, 05:36 AM #3
Member
- Join Date
- Dec 2007
- Posts
- 42
- Rep Power
- 0
do you have some idea on how to resolve this?
- 03-16-2011, 09:01 PM #4
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
I am getting this exact same error
I am receiving this same error with my application and I am stumped too.
I am using log4j-1.2.8.jar which I read somewhere would fix this but no luck. I am also using jdk1.5.
When I run my program from the command line, my program errors out on the following line which I think is similar to your problem
Configuration cfg = new Configuration().configure("controlTable.cfg.xml");
My program works like a champ when I run it from MyEclipse, however when I compile it with ANT and deploy it to my server I get the same error.
Exception in thread "Thread-0" java.lang.NoSuchMethodError: log (Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)V
- 03-17-2011, 06:35 AM #5
Senior Member
- Join Date
- Nov 2010
- Location
- Delhi
- Posts
- 135
- Blog Entries
- 1
- Rep Power
- 0
make sure you don't have any other entry for log4j.jar in your classpath.
My gut feeling says, your classpath refers to an earlier version of log4j.
- 03-17-2011, 02:26 PM #6
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
[error] java.lang.NoSuchMethodError: main
By jon80 in forum New To JavaReplies: 1Last Post: 04-29-2009, 11:21 PM -
[SOLVED] Ljava.lang.String;@923e30 at runtime
By Jerome in forum New To JavaReplies: 6Last Post: 12-31-2008, 11:08 AM -
Error: cannot resolve symbol' on Person (java.lang.String, java.lang.String)
By baltimore in forum New To JavaReplies: 2Last Post: 09-18-2008, 07:30 AM -
exception in thred main java.lang.nosuchmethoderror: main
By fernando in forum Java AppletsReplies: 1Last Post: 08-06-2007, 09:11 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks