2012-06-15 69 views
1

奇怪的事情正在发生的事情,我做了一个EJB3至极的suposed写在DB的东西,但每次都被HSQLDB拒绝连接:的Hibernate 3.3.1.GA与HSQLDB 2.2.8和JBoss 5.1.0.GA拒绝连接

a pre-9.0 client attempted to connect. we rejected them 

但是我使用的是2.2.8,因为它被maven链接,所以没有错误。

这是我的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">org.hsqldb.jdbcDriver</property> 
     <property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost</property> 
     <property name="hibernate.connection.username">sa</property> 
     <property name="connection.password"></property> 
     <!-- JDBC connection pool (use the built-in) --> 
     <property name="connection.pool_size">1</property> 
     <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property> 

     <property name="configurationClass"> 
      org.hibernate.cfg.AnnotationConfiguration 
     </property> 
     <property name="hibernate.transaction.manager_lookup_class"> 
      org.hibernate.transaction.JBossTransactionManagerLookup 
     </property> 
     <property name="hibernate.transaction.factory_class"> 
      org.hibernate.transaction.CMTTransactionFactory 
     </property> 
     <property name="hibernate.jndi.class"> 
      org.jnp.interfaces.NamingContextFactory 
     </property> 
     <property name="hibernate.session_factory_name"> 
      hibernate/HSQLDBSessionFactory 
     </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">create</property> 

     <property name="javax.persistence.validation.mode">none</property> 
     <!-- Mapping files --> 
     <mapping class="com.th.entity.TestEntity"/> 
    </session-factory> 
</hibernate-configuration> 

我在我的EJB正在做:

HibernateUtil3.getSessionFactory().getCurrentSession().persist(entity); 
    HibernateUtil3.getSessionFactory().getCurrentSession().close(); 

而且我HibernateUtil3:

import org.hibernate.SessionFactory; 
import org.hibernate.cfg.AnnotationConfiguration; 

/** 
* 
* @author adam 
*/ 
public class HibernateUtil3 { 

    private static final SessionFactory sessionFactory = buildSessionFactory();//constroi a sessão 

    private static SessionFactory buildSessionFactory() { 
     try { 
      //Configuration cfg = new Configuration();//para mapeamento xml 
      AnnotationConfiguration cfg = new AnnotationConfiguration();//para mapeamento com annotations 
      cfg.configure("hibernate.cfg.xml");//arquivo de configuração do hibernate 
      return cfg.buildSessionFactory(); 
     } catch (Throwable e) { 
      System.out.println("Criação inicial do objeto SessionFactory falhou. Erro: " + e); 
      throw new ExceptionInInitializerError(e); 
     } 
    } 

    public static SessionFactory getSessionFactory() { 
     return sessionFactory; 
    } 
} 

什么想法? 感谢= d

回答

1

您需要更换包括与JBoss与HSQLDB版本2.2.8罐子的hsqldb.jar。

+0

事实上,这是在公共/ lib下,非常感谢= d – Eildosa

相关问题