users@glassfish.java.net

Re: Application in ear does not load log4j.xml as expected

From: Sivakumar Thyagarajan <Sivakumar.Thyagarajan_at_Sun.COM>
Date: Fri, 13 Apr 2007 11:45:28 +0530

Great to know that it now works for you.

> The sun-ejb-jar.xml is packaged into the EJB jar during the module packaing.
> But the application id: "core" is provided at deployment time..
> A little bit not good...
>
> Is anyway way to overcome this situation?
> eg: specifying that, the resource-adapter-mid is relative to the EAR...
>

No, unfortunately that [using appid#raid] is the only way an MDB could
listen to an embedded resource adapter.

> I now packaged both the mdb jar and genericra.rar inside the ear.
> All deps lib is put in lib/
>
> I shall tidy up this info and repost it somewhere when I have time!!

That would be great. If you can, please update this forum thread with the
url or send a mail to
users_at_glassfish.dev.java.net/users_at_genericjmsra.dev.java.net

Thanks
--Siva.

glassfish_at_javadesktop.org wrote:
> Hi Siva,
>
> Thanks very much, the problem is solved,
> I finally put the rar inside my ear.
>
> Only one minor problem, in the sun-ejb-jar.xml (of the MDBs)
> I have the following stuff:
> <mdb-resource-adapter>
> <resource-adapter-mid>core#genericra</resource-adapter-mid>
> <activation-config>
> [snip...]
>
> The sun-ejb-jar.xml is packaged into the EJB jar during the module packaing.
> But the application id: "core" is provided at deployment time..
> A little bit not good...
>
> Is anyway way to overcome this situation?
> eg: specifying that, the resource-adapter-mid is relative to the EAR...
>
>
>>> If yes, and if connector classloader have loaded
>> one class (LogFactory) when deploying
>>> the RA module, subsequently, when loading of the
>> EAR trigger a resolve of LogFactory.
>>> The EAR will using the instance of LogFactory which
>> are loaded by the connector classloader.
>> That is right.
>>
>>> In the above scenario, the LogFactory will load
>> Log4jAdapter, and then the log4j.xml
>>> when loading the rar.
>>>
>> Right. Does your connector module logs messages using
>> log4j?
>
> Yes.
> As I use ActiveMQ, genericra deps amq on classpath, while,
> amq deps commons-logging in classpath.
>
> For our apps, most deps also deps on commons-logging, most notably,
> spring and hibernate..
>
>
>>> Can I package the rar inside the EAR.
>>> If package RAR inside EAR is legal and supported,
>>> then, both the EJB module and RAR module will live
>> in the same Classloader
>>> universe.. and my problem can also be solved...
>>> Is it viable?
>>>
>> Yes you can and it is referred to as an embedded
>> resource adapter. Such a
>> resource adapter is visible only to that application.
>
> Thanks very much!
> That's my solution.
>
> I now packaged both the mdb jar and genericra.rar inside the ear.
> All deps lib is put in lib/
>
> I shall tidy up this info and repost it somewhere when I have time!!
>
> Once again, thanks very much!!
>
> Best regards,
> Zarick
> [Message sent by forum member 'zarick' (zarick)]
>
> http://forums.java.net/jive/thread.jspa?messageID=212237
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>