警告: EJB5123:Rolling back timed out transaction [JavaEETransactionImpl: txId=8 nonXAResource=null jtsTx=null localTxStatus=1 syncs=[com.sun.ejb.containers.ContainerSynchronization@1004b479]] for [TimeoutSessionBean]
javax.ejb.TransactionRolledbackLocalException: Client's transaction aborted
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" version = "3.1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"> </ejb-jar>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd"> <glassfish-ejb-jar> <enterprise-beans> <ejb> <ejb-name>TimeoutSessionBean</ejb-name> <cmt-timeout-in-seconds>200</cmt-timeout-in-seconds> </ejb> </enterprise-beans> </glassfish-ejb-jar>
import java.util.logging.Level; import java.util.logging.Logger; import javax.ejb.EJBException; import javax.ejb.LocalBean; import javax.ejb.Stateless; @Stateless @LocalBean public class TimeoutSessionBean { @PersistenceContext(unitName = "warehousePU") private EntityManager em; public long timeout(long wtime) throws EJBException { try { // // (DBアクセスコード) // long start = System.currentTimeMillis(); Thread.sleep(wtime); return System.currentTimeMillis() - start; } catch (InterruptedException ex) { Logger.getLogger(TimeoutSessionBean.class.getName()).log(Level.SEVERE, "TIMEOUT ERROR", ex); throw new EJBException(ex); } } }
データ登録処理(in) { BEGIN データ取得処理 COMMIT データ処理コマンド呼び出し BEGIN データ登録処理 COMMIT }みたいな感じで