log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.大家说下这个问题怎么引起的,怎么解决,麻烦帮下忙

解决方案 »

  1.   

    警告不用管,不影响正常使用。你看你的log可以正常记录吗
      

  2.   

    是不是没有log4j.properties这个文件?
    加上这个文件放在classpath下
      

  3.   

    就是说要在classpath添加log4j.properties这个文件路径吗?
      

  4.   

    问题是测试时打不出建表语句就提示这些waring是什么问题
      

  5.   

    不出建表语句 估计是你在xml屏蔽了。
    <prop key="hibernate.show_sql">false</prop>(hibernate.cfg.xml或者applicationContext.xml里有)
    将false改成true就可以在后台打印出sql语句了
      

  6.   

    org.hibernate.MappingException: invalid configuration
    我看junit里面提示这一句是什么意思
      

  7.   

    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration>    <session-factory>        <!-- Database connection settings -->
            <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="connection.url">jdbc:mysql://localhost/hibernate</property>
            <property name="connection.username">root</property>
          <!--    <property name="connection.password">1</property> -->        --><!-- JDBC connection pool (use the built-in) -->
            <property name="connection.pool_size">1</property>        <!-- SQL dialect -->
            <property name="dialect">org.hibernate.dialect.MySQLDialect</property>        <!-- Enable Hibernate's automatic session context management -->
        <!--    <property name="current_session_context_class">thread</property>-->        <!-- Disable the second-level cache  -->
            <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>        <!-- Echo all executed SQL to stdout -->
            <property name="show_sql">true</property>        <!-- Drop and re-create the database schema on startup -->
            <property name="hbm2ddl.auto">update</property>
            <!--        <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
            -->
            
            <mapping class="hfanghao.hibernate.Group"/>
            <mapping class="hfanghao.hibernate.User"/>    </session-factory></hibernate-configuration>
      

  8.   

    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration>    <session-factory>        <!-- Database connection settings -->
            <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="connection.url">jdbc:mysql://localhost/hibernate</property>
            <property name="connection.username">root</property>
          <!--    <property name="connection.password">1</property> -->        --><!-- JDBC connection pool (use the built-in) -->
            <property name="connection.pool_size">1</property>        <!-- SQL dialect -->
            <property name="dialect">org.hibernate.dialect.MySQLDialect</property>        <!-- Enable Hibernate's automatic session context management -->
        <!--    <property name="current_session_context_class">thread</property>-->        <!-- Disable the second-level cache  -->
            <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>        <!-- Echo all executed SQL to stdout -->
            <property name="show_sql">true</property>        <!-- Drop and re-create the database schema on startup -->
            <property name="hbm2ddl.auto">update</property>
            <!--        <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
            -->
            
            <mapping class="hfanghao.hibernate.Group"/>
            <mapping class="hfanghao.hibernate.User"/>    </session-factory></hibernate-configuration>
      

  9.   

    1、确认有log4j.properties这个文件,并且放在classpath下。
    2、确保有相关的支持log记录的jar。
    3、确保log4j.properties中配置正确。
      

  10.   

    确定导入了 log4j这个jar包 然后你可以在下载的Hibernate的文件夹的etc子文件夹里找到log4j.properties则合格文件 直接贴到你项目里就可以  新手的话还是建议看视频啊 视频很直观
      

  11.   

    在类路径中加入log4j.properties缺少这个文件。。