eclipse Heliosでmavenプロジェクトを作成し、pom.xml依存関係に "hibernate-search 4.0.0.Final"と "mysql-connector-java 5.1.18"を追加しました。どちらもダウンロードされ、.m2ディレクトリに存在します。私はこのコードを実行するときには:ちょうどテーブルの前に提供された値をインポートするためにDBにテーブルを作成するためにmavenプロジェクトのmysqlクラスが見つかりません
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.getTransaction().commit();
を、私は次のエラーを取得する:
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.leemoo.test.HibernateUtil.buildSessionFactory(HibernateUtil.java:19)
at net.leemoo.test.HibernateUtil.<clinit>(HibernateUtil.java:8)
at net.leemoo.test.MainClass.main(MainClass.java:9)
Caused by: org.hibernate.HibernateException: Dialect class not found: jdbc:mysql://localhost:3306/test?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:76)
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:64)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:166)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775)
at net.leemoo.test.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
... 2 more
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [jdbc:mysql://localhost:3306/test?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141)
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:73)
... 13 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : jdbc:mysql://localhost:3306/test?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)
... 14 more
私が何をするか分からないのですか?私はこのエラーを見つけたが成功しなかった。 plzは私を助けます。前もって感謝します。