users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Thu, 12 Apr 2007 21:05:23 PDT

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