-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Couldn't access hsqldb using hibernate in multiple thread ?
PostPosted: Sun Nov 27, 2005 1:31 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

2.1.7:

can't startup:


private static final SessionFactory sessionFactory;

static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Exception building SessionFactory: " + ex.getMessage());
}
}

public static final ThreadLocal session = new ThreadLocal();

public static Session currentSession() throws HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}

public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();
}






2005-11-27 05:17:43,288 ERROR [main] util.JDBCExceptionReporter (JDBCExceptionReporter.java:46) - C
nection is broken: Transfer corrupted
2005-11-27 05:17:43,368 ERROR [main] util.JDBCExceptionReporter (JDBCException.java:38) - Cannot op
connection
java.sql.SQLException: Connection is broken: Transfer corrupted
at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.getAutoCommit(Unknown Source)
at org.apache.commons.dbcp.DelegatingConnection.getAutoCommit(DelegatingConnection.java:249)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getAutoCommit(PoolingDa
Source.java:266)
at net.sf.hibernate.connection.DBCPConnectionProvider.getConnection(DBCPConnectionProvider.java
3)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3302)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3282)
at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40)
at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.
va:19)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2227)
at com.fangtoo.crm.dao.CrmcurteDaoImpl_Hib.findLatestCrmcurte(CrmcurteDaoImpl_Hib.java:41)
at com.fangtoo.crm.dao.CrmcurteDaoImpl_Hib.findAllCrmcurte(CrmcurteDaoImpl_Hib.java:24)
at com.fangtoo.crm.dao.proxy.CrmcurteDaoProxy.findAllCrmcurte(CrmcurteDaoProxy.java:14)
at com.fangtoo.crm.jxaj.servlet.InitList.init(InitList.java:13)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
!!!7
net.sf.hibernate.JDBCException: Cannot open connection
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:281)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3302)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3282)
at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40)
at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.
va:19)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2227)
at com.kecoo.crm.dao.CrmDaoImpl_Hib.findLatestCrminfo(CrmDaoImpl_Hib.java:41)
at com.kecoo.crm.dao.CrmDaoImpl_Hib.findCrminfo(CrmDaoImpl_Hib.java:24)
at com.kecoo.crm.dao.proxy.CrmDaoProxy.findCrminfo(CrmDaoProxy.java:14)
at com.kecoo.crm.jxaj.servlet.InitList.init(InitList.java:13)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
Caused by: java.sql.SQLException: Connection is broken: Transfer corrupted
at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.getAutoCommit(Unknown Source)
at org.apache.commons.dbcp.DelegatingConnection.getAutoCommit(DelegatingConnection.java:249)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getAutoCommit(PoolingDa
Source.java:266)



Hsqldb1.8:

NO:

INFO:

Hi everyone:

Did someone use HSQLDB with hibernate? I find that it seem that I couldn't access two database in one application. I use HSQLDB server mode.The hsqldb docs says it can be access in multiple thread:
Code:
The database engine runs in a JVM and listens for connections from programs on the same computer or other computers on the network. Several different programs can connect to the server and retrieve or update information.


I use Tomcat and DBCP connection pool.
config is:
Code:
<property name="connection.datasource">java:comp/env/jdbc/LiferayPool</property>
      <property name="connection.provider_class">net.sf.hibernate.connection.DBCPConnectionProvider</property>
      
      <property name="hibernate.dbcp.maxActive">100</property>
        <property name="hibernate.dbcp.whenExhaustedAction">1</property>
        <property name="hibernate.dbcp.maxWait">120000</property>
        <property name="hibernate.dbcp.maxIdle">10</property>

      
      <property name="cache.provider_class">net.sf.hibernate.cache.HashtableCacheProvider</property>


It is in the WEB-INF/lib. And another database is lportal. In tomcat conf:
Code:
<parameter>
         <name>driverClassName</name>
         <value>org.hsqldb.jdbcDriver</value>
      </parameter>
      <parameter>
         <name>url</name>
         <value>jdbc:hsqldb:hsql://localhost/lportal;shutdown=true</value>
      </parameter>
      <parameter>
         <name>username</name>
         <value>sa</value>
      </parameter>
      <parameter>
         <name>password</name>
         <value></value>
      </parameter>
      <parameter>


The C3P0 connection pool also get the same error. Why?
Could someone help.Thks!

_________________
You are not alone...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.