users@glassfish.java.net

Re: Application load order error?

From: Hong Zhang <Hong.Zhang_at_Sun.COM>
Date: Wed, 25 Feb 2009 08:54:19 -0500

> You are right - beanName can't be used to link the EJB in your case. I
> overlooked your original problem description. I don't think there is
> any load order defined for deployed applications and it is something
> we are trying to explore in v3. So it is a good time to file an RFE.
>
On the loading order:
1. The loading order of the modules inside the ear will be more defined
in v3. Most likely the JavaEE 6 Platform spec will standardize this
aspect (the modules will be loaded according to their declaration order
in the application.xml)

2. The loading order of applications (Adam's case). Currently there is
no way to configure the order. However, based on the current
implementation, whichever application gets deployed first will be loaded
first. Adam: if you deploy the ear application first, and then the war
application, will the problem go away?

- Hong

> Having said that I don't understand how explicit lookup in init method
> is working all the time. If it were a timing issue, it should fail
> sometimes, right?
>
> Thanks,
> Sahoo
>
> Adam Jenkins wrote:
>
>> The web application is deployed singularly (as a stand alone WAR),
>> the ejb jar is deployed with an application client in an EAR file, so
>> the enforced loading of the EJB jar before the WAR that takes place
>> when they're in the same EAR I don't think will cover this case.
>>
>>
>> --- On *Wed, 25/2/09, Sahoo /<sahoo_at_sun.com>/* wrote:
>>
>>
>> From: Sahoo <sahoo_at_sun.com>
>> Subject: Re: Application load order error?
>> To: users_at_glassfish.dev.java.net
>> Received: Wednesday, 25 February, 2009, 3:19 PM
>>
>> That's weired, as GlassFish does load EJB modules first before
>> loading any web modules in an ear file. You are possibly hitting a
>> bug somewhere. Unless Ken can come up with some other explanation,
>> I suggest you to file a bug.
>>
>> Can you try one more alternative? Since the EJB is in the same ear
>> as the web module, can you use /beanName/ attribute as opposed to
>> /mappedName/ to link the ejb-ref to the target ejb. i.e., change
>> your code like this:
>>
>> @EJB(name="SystemBean", beanName="SystemBean")
>> private SystemRemote systemOps;
>>
>> GlassFish EJB FAQ [1] contains excellent information on use of @EJB.
>>
>> Thanks,
>> Sahoo
>>
>> [1] https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
>>
>> Adam Jenkins wrote:
>> > Removed name attribute from the @EJB annotation: No change,
>> same error
>> > Perform explicit lookup in Filter init method: works fine
>> >
>> > It looks like it's just a timing issue. The web application
>> must be starting up first, before the enterprise application with
>> the EJBs in it. And since the filters and listeners are
>> instantiated and injected on startup, it's trying to lookup an EJB
>> that isn't bound to JNDI yet.
>> >
>> > Is there anyway to tell glassfish to load the enterprise
>> application first?
>> >
>> > Cheers
>> > Adam
>> >
>> >
>> >
>> > --- On *Wed, 25/2/09, glassfish_at_javadesktop.org
>> </mc/compose?to=glassfish_at_javadesktop.org>
>> /<glassfish_at_javadesktop.org
>> </mc/compose?to=glassfish_at_javadesktop.org>>/* wrote:
>> >
>> >
>> > From: glassfish_at_javadesktop.org
>> </mc/compose?to=glassfish_at_javadesktop.org>
>> <glassfish_at_javadesktop.org
>> </mc/compose?to=glassfish_at_javadesktop.org>>
>> > Subject: Re: Application load order error?
>> > To: users_at_glassfish.dev.java.net
>> </mc/compose?to=users_at_glassfish.dev.java.net>
>> > Received: Wednesday, 25 February, 2009, 10:43 AM
>> >
>> > Not sure why the injection is failing. Can you try
>> removing the
>> > name() attribute from each of the injected fields and
>> re-running. > Also, if you do the following explicit
>> global lookup from within
>> > the filter does it work?
>> >
>> > (SystemRemote) new
>> InitialContext().lookup("ejb/SystemBean")
>> > [Message sent by forum member 'ksak' (ksak)]
>> >
>> > http://forums.java.net/jive/thread.jspa?messageID=333652
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> users-unsubscribe_at_glassfish.dev.java.net
>> </mc/compose?to=users-unsubscribe_at_glassfish.dev.java.net>
>> > </mc/compose?to=users-unsubscribe_at_glassfish.dev.java.net
>> </mc/compose?to=users-unsubscribe_at_glassfish.dev.java.net>>
>> > For additional commands, e-mail:
>> users-help_at_glassfish.dev.java.net
>> </mc/compose?to=users-help_at_glassfish.dev.java.net>
>> > </mc/compose?to=users-help_at_glassfish.dev.java.net
>> </mc/compose?to=users-help_at_glassfish.dev.java.net>>
>> >
>> >
>> >
>>
>> ------------------------------------------------------------------------
>> > Stay connected to the people that matter most with a smarter
>> inbox. Take a look
>>
>> <http://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/mail/smarterinbox>.
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> </mc/compose?to=users-unsubscribe_at_glassfish.dev.java.net>
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>> </mc/compose?to=users-help_at_glassfish.dev.java.net>
>>
>>
>> ------------------------------------------------------------------------
>> Stay connected to the people that matter most with a smarter inbox.
>> Take a look
>> <http://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/mail/smarterinbox>.
>
>
>