此規則會標示是否使用
weblogic.transaction.TransactionHelper getUserTransaction()
方法。
該方法實作必須移轉,才能在 WebSphere Application Server 上使用。
使用下列程式碼來取代 WebLogic 專用 getUserTransaction() 方法。
public static UserTransaction 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(環境定義。INITIAL_CONTEXT_FACTORY , getInitialContextFactoryName ());
props.put(環境定義。URL_PKG_PREFIXES , "com.ibm.ws.runtime:com.ibm.ws.naming");
props.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
return props;
}
如需相關資訊,請參閱
網路部署的廣域交易。