[jboss-user] [EJB 3.0] - Re: Problem with TimerService

agenttokyo do-not-reply at jboss.com
Tue Apr 22 20:20:11 EDT 2008


"hasc" wrote : Hi,
  | 
  | i posted this question already in the seam forum, but i was told I should post the question here again...
  | 
  | I wrote a simple stateless bean to test the TimerService. i am using jboss 4.2.0GA
  | 
  | 

I hope you long ago solved your issue =)  Bit since I saw this problem a number of places w/out a solution I'm commenting here.

I ran into this moving from Jboss 4.0.5 to 4.2.2 using Postgresql 8.1

Your DS doesn't support the XA interface.  I assume there is a way to do this in HSQL as well but found no answer (I saw no XA DataSource in the hsqldb.jar)?  But... here is my solution.

In my postgres-dx.xml I had the usual local-tx-datasource, which was used for my entities.  I then added the xa-datasource 


  | <datasources>
  |   <local-tx-datasource>
  |     <jndi-name>PostGresDS</jndi-name>
  |     <connection-url>jdbc:postgresql://localhost:5432/blah</connection-url>
  |     <driver-class>org.postgresql.Driver</driver-class>
  |     <user-name>user</user-name>
  |     <password>password</password>    
  |   </local-tx-datasource>
  | 
  |   <xa-datasource>
  |     <jndi-name>XAPostGresDS</jndi-name>
  |     <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
  |     <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
  |     <xa-datasource-property name="DatabaseName">blah</xa-datasource-property>
  |     <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
  |     
  |     <xa-datasource-property name="User">user</xa-datasource-property>
  |     <xa-datasource-property name="Password">password</xa-datasource-property>
  | 
  |     <metadata>
  |       <type-mapping>PostgreSQL</type-mapping>
  |     </metadata>
  |   </xa-datasource>
  | </datasources>
  | 

The type-mapping is from standardjbosscmp-jdbc.xml

The configuration parameters were identifed in http://wiki.jboss.org/wiki/ConfigDataSources the wiki

And in your ejb-deployer, you should use your newly configured datasource (in my case XAPostGresDS)


  |   <mbean code="org.jboss.ejb.txtimer.DatabasePersistencePolicy" name="jboss.ejb:service=EJBTimerService,persistencePolicy=database">
  |     <!-- DataSourceBinding ObjectName -->
  |     <depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=XAPostGresDS</depends>
  |     <!-- The plugin that handles database persistence -->
  |     <attribute name="DatabasePersistencePlugin">org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin</attribute>
  |     <!-- The timers table name -->
  |     <attribute name="TimersTable">TIMERS</attribute>
  |   </mbean>
  | 

I think thats about it.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146006#4146006

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146006



More information about the jboss-user mailing list