private static Log log = LogFactory.getLog(HibernateUtil.class);  
=============
這句有問題,你去看下

解决方案 »

  1.   

    提示出错的是这句喔:throw new ExceptionInInitializerError(ex); 
    hibernate.cfg.xml:
    ............
        <session-factory>
            <property name="connection.username">root</property>
            <property name="connection.url">jdbc:mysql://localhost/shoponline?useUnicode=true&amp;characterEncoding=gbk</property>
            <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
            <property name="connection.password">root</property>
            <property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
            <property name="hibernate.connection.pool_size">100</property>
            <property name="show_sql">false</property>   
            <!-- Mapping files -->
            <mapping resource="model.hbm.xml"/>    
        </session-factory>
    ................
      

  2.   

    private static Log log = LogFactory.getLog(HibernateUtil.class);  private static final SessionFactory sessionFactory;  static {  
    try {  
    // Create the SessionFactory  
    sessionFactory = new Configuration().configure().buildSessionFactory();  
    } catch (Throwable ex) {  
    ex.printStackTrace();  
    //log.error("Initial SessionFactory creation failed.", ex);  
    throw new ExceptionInInitializerError(ex);  
    }  
    }  
    就上面着段的问题了,private static Log log = LogFactory.getLog(HibernateUtil.class);  是不是这?
      

  3.   

    你用的是log4j吧,   
      我用的时候是这样的   
      private   static   Logger   logger   =   Logger.getLogger(HibernateUtil.class);