Cette règle marque l'utilisation de la méthode weblogic.transaction.TransactionHelper getUserTransaction(). L'implémentation de la méthode doit migrer pour être utilisée dans WebSphere Application Server.
SolutionUtilisez le code ci-après au lieu de la méthode WebLogic-specific 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(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; } |
Pour plus d'informations, voir Transactions globales.