I'm deploying two ear applications to Jboss AS 5.1.0, which both use scoped class loading. These two applications include their own DB drivers; each a different version of the PG JDBC jar. They also both package the datasource within the ear.
The problem is that with scoped class loading, the datasource deployer can't find the driver packaged with each ear anymore. Knowing that datasources end up in a global JDNI tree makes this somewhat understandable, but from an end-user perspective this makes less sense. The datasource and the driver are both packaged in the ear, but the deployer wants both to be globally available, even when scoped class loading is specifically requested by the user.
It gets a little worse when a PU is used for which second level caching is configured. In that case, the jar with the cache implementation also needs to be globally available, which kind of defeats the purpose of scoped class loading.
Is there a way around this problem? I.e. can I somehow tell the deployer to look for the driver and cache implementation inside the ear that also packaged the datasource that it is attempting to deploy?