关于具有下列激活功能的Docker图像open-liberty:22.0.0.1-full-java17-openj9:
<featureManager>
<feature>persistence-3.0</feature>
<feature>localConnector-1.0</feature>
<feature>microProfile-5.0</feature>
<feature>beanValidation-3.0</feature>
</featureManager>和javax命名空间,可以通过api依赖项创建TransactionManager。
compileOnly "com.ibm.websphere.appserver.api:com.ibm.websphere.appserver.api.transaction:1.1.60"以下列方式:
package de.xxx.xxx;
import com.ibm.tx.jta.TransactionManagerFactory;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.transaction.TransactionManager;
@RequestScoped
public class TransactionManagerProducer {
@Produces
public TransactionManager produce() {
return TransactionManagerFactory.getTransactionManager();
}
}我们将迁移到JakartaEE9,而这个API依赖项似乎没有与雅加达.*命名空间等效的API,因此这是而不是编译:
package de.xxx.xxx;
import com.ibm.tx.jta.TransactionManagerFactory;
import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.transaction.TransactionManager;
@RequestScoped
public class TransactionManagerProducer {
@Produces
public TransactionManager produce() {
return TransactionManagerFactory.getTransactionManager();
}
}在openliberty中,请参见https://repo1.maven.org/maven2/io/openliberty/openliberty-runtime/22.0.0.1/openliberty-runtime-22.0.0.1.zip --与
wlp\dev\api\ibm\com.ibm.websphere.appserver.api.transaction_1.1.60.jar (javax.*)可在此查阅:
wlp\dev\api\ibm\io.openliberty.transaction_1.1.60.jar (jakarta.*)但是我似乎找不到适合io.openliberty.transaction包的API。有人知道如何访问TransactionManagerFactory吗?任何帮助都是非常感谢的。
--更新:,直到API包可用为止,我选择通过反射创建TransactionManager:
package de.xxx.xxx;
import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.transaction.TransactionManager;
import java.lang.reflect.InvocationTargetException;
@RequestScoped
public class TransactionManagerProducer {
@Produces
public TransactionManager produce() {
try {
return (TransactionManager)
Class.forName("com.ibm.tx.jta.TransactionManagerFactory")
.getDeclaredMethod("getTransactionManager")
.invoke(null);
} catch (ClassNotFoundException
| NoSuchMethodException
| InvocationTargetException
| IllegalAccessException e) {
throw new IllegalStateException("TransactionManager could not be created");
}}}
发布于 2022-03-15 15:47:41
对于22.0.0.3,api最终正确发布在这里:https://repo.maven.apache.org/maven2/io/openliberty/api/io.openliberty.transaction/1.1.62/
发布于 2022-02-14 14:26:55
这里的问题是,从io.openliberty开始的API和SPI包没有作为发布新版本时运行的自由发布任务的一部分发布到DHE和maven。我们希望通过22.0.0.2来解决这个问题,如果我们没有遇到任何额外的障碍,并且io.openliberty发布进行得很顺利的话,它明天就可以使用了。
https://stackoverflow.com/questions/71112630
复制相似问题