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

Jason T. Greene jason.greene at redhat.com
Tue Mar 22 15:49:40 EDT 2011


On 3/22/11 2:42 PM, Andrig Miller wrote:
>
>
> ----- 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:40:06 PM Subject: Re: Question
>> about EAR's and Class Loading On 03/22/2011 02:29 PM, Andrig Miller
>> wrote:
>>> So, I got past the class not found exception for logging (I
>>> actually had to add org.jboss.logmanager export), since I was
>>> using the logmanager.
>>
>> BTW we've been discussing this one - I think we're going to set it
>> up so that manifest Dependencies at the EAR level are copied into
>> their constituent deployments, since this is probably what users
>> will expect will happen ("export" has certain potentially
>> undesirable side-effects with regards to class-path references
>> between deployment units). So expect the "export" to be no longer
>> necessary in Beta2.
>>
>
> Excellent.  That will be nice.
>
>>> So, after getting past that, and successfully creating a module
>>> for MySQL and defining my data source, I know have another
>>> interesting issue with my ear file.
>>>
>>> I get the following:
>>>
>>> Caused by: java.lang.ClassNotFoundException:
>>> services.entities.Product from [Module
>>> "deployment.OrderManagerApp.ear.OrderManagerEJB.jar:main" from
>>> Service Module Loader]
>>>
>>> So, my ear is constructed in a fairly simple manner, and the same
>>> as it was for AS 5/6. I have an OrderManagerEntities.jar that has
>>> the entities in them, including the services.entities.Product
>>> that its complaining about, and that jar is in the ear, but the
>>> stateless session beans in OrderManagerEJB.jar reference it. It
>>> appears that there is not proper visibility to the entities in
>>> the other jar of the ear, and it cannot find it.
>>
>> 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.

Are you using <java> for that? That was a common misused trick that 
still works in 5/6. The spec says that <java> is supposed to refer to 
application clients, and that deployments in the EAR should not see 
application clients' classes.

-- 
Jason T. Greene
JBoss, a division of Red Hat



More information about the jboss-as7-dev mailing list