-
1. Re: Help Understanding AS-7 Classloading
beve Apr 27, 2012 7:47 AM (in response to foutjo)Hi,
Do I need a jboss-deployment-structure.xml file?
You need to specify that your EJB depends on the 'com.thoughtworks.xstream' module that you have created. This can be done either by packaging a jboss-deployment-structure.xml in the META-INF directory of your EJB, or you can specify a manifest header as described here:
https://docs.jboss.org/author/display/MODULES/Manifest+module+information
Regards,
/Daniel
-
2. Re: Help Understanding AS-7 Classloading
sfcoy Apr 27, 2012 7:48 AM (in response to foutjo)Any particular reason you're not packaging it in your EAR file?
-
3. Re: Help Understanding AS-7 Classloading
foutjo Apr 27, 2012 8:13 AM (in response to beve)Thanks Daniel.
I used the jboss-deployment-structure.xml approach and it worked like a charm.
-
4. Re: Help Understanding AS-7 Classloading
foutjo Apr 27, 2012 8:18 AM (in response to sfcoy)Stephen not being an expert my understanding of an .ear file was the following:
It contains both the .war (Web Archive) file containing the web component of the application as well as the .jar file.
Since my application contained no web archive I left the application be just the .jar file.
Not sure how that would have helped me with my problem.
Does the .ear file create the jboss-deployment-structure.xml for you?
-
5. Re: Help Understanding AS-7 Classloading
beve Apr 27, 2012 8:49 AM (in response to foutjo)Not sure how that would have helped me with my problem.
You can package your application into an ear even if it does not contain a web app. With an EAR you can specify a deployment descriptor element in META-INF/application.xml, named 'library-directory'. This specifies the directory where your xstream.jar file can be placed. The default location is 'lib' so if you are happy with that location then just put the xstream.jar into the lib directory of your ear. This will give you a portable solution.
Regards,
/Daniel
-
6. Re: Help Understanding AS-7 Classloading
foutjo Apr 27, 2012 8:55 AM (in response to beve)Thanks for the EAR explanation Daniel.
I am having one more problem with dependencies that I have to resolve.
I am not getting the following class not found error:
java.lang.NoClassDefFoundError: org/xml/sax/SAXException
XStream uses sax so I'm not sure how I go about defining the depenency of Xstream for org/xml/sax.
I thought sax was part of Java.
Any idea on how I would support sax from within xstream?
Thanks.
-
7. Re: Help Understanding AS-7 Classloading
beve Apr 27, 2012 9:05 AM (in response to foutjo)I think you'll need to add a dependency from the module.xml that you created:
<module> ... <dependencies> <module name="javax.api"/> </dependencies> </module>
Regards,
/Daniel
-
8. Re: Help Understanding AS-7 Classloading
sfcoy Apr 27, 2012 9:40 AM (in response to foutjo)If you put your jar in the EAR/lib directory then your EJB's will be able to see it and you will not need to use a module or jboss-deployment-structure.xml.
This is standard JEE behaviour, and it has way less moving parts. Only make it as complicated as it needs to be.
-
9. Re: Help Understanding AS-7 Classloading
foutjo Apr 27, 2012 9:43 AM (in response to sfcoy)Thanks Stephen.
Obviously I want to make this as less complicated as I can.
Is there some documentation that you would recommend on how to create a correctly formatted ear file?
I have never created one before.
Thanks.
-
10. Re: Help Understanding AS-7 Classloading
sfcoy Apr 27, 2012 10:22 AM (in response to foutjo)You can find a list of all of the Jave EE 6 specifications at Java EE 6 Technologies
Download the one at the top (JSR-316) and have a look at Chapter EE.8.
-
11. Re: Help Understanding AS-7 Classloading
foutjo Apr 27, 2012 10:41 AM (in response to sfcoy)Thanks.