Diese Regel markiert die Verwendung der
weblogic.transaction.TransactionHelper getUserTransaction()
Methode.
Die Implementierung dieser Methode muss für WebSphere Application Server migriert werden.
Verwenden Sie anstelle der WebLogic-spezifischen Methode getUserTransaction() den folgenden Code.
< 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() {
Eigenschaften props = new Eigenschaften();
props.put(Kontext.INITIAL_CONTEXT_FACTORY, getInitialContextFactoryName ());
props.put(Kontext.URL_PKG_PREFIXES, "com.ibm.ws.runtime:com.ibm.ws.naming");
props.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
return props;
}
Weitere Informationen enthält der Artikel
Globale Transaktionen für Network Deployment.