[jboss-jira] [JBoss JIRA] (AS7-5064) Dependencies auto-activated from persistence.xml cannot be excluded in jboss-deployment-structure.xml
Craig Ringer (JIRA)
jira-events at lists.jboss.org
Mon Jun 25 06:17:13 EDT 2012
Craig Ringer created AS7-5064:
---------------------------------
Summary: Dependencies auto-activated from persistence.xml cannot be excluded in jboss-deployment-structure.xml
Key: AS7-5064
URL: https://issues.jboss.org/browse/AS7-5064
Project: Application Server 7
Issue Type: Bug
Components: Class Loading, JPA / Hibernate
Affects Versions: 7.1.1.Final
Environment: $ java -version
java version "1.7.0_03-icedtea"
OpenJDK Runtime Environment (fedora-2.2.1.fc17.8-x86_64)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 17 (Beefy Miracle)
Release: 17
Codename: BeefyMiracle
$ uname -a
Linux thehostname.localdomain 3.4.2-4.fc17.x86_64 #1 SMP Thu Jun 14 22:22:05 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Reporter: Craig Ringer
Assignee: David Lloyd
An a dependency added automatically by AS7 using persistence provider detection cannot be excluded using jboss-deployment-structure.xml . The exclusion takes effect but does so incorrectly, producing a non-functional deployment where the persistence provider module still gets activated (if present) but cannot see its own classes via the deployment's classloader.
If the persistence provider module is not present, the deployment will fail with a missing dependency even when the automatic dependency has been excluded.
This behaviour renders it apparently impossible to package a persistence provider in a deployment's /WEB-INF/lib/ directory. If you want to do automated integration testing (say, with Arquillian) that makes it pretty impractical. Additionally, the half-excluded state is clearly just broken.
DETAIL
------
JBoss's module loader automatically adds dependencies on persistence providers declared in <provider/> entries in deployments' persistence.xml files. That's fine if a module for the provider is installed, but it also adds dependencies on modules that are *not* installed.
The mapping from provider to module is in jpa/core/src/main/java/org/jboss/as/jpa/config/Configuration.java and seems to be used by jpa/core/src/main/java/org/jboss/as/jpa/processor/JPADependencyProcessor.java to add the dependency.
If a jboss-deployment-structure.xml excludes the automatically added dependency, AS7 still tries to load the module and use it. If the module isn't present (as many of the persistence provider modules aren't) this will fail the deployment.
If the module *is* present, the exclusion prevents the module from being visible on the deployment's classpath. If the persistence provider ever tries to access its classes via the classloader context of the depoyment (which it will) this will fail with ClassNotFoundException.
I'll add a test case soon.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list