Ich versuche, zu Transaktion-API 1.2 statt JTA 1.1 zu migrieren.Mule/Spring ClassLoader Problem beim Migrieren zu transaction-api 1.2
Während ich weiß, kann ich mule bereitgestellten libs anpassen Ich kann nicht verstehen, warum die Anwendung nicht funktioniert, indem Sie nur Transaktion-API zum application/lib-Ordner hinzufügen. Ohne transaktions api alles funktioniert wie erwartet, aber damit ich:
Caused by: java.lang.ClassNotFoundException: javax.transaction.Transactional
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_66]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_66]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_66]
at org.springframework.transaction.annotation.JtaTransactionAnnotationParser.parseTransactionAnnotation(JtaTransactionAnnotationParser.java:42) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor$CustomAnnotationTransactionAttributeSource.determineTransactionAttribute(TransactionalRepositoryProxyPostProcessor.java:229) ~[?:?]
at org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor$CustomAnnotationTransactionAttributeSource.findTransactionAttribute(TransactionalRepositoryProxyPostProcessor.java:208) ~[?:?]
at org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor$AbstractFallbackTransactionAttributeSource.computeTransactionAttribute(TransactionalRepositoryProxyPostProcessor.java:397) ~[?:?]
at org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor$AbstractFallbackTransactionAttributeSource.getTransactionAttribute(TransactionalRepositoryProxyPostProcessor.java:345) ~[?:?]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE]
Hier sind einige relevante snippers von Spring-Code.
spring-data-commons
(application/lib):
if (jta12Present) {
this.annotationParsers.add(new JtaTransactionAnnotationParser());
}
wo:
private static final boolean jta12Present = ClassUtils.isPresent("javax.transaction.Transactional",
CustomAnnotationTransactionAttributeSource.class.getClassLoader());
- scheint, wie diese Prüfung bestanden, wenn transaktions api zur Anwendung hinzugefügt wird.
JtaTransactionAnnotationParser
kommt von mule-supplied spring-tx (MULE_HOME \ lib \ opt). Dies ist, wo es eine Ausnahme auslöst:
public class JtaTransactionAnnotationParser implements TransactionAnnotationParser, Serializable {
@Override
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement ae) {
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(ae, javax.transaction.Transactional.class); - ClassNotFoundException
Warum kann Transactional an einem Ort Frühling identifiziert, kann aber nicht in einem anderen? Es scheint, dass Spring-Data-Commons und Spring-Tx in verschiedenen Bereichen den Grund dafür darstellen können, aber ich verstehe nicht warum, weil Mule eine komplexe hierarchische ClassLoader-Struktur bereitstellen und die gesamte Hierarchie durchsuchen soll.