title: Creating an EJB Timer in Liberty
body: <p>I need to create a EJB timer (using @Schedule), but have read that this is not supported in a Websphere Liberty profile?  According to a previously posted question on StackOverflow, it wasn't supported as of 08/2013:</p>
  
  <p><a href="https://stackoverflow.com/questions/18074656/java-ee-timer-schedule-in-websphere-liberty-profile">Java EE-Timer / @Schedule in Websphere Liberty Profile</a></p>
  
  <p>Currently when I try to use the @Schedule annotation I get the following exception:</p>
  
  <pre><code>[ERROR   ] CWWKZ0004E: An exception occurred while starting the application 
  &lt;EAR&gt;. The exception message was: com.ibm.ws.container.service.state.StateChangeException: com.ibm.ws.exception.RuntimeError: java.lang.IllegalStateException: The ejbPersistentTimer feature is enabled, but the defaultEJBPersistentTimerExecutor persistent executor cannot be resolved. The most likely cause is that the DefaultDataSource datasource has not been configured. Persistent EJB timers require a datasource configuration for persistence.
  </code></pre>
  
  <p>The problem is I DO have a default data source defined.  Here is the EJB code - it is very simple because I was just trying to test out timer functionality:</p>
  
  <pre><code>import javax.ejb.Schedule;
  import javax.ejb.Stateless;
  
  @Stateless
  public class TimerBean {
  
      @Schedule(second="*/10", persistent=false)
      public void doSomething() {
          System.out.println("Hello World!");
      }
  
  }
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I changed my dataSource id to "DefaultDataSource", and now I am getting a different exceptions in my console when starting the server:</p>
  
  <pre><code>[ERROR   ] WTRN0078E: An attempt by the transaction manager to call start on a transactional resource has resulted in an error. The error code was XAER_RMERR. The exception stack trace follows: javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc.SQLServerException: Could not find stored procedure 'master..xp_sqljdbc_xa_start'.
  at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:647)
  at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServerXAResource.java:679)
  at com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.start(WSRdbXaResourceImpl.java:1189)
  at [internal classes]
  
  [ERROR   ] J2CA0030E: Method enlist caught javax.transaction.SystemException: XAResource start association error:XAER_RMERR
  at com.ibm.tx.jta.impl.RegisteredResources.startRes(RegisteredResources.java:1048)
  at [internal classes]
  Caused by: javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc.SQLServerException: Could not find stored procedure 'master..xp_sqljdbc_xa_start'.
  at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:647)
  at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(SQLServerXAResource.java:679)
  </code></pre>
  
  <p>Is this the result of the timer attempting to write to my SQL DB, and if so, is there a way to avoid this?</p>