Home  >  Forum  >  Hibernate
Post New Query

log4j:WARN No appenders could be found for logger(org.hibernate.cfg.Environment


joined on
September 16,2014
Asked on October 14,2015
I have created some code in Hibernate to insert the data in database but facing some problem. Can any body solve it?
log4j:WARN No appenders could be found for logger      (org.hibernate.cfg.Environment).
  log4j:WARN Please initialize the log4j system properly.
 Exception in thread "main" org.hibernate.MappingException: could not instantiate id generator
   at    org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)
    at   org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
at com.hib.StoreData.main(StoreData.java:17)
Caused by: org.hibernate.MappingException: could not interpret id generator strategy: assined
at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass(IdentifierGeneratorFactory.java:109)
at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:92)
... 4 more


joined on
October 12,2013
Replied on October 14,2015

To resolved your problem you need to add some jar file in your project.
antlr-2.7.7.jar 
commons-lang3-3.1.jar 
commons-logging-1.1.3.jar 
dom4j-1.6.1.jar 
hibernate-commons-annotations-4.0.1.Final.jar 
hibernate-core-4.2.0.Final.jar 
hibernate-jpa-2.0-api-1.0.1.Final.jar 
javassist-3.15.0-GA.jar 
jboss-logging-3.1.0.GA.jar 
jboss-transaction-api_1.1_spec-1.0.0.Final.jar

Note: If possible then add the latest versions of above jar files.

You also need add log4j.properties   parallel to the src file.

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n**strong text**


Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us