Question

I make a custom mediator class that used spring jdbc to access data from database.
I make a jar from that class and deploy it in WSO2_HOME/repository/components/lib.
After that I add the following jar to the same folder :
spring-jdbc.jar,
spring-tx.jar.

But when I tried the custom mediator there is an error "ClassNotFoundException org\springframework\transaction\support\TransactionSynchronization".

The problem is I'm pretty sure that "TransactionSynchronization" class is available in the spring-tx.jar. Can anyone help me to solve this problem? :)

Was it helpful?

Solution

One reason may be there are two packages in your class path which has the same 'TransactionSynchronization' class. Can you try the below.

  1. What do you have in your WSO2_HOME/repository/components/dropins directory? Delete all jars inside dropins and restart the server and recheck for the issue.

  2. If the error is still there try deleting spring-tx.jar from WSO2_HOME/repository/components/lib & WSO2_HOME/repository/components/dropins. Then restat the server. Then check whether you are getting the same error or different error?

OTHER TIPS

I am experiencing the same behavior. I have a custom spring mediator that calls out to a database for role based authNZ. I am running esb v 4.7.0.

I downloaded spring-tx-3.1.0.RELEASE.jar from the maven repository and copied it to /usr/local/wso2/wso2esb-4.7.0/repository/components/lib in my environment, then restarted the ESB. When I issue requests to my proxy service, the same class not found exception occurs.

I was examining jar contents today and when I checked the spring-tx jar in /usr/local/wso2/wso2esb-4.7.0/repository/components/lib, the class in present:

jar tf spring-tx-3.1.0.RELEASE.jar | grep TransactionSynchronization
org/springframework/transaction/support/TransactionSynchronization.class

When I do the same in /usr/local/wso2/wso2esb-4.7.0/repository/components/dropins after restart of the esb, the class is not present:

jar tf ../dropins/spring_tx_3.1.0.RELEASE_1.0.0.jar 
spring-tx-3.1.0.RELEASE.jar
META-INF/
META-INF/p2.inf
META-INF/MANIFEST.MF

Notice that the spring-tx jar is not included in the OSGi bundle after restart of Synapse.

I will investigate further tomorrow, including building an OSGi bundle that contains the Spring dependencies I need via Eclipse

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top