Hi all,
I have deployed a JRA (Java resource adapter) via an EAR file - this includes the relevant JAR files.
From my portal application, I am using a JNDI lookup to successfully get a connection from the connection factory created by doing the above.
Within my portal application, I am trying to use the relevant implementation classes - these are the same classes that live in the JRA.
I receive the following issue:
java.lang.ClassCastException: Cannot cast class com.attunity.adapter.AttuInteractionSpec to class com.attunity.adapter.core.CoreInteractionSpec (found matching super class com.attunity.adapter.core.CoreInteractionSpec loaded by bp.com/<dc-name>@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@36ece5f3@alive, but needed loader JavaEE/<different-dc-name>@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@12478ec1@alive
I am able to navigate this error by forcing the same classLoader.
ClassLoader classLoader = interaction.getClass().getClassLoader();
Class<?> clazz = classLoader.loadClass("com.attunity.adapter.AttuInteractionSpec");
Constructor constructor = clazz.getConstructor(String.class);
Object interactionSpec = constructor.newInstance("functionname");
This is obviously not ideal, and results in the same issue, in reverse, when I try and deal with the returned data (using Attunity classes). I can again navigate this issue using reflection - but this gets messy.
I have tried using a PrivateSharingReference to 'com.attunity.adapter' - which stops the application from starting up, as it expects the classes to live under SAPPORTAL/com.attunity.adapter. I've also tried creating a PrivateSharingReference to the container EAR file of the JRA (<propertyname="PrivateSharingReference"value="SAPJ2EE::bp.com/<application-name>"/> )- this doesn't throw any errors but also results in the same class loader issue.
Am I missing something?
Any suggestions would be much appreciated!