I am trying to import objects from EAR1 into EAR2, so I can create new instances without duplicating code.
I am looking through this quickstart to see if that is what I need. In the meantime, let me explain in more detail what I want to do:
I have two separate EAR files which I started as two seperate "ear-kitchensink" quickstarts:
Now, for EAR2 I would like to extend classes Venue.java and VenueController.java without having to copy all the code. Is that possible?
AFAIK the only way to do so is to create a separate module and set a dependency for both EAR.
Can you elaborate on that? I am fairly new to JBoss.
You might have a look into the quickstart log4j (#44) which demonstrates how to add a reference to a module.
A module is one (or more) simple jar archive that is located in the JBOSS/modules directory. You might add archives you want as module and add references to applications that are need it.
See the datasource example, there is the JDBC drived added as module.
How can I add a jar that is already in a deployment? Let me explain how I tried to do it. I have:
I placed a jboss-deployment-structure.xml into the top level of one-ear.ear META-INF and it is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<module name="deployment.two-ear.ear.two-ejb-0.0.1-SNAPSHOT.jar" />
However I am not sure it is actually importing classes from that jar, because when I try to import a class it does not work. Not sure what I am doing wrong.
You can't set a dependency to a jar in a different deployment. You need to add the jar as a module and set a dependency for boh ear's