[jboss-as7-dev] Question about EAR's and Class Loading

Andrig Miller anmiller at redhat.com
Tue Mar 22 15:56:14 EDT 2011



----- Original Message -----
> From: "David M. Lloyd" <david.lloyd at redhat.com>
> To: "Andrig Miller" <anmiller at redhat.com>
> Cc: jboss-as7-dev at lists.jboss.org
> Sent: Tuesday, March 22, 2011 1:51:25 PM
> Subject: Re: Question about EAR's and Class Loading
> On 03/22/2011 02:42 PM, Andrig Miller wrote:
> >> If OrderManagerEntities.jar is in the EAR's "lib" directory (or the
> >> directory you have configured as such in application.xml) then the
> >> OrderManagerEJB.jar should be able to "see" it. If not then you'll
> >> need
> >> an explicit "Class-Path" reference to it from your EJB JAR.
> >
> > No, my OrderManagerEntities.jar is not the EAR's "lib" directory,
> > its at the same level as the OrderManagerEJB.jar, and its listed as
> > an EJB module in the application.xml.
> >
> > This seems broken to me.
> 
> As a rule, we are restricting visibility by default as much as the
> spec
> allows (which may mean certain behaviors are different from AS 5/6).
> So
> the question is really, is this contrary to spec? If so, it's a bug.
> That's what we need to answer.

I think I'm doing it in a spec compliant way, but you guys can decide.

I have a war file called OrderManagerWeb.war, two EJB jar files, the first containing just the stateless, stateful and message driven beans, and the second just containing the entities, and of course the persistence.xml.  The EAR contains those three files (war and two jars), along with a META-INF and the application.xml which looks like the following:

<?xml version="1.0" encoding="UTF-8"?>

<application xmlns="http://java.sun.com/xml/ns/javaee"

	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"

		xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">

	<display-name>Order Manager Application</display-name>

	<module>

		<ejb>OrderManagerEJB.jar</ejb>

	</module>


	<module>

		<ejb>OrderManagerEntities.jar</ejb>

	</module>

	<module>

		<web>

			<web-uri>OrderManagerWeb.war</web-uri>

			<context-root>/Order</context-root>

		</web>

	</module>

</application>

That's it.

Andy

> 
> --
> - DML



More information about the jboss-as7-dev mailing list