Hello Felows,

I'm trying to use the H2 in embedded mode with JBOSS. No errors occur when
starting the AS, but occurs when I try to connect the H2. I've done MANY
Google searches and found little information.

Below the error:

10:48:22,573 INFO  [STDOUT] H2ClienteDAO.initDb()
10:48:24,001 WARN  [JBossManagedConnectionPool] *Throwable while attempting
to get a new connection: null*
org.jboss.resource.JBossResourceException: Could not create connection; -
nested throwable: (org.h2.jdbc.JdbcSQLException: *Connection is broken:
"session closed" [90067-131])*
    at
org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:155)
    at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:619)
    at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:264)
    at
org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:575)
    at
org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:347)
    at
org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:330)
    at
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
    at
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
    at
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
    at dixtal.basico.server.PersistenciaContainer.getPersistencia(Unknown
Source)
    at dixtal.basico.server.AbstractSqlDAO.getConnection(Unknown Source)
    at dixtal.sgdb.h2.model.H2DatabaseDAO.initDb(H2DatabaseDAO.java:31)


Below is the code of the routine that tries to connect.

  public Object getPersistencia() {
    try {
      InitialContext ic = new InitialContext();
      javax.sql.DataSource ds = (javax.sql.DataSource)
ic.lookup("java:/H2Ds");
      return ds.getConnection();

    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }

Attached the h2-xa-ds.xml.




Ricardo Santana Tatsch
Development Analyst / P & D
(55+51) 3019-4625
[email protected]/tatsch_dixtal
Dixtal Biomédica

Philips Healthcare Cardiac and Critical Care

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

<?xml version="1.0" encoding="UTF-8"?>

<datasources>
    <xa-datasource>
		    <jndi-name>H2Ds</jndi-name>
		    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
		    <xa-datasource-property name="URL">jdbc:h2:tcp://localhost:9092/${jboss.server.data.dir}$/data/DixtalDB;</xa-datasource-property>
		    <xa-datasource-property name="User">sa</xa-datasource-property>
		    <xa-datasource-property name="Password"></xa-datasource-property>

		    <min-pool-size>5</min-pool-size>
		    <max-pool-size>20</max-pool-size>

		    <idle-timeout-minutes>5</idle-timeout-minutes>

		    <prepared-statement-cache-size>32</prepared-statement-cache-size>
		    <!--depends>jboss:service=H2Ds</depends-->	

    </xa-datasource>
</datasources>


<!--datasources>
   <xa-datasource>
		<jndi-name>HelloworldTxSqlDB</jndi-name>
		<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
		<track-connection-by-tx/>
		<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
		<xa-datasource-property name="URL">jdbc:h2:tcp://localhost:9095/;DB_CLOSE_ON_EXIT=FALSE</xa-datasource-property>
		<xa-datasource-property name="User">sa</xa-datasource-property>
		<xa-datasource-property name="Password"></xa-datasource-property>
		<min-pool-size>5</min-pool-size>
		<max-pool-size>20</max-pool-size>
		<idle-timeout-minutes>0</idle-timeout-minutes>
		<prepared-statement-cache-size>32</prepared-statement-cache-size>
		<depends>jboss:service=HelloworldTxSqlDB</depends>	
	</xa-datasource>

<datasources-->

Reply via email to