休止状態を試し、マニュアルにあるように実行します。しかし、それは機能しません。
package util;
//imports
public class HibernateUtil {
private static SessionFactory sessionFactory = null;
static {
try {
System.out.println("HU 01");
Configuration configuration = new Configuration();
System.out.println("HU 02");
configuration.configure();
System.out.println("HU 03");
//creates the session factory from hibernate.cfg.xml
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
System.out.println("HU 04");
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
System.out.println("HU 05");
} catch (Exception e) {
System.out.println("HU 06");
e.printStackTrace();
}
}
public static SessionFactory getSessionFactory() {
System.out.println("HU 00");
return sessionFactory;
}
}
次のログがあります(System.out ...がどこにでも配置されています):
Main class starts.
Factory initialised.
Factory.Entity initialised.
ImplDAO 1
HU 01
ImplDAO 8
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:176)
at util.HibernateUtil.<clinit>(HibernateUtil.java:14)
at dao.impl.ImplDAO.setData(ImplDAO.java:27)
at service.MainClass.main(MainClass.java:17)
「HU01」はコンソールに表示されますが、「HU02」は表示されません。だから、私はいくつかのhibernate.cfg.xmlの問題を抱えていると思いますが、それも手動で作成されています:
<?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>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1251:XE</property>
<property name="hibernate.connection.username">SYSTEM</property>
<property name="hibernate.connection.password">12345</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="current_session_context_class">thread</property>
<mapping class="logic.EntityClass" />
</session-factory>
</hibernate-configuration>
私の環境:
Hibernate 4.1
WebLogic Server 11gR1
Oracle DataBase 11g Express Edition
Eclipse Juno
JRE: jdk1.7.0_09
(same thing with Oracle WebLogic Server 11gR1 (10.3.2) JRE)
何か案が?