-->
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.  [ 1 post ] 
Author Message
 Post subject: How do I have to initialize the log4j plugin?
PostPosted: Thu Jun 07, 2012 5:01 am 
Newbie

Joined: Wed May 30, 2012 2:39 am
Posts: 5
I am using hibernate right now, and I have the problem below;


Code:
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


Somehow, i cannot initialize log4j file properly but I do not know what on earth is going on.

I appreciate your comments.

This is the main class(I am hiding some descriptions by /** */, though)

Code:
package roseindia.tutorial.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.apache.log4j.*;

public class Exec {
     public static void main(String[] args) {
        Session session = null;
       
        try{
           SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
           session = sessionFactory.openSession();
        }catch(Exception e){}

        /**   
           Contact contact = new Contact();
           contact.setId(3);
           contact.setFirstName("Deepak");
           contact.setLastName("Kumar");
           contact.setEmail("deepak_38@yahoo.com");
           session.save(contact);
             }catch(Exception e){
            System.out.println(e.getMessage());
            }finally{
           session.flush();
           session.close();
         
        }
        */
    } 
}




And this is the configuration file;


Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
  <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  <property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.120.0:1521:ORCL</property>
  <property name="hibernate.connection.username">kei</property>
  <property name="hibernate.connection.password">sugano</property>
  <property name="show_sql">true</property>
  <property name="dialect">org.hibernate.dialect.OracleDialect</property>
  <property name="hibernate.hbm2ddl.auto">update</property>
 
  <mapping class="roseindia.tutorial.hibernate.Contact"/>
  <mapping class="roseindia.tutorial.hibernate.HibernateUtil"/>
  <mapping class="roseindia.tutorial.hibernate.Exec"/>
  <mapping class="roseindia.tutorial.hibernate.SessionFactoryHelper"/>

  <!-- Mapping files -->
  <mapping resource="contact.hbm.xml"/>
</session-factory>
</hibernate-configuration>




DO you have any idea what to do next?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.