[
https://issues.jboss.org/browse/AS7-1769?page=com.atlassian.jira.plugin.s...
]
Bruno Borges commented on AS7-1769:
-----------------------------------
It is important to note that the <package> scanner on orm.xml doesn't work when
the classes are not inside the JAR containing persistence.xml and orm.xml. So maybe this
problem could be solved starting from here?
# About the DAOS idea:
This is how we tell JBoss to set the PU as global:
<!-- Global Persistence Unit at JBoss -->
<property name="jboss.entity.manager.jndi.name"
value="java:/myPersistenceUnit" />
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/myPersistenceUnitFactory" />
Must we do something else to set a PU as global? I don't think so. I rather keep doing
this way. So the problem comes back to ClassLoading and intra-TL-deployment dependency. A
PU module that aims to be shared must not export its META-INF, and a developer should not
add anything to it except XML files related to the persistence unit, to avoid loading
extra PUs. JBoss could be smart about implicit excluded path at the exports though.
I couldn't figure out how this DAOS would be defined in my pu-module.jar, but I think
it shouldn't at all. I already provide enough information to JBoss (properties) that
tells it to share my PU.
Please let me know if I'm out of my mind...
PU Injection across JARs (separate DeploymentUnits)
---------------------------------------------------
Key: AS7-1769
URL:
https://issues.jboss.org/browse/AS7-1769
Project: Application Server 7
Issue Type: Feature Request
Components: JPA / Hibernate
Affects Versions: 7.0.1.Final, 7.1.0.Final, 7.1.1.Final
Environment: Linux, Window, MacOS, *BSD
Reporter: Nikos Ballas
Labels: new_and_noteworthy
the following architecture of jars/wars doesn't load correctly in JBossAS 7 but it
was used to load perfectly in all previous versions...i know about the new loading way so
i am explaining the scenario:
myjar-model.jar : Contains entities and the persistence.xml which defines also a
persistence unit inside the META-INF folder.
myjar-buisness.jar: Contains EJB's and Spring beans that uses the model.There is
an annotation with @PersistenceContext(name="mypu") on this EJB's for the
entity manager to work. The jboss-deployment-structure.xml has declared dependency in the
deployment.mcube-model.jar.
I am copying both of these files first the model and then the buisness in the standalone
profile in deployments folder.The first one is loaded successfully.The second one that
also uses classes from the previous one can see the classes but not the pu need it for the
db operations.The exception follows:
[code]
10:33:49,369 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed
to start service jboss.deployment.unit."myjar-buisness.jar".INSTALL:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."mcube-buisness.jar".INSTALL: Failed to process phase
INSTALL of deployment "myjar-buisness.jar"
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
at
org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Component
class ***.**.GenericDAOImpl for component MyBean has errors:
Can't find a deployment unit named myjar-persistence at deployment
"myjar-buisness.jar"
at
org.jboss.as.ee.component.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:133)
at
org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:52)
at
org.jboss.as.ee.component.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:129)
at
org.jboss.as.ee.component.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:122)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
[/code]
Following scenario/arcs:
Web application which is assembled by 4 different jars/wars:
(1)myapp-model.jar -> contains the model + persistence.xml containing the definition
of a CMT.
(2)myapp-buisness.jar -> contains buisness EJB3's Spring Beans, whatever you can
think of.
(3)myapp-messaging.jar -> Contains MDB's for sending messages to several queues.
(4)myapp-console.war -> Contains the web interface of the app.
Now the -> define a dependency from a project to another to function,i.e. A->B
means that A project has a dependency in B. Now the graph of dependencies between projects
are:
(4)->(2)->(1).
Currently in jboss as 7 you are able to deploy your application either as module exposing
several services(even though there is no clear documentation on how you do that.You follow
the old way, you have to do something else?Nowhere in any documentation isn't that
documented.) or you can use the deployments folder and copy everything there.Given the
previous scenario if we deploy the module(2) then even if we have as dependency in the
jboss-deployment-structure.xml the reference to the module(1) then we will get an
exception saying that the persistence unit defined isn't accessible or undefined for
the module(2). Now with the new version of jboss that allow us to manipulate the
dependencies using the module mechanism and the well defined deployment and dependencies
between projects it would be really useful if.
When we define a dependency from one module to another, in my example from (2)->(1),
also the mcs services defined are also exported in the target deployment, thus allowing
access to the pu with the name for example is deployed. I don't know if this can be
applied for the module architecture also.
regards
Nick
--
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