Timer not in the correct datasource - ejb2-timer-service.xml
catares Aug 30, 2011 9:13 AMHello,
my problem is, that the server (JBoss 6 Final) did not save the timer, wich I start with my application, in the correct datasource.
I have create a new datasource like this: (edesk.ds.xml)
<?xml version="1.0" encoding="UTF-8"?> <!-- ===================================================================== --> <!-- --> <!-- JBoss Server Configuration --> <!-- --> <!-- ==================================================================== --> <!-- Datasource config for Postgres --> <!-- ==================================================================== --> <datasources> <local-tx-datasource> <jndi-name>EDeskDS</jndi-name> <!-- For log4jdbc do the following --> <!-- <connection-url>jdbc:log4jdbc:postgresql://localhost:5432/xline</connection-url> --> <!-- <driver-class>net.sf.log4jdbc.DriverSpy</driver-class> --> <!-- For jamon do the following --> <!-- <connection-url>jdbc:jamon:postgresql://localhost:5432/edeskjamonrealdriver=org.postgresql.Driver</connection-url> --> <!-- <driver-class>com.jamonapi.proxy.JAMonDriver</driver-class> --> <!-- For standard Postgres do the following --> <!-- <connection-url>jdbc:postgresql://localhost:5432/xline</connection-url> --> <!-- <driver-class>org.postgresql.Driver</driver-class> --> <connection-url>jdbc:postgresql://127.0.0.1:5432/xline</connection-url> <driver-class>org.postgresql.Driver</driver-class> <user-name>postgres</user-name> <password>postgres</password> <prepared-statement-cache-size>150</prepared-statement-cache-size> <share-prepared-statements>true</share-prepared-statements> <max-pool-size>40</max-pool-size> <!-- sql to call when connection is created <new-connection-sql>some arbitrary sql</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> <metadata> <type-mapping>PostgreSQL 8.0</type-mapping> </metadata> <set-tx-query-timeout>false</set-tx-query-timeout> <query-timeout>3600</query-timeout> </local-tx-datasource> </datasources>
And in the ejb2 -timer-service.xml I defined to use this datasource for saving timer in my timerstable ejbtimer:
<?xml version="1.0" encoding="UTF-8"?> <!-- The JBoss service configuration file for the EJB deployer service. $Id: ejb2-timer-service.xml 82920 2009-01-15 17:29:45Z pgier $ --> <server> <!-- ==================================================================== --> <!-- J2EE Timer Service --> <!-- ==================================================================== --> <!-- A persistence policy that persists timers to a database. The 2 supported db persistence plugins are: org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin org.jboss.ejb.txtimer.OracleDatabasePersistencePlugin The table name defaults to "TIMERS". It can be overriden using the 'TimersTable' attribute if the persistence plugin supports it. When overriding the timers table, an optional schema can be specified using the syntax [schema.]table --> <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=EDeskDS</depends> <!-- The plugin that handles database persistence --> <attribute name="DatabasePersistencePlugin">org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin</attribute> <!-- The timers table name --> <attribute name="TimersTable">EJBTIMERS</attribute> <depends>jboss.jdbc:datasource=EDeskDS,service=metadata</depends> </mbean> <!-- A persistence policy that does not persist the timer <mbean code="org.jboss.ejb.txtimer.NoopPersistencePolicy" name="jboss.ejb:service=EJBTimerService,persistencePolicy=noop"/> --> <!-- A retry policy that uses a fixed interval in milli seconds --> <mbean code="org.jboss.ejb.txtimer.FixedDelayRetryPolicy" name="jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay"> <attribute name="Delay">100</attribute> </mbean> <!-- An EJB Timer Service that is Tx aware --> <mbean code="org.jboss.ejb.txtimer.EJBTimerServiceImpl" name="jboss.ejb:service=EJBTimerService"> <attribute name="TimerIdGeneratorClassName">org.jboss.ejb.txtimer.BigIntegerTimerIdGenerator</attribute> <attribute name="TimedObjectInvokerClassName">org.jboss.ejb.txtimer.TimedObjectInvokerImpl</attribute> <depends optional-attribute-name="RetryPolicy">jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay</depends> <depends optional-attribute-name="PersistencePolicy">jboss.ejb:service=EJBTimerService,persistencePolicy=database</depends> <depends optional-attribute-name="TransactionManagerFactory" proxy-type="org.jboss.tm.TransactionManagerFactory"> jboss:service=TransactionManager </depends> </mbean> </server>
But all the timers are saved in the defaultDS hypersonic but they should save in my EdeskDS.
Has anybody an idea what I have to do so that the server is using the correct datasource????
Please help!!!!!!!!!