I've run into a wierd problem with a pair of JCA adaptors that I created and have working on Weblogic, and kinda working on JBoss. By "kinda" I mean (described below) I can coax the adaptors into working, but normally I get an IllegalAccessException.
Adaptor 1: RealConnector (name changed to protect the guilty)
Adaptor 2: ProxyConnector (ditto about the name)
The idea is that RealConnector is deployed on a J2EE instance that really has access to some device or service. On the other hand ProxyConnector is deployed for instances that don't have direct access to the device. A servlet is deployed with RealConnector that ProxyConnector can talk to. Both the RealConnector and ProxyConnector have rar files and *-service.xml files for configuration.
Both rar files have almost identical collections of Java files, because both RealConnector and ProxyConnector do a lot of the same things (except for the actual mechanics of talking to the external device).
The easiest and most obvious way of testing this is to deploy RealConnector, ProxyConnector, and the servlet all on the same J2EE instance and create JUnit tests to stuff requests through the proxy to see what happens. The problem is that this causes an IllegalAccessException in JBoss (3.2.7), but only in one particular situation (the situation you'd most likely want to use).
If you put both rar files and both *-service.xml files in the deploy directory and start JBoss then you get IllegalAccessException.
If you put both rar files in deploy, but not the service files, start JBoss, and *slowly* put first one and then the other service file in deploy (waiting until log messages prove the mbean deployment is done), then both the JCA adaptor mbeans initialize just fine. YOU HAVE TO DO THIS EVERY TIME YOU START JBOSS. Restarting after you have the adaptors working just gets you back to the original problem of IllegalAccessException.
What I've tried:
* made sure there aren't library compatibility issues between JBoss and the code (it really only depends on its own code and standard Java/J2EE packages).
* piles of code changes, like commenting out the place where the IllegalAccessException appears - but it just moves around
* clean builds to make sure it wasn't a compilation problem, also tried two different JDK 1.4 compilers just in case of a compiler bug
* specifying a loader-repository in the *-service.xml files for each adaptor
* specifying a dependency between the *-service.xml files in the hope that it would cause one to cleanly deploy before the second one even started, but it didn't seem to work.
I'm running out of ideas. Not having mucked around that much with the details of JBoss mbean xml file configuration, one thing I'm wondering is if I specified the dependency information properly. Below is a (slightly altered) initial portion of the file for RealConnector. The file for ProxyConnector is identical except for obvious word substitutions (Real/Proxy, real/proxy) and the fact that the proxy service doesn't specify a dependency on the real service. Right about now somebody is probably about to jump up and say "that dependency is backwards"; I know. By experiment I found that deploying the Proxy first, then the Real version was what consistently worked, not the other way around (I have no idea why).
My attempt at specifying a dependency is just above the RARDeployer dependency.
<?xml version='1.0' encoding='UTF-8'?> <server> <loader-repository> com.mycompany:loader=connector-real.rar <loader-repository-config> java2ParentDelegation=false </loader-repository-config> </loader-repository> <mbean code='org.jboss.resource.connectionmanager.NoTxConnectionManager' name='jboss.jca:service=NoTxCM,name=connectorReal'> <attribute name='JndiName'>ra/connectorReal</attribute> <depends>jboss.jca:service=NoTxCM,name=connectorProxy</depends> <depends>jboss.jca:service=RARDeployer</depends> <depends optional-attribute-name='ManagedConnectionPool'> <mbean code='org.jboss.resource.connectionmanager.JBossManagedConnectionPool' name='jboss.jca:service=NoTxPool,name=connectorReal'> <depends optional-attribute-name='ManagedConnectionFactoryName'> <mbean code='org.jboss.resource.connectionmanager.RARDeployment' name='jboss.jca:service=NoTxPF,name=connectorReal'>