Hi,
I'm currently developing a JCA adapter using Apache Geronimo 2.1. However, I need to run it on an IBM WebSphere which proved to be a major classloading nightmare. (Need some 3rd party libs that clash with WebSphere versions).
Therefore I try to evaluate Jencks as alternative to move the adapter to a WAR so that I can activate the protection classloader in WS.
So I have setup a new maven project depending on the JAR of the RAR project and on Jencks 2.1 plus Spring 2.5.5.
I use the following application.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans"
>
<bean id="transactionManager" class="org.jencks.factory.TransactionManagerFactoryBean" />
<bean id="connection-manager" class="org.jencks.factory.ConnectionManagerFactoryBean">
<property name="transactionManager" ref="transactionManager"></property>
</bean>
<!-- do I need this?
<bean id="jca-container" class="org.jencks.JCAContainer">
<property name="bootstrapContext" ref="bootstrap-context"></property>
<property name="workManager" ref="work-manager"></property>
<property name="transactionManager" ref="transactionManager"></property>
<property name="resourceAdapter" ref="abcd-resource-adapter"></property>
</bean>
-->
<bean id="abcd-resource-adapter" class="com.example.ResourceAdapterImpl">
<property name="some" value="value"></property>
</bean>
<bean id="con-factory-factory-bean" class="org.jencks.factory.ConnectionFactoryFactoryBean">
<property name="managedConnectionFactory" ref="CONN"></property>
<property name="connectionManager" ref="connection-manager"></property>
</bean>
<bean id="CONN" class="com.example.ManagedConnectionFactoryImpl">
<property name="some.other" value="value"></property>
<property name="resourceAdapter" ref="abcd-resource-adapter"></property>
</bean>
</beans>
Now, when starting this as a standalone application like
ApplicationContext ctxt = new ClassPathXmlApplicationContext("application.xml");
The ManagedConnectionFactoryImpl throws an exception on setRessourceAdapter() (from interface RessourceAdapterAssociation):
Caused by: java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to java.lang.Exception
More details: the resource adapter internally uses a picocontainer and the setResourceAdapter() method attaches a child container and starts the child container. The exception occurs on starting the child container.
Now, the exception looks like a classloader problem to me. Just that I don't understand which classloader interact here, mind that this is stand alone - no JEE container involved.
Second, is the configuration correct?