users@glassfish.java.net

Re: Is there a way to automatically instantiate a bean at startup?

From: Dan6077 <dmcguire_at_jerviswebb.com>
Date: Tue, 10 Mar 2009 11:47:48 -0700 (PDT)

There IS a way to instantiate a bean at start up. This is how I connect to
my database and load up my properties file. I use the NETBEANS IDE to do
this, but all it does is to place an attribute into the XML file for the
bean. If you google RUNATSTARTUP attribute you should be able to see more
as to how this is done.

I am away from the code that does this but if you need more help I can send
you a copy of that.




glassfish-2 wrote:
>
> I've spent a number of hours searching this forum and google for an answer
> to this question (in the title), but so far while I've seen a lot of
> references to it I've not found a good answer.
>
> It also seems that this is a popular question.
>
> All I want to do is to create a bean that will periodically ping mysql to
> see if there are any new records in a mail table, and if those records
> exist to send some emails. I'm using Glassfish for the rest of my app and
> so it makes sense to me that I would want to use it for this function too.
> I don't want a web interface or anything like that.
>
> I've looked at the ServletContextListener but from what I can see it
> requires a bean to be instantiated. So far I've not been able to figure
> out how to automatically instantiate a bean when Glassfish starts up.
>
> Am I missing something obvious here?
>
> Thanks,
>
> Eric
> [Message sent by forum member 'eric_marsh' (eric_marsh)]
>
> http://forums.java.net/jive/thread.jspa?messageID=335746
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/Is-there-a-way-to-automatically-instantiate-a-bean-at-startup--tp22401108p22440834.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.