この規則により、以下の使用にフラグを立てます。
weblogic.transaction.TransactionHelper getUserTransaction()
メソッド。
WebSphere Application Server 上で使用できるように、このメソッドの実装をマイグレーションする必要があります。
WebLogic 固有の getUserTransaction() メソッドの代わりに以下のコードを使用します。
< span class="Code"> < span class= "JavaKeyword"> public static < /span> < span class="JavaType">UserTransaction< /span> getUserTransaction () {
UserTransaction txn = null;
try {
Properties params = getInitialContextProperties( );
javax.naming.InitialContext ctx = new javax.naming.InitialContext(params );
txn = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
} catch(Throwable t) {
t.printStackTrace();
}
return txn;
}
public static Properties getInitialContextProperties() {
Properties props = new Properties ();
props.put (Context.INITIAL_CONTEXT_FACTORY, getInitialContextFactoryName( ));
props.put (Context.URL_PKG_PREFIXES, " com.ibm.ws.runtime:com.ibm.ws.naming ");
props.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
return props;
}
詳しくは、
グローバル・トランザクション (Network Deployment) を参照してください。