I don't know whether the init method in the filter is working all the time, I only tested it once as a result of the emails here today :)
That's the nature of race conditions thought...they're unpredictable little fellows because there is no relationship between the two processes.
oh well, no direct resolution on this one :). I would package the war within the ear jar however there is an issue with netbeans 6.0 where if you have an application client and a war in an ear you get all kinds of errors with debugging.
I'll try NB 6.5 and see if it's fixed :) groan -- IDE upgrade, yay! ;)
--- 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, "Hong Zhang" <Hong.Zhang_at_Sun.COM>
Received: Wednesday, 25 February, 2009, 3:34 PM
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.
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>.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net