• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

execute servlet on Server Startup?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need to execute a servlet of the Application on startup to perform some Data Retrieval Tasks. How can i achieve teh same using BEA Weblogic Server?]
What settings need to be set?

Thanking in advance,

Regards,
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Think about ServletContextListeners, there are methods contextInitialized and contextDestroyed. I guess you could use contextInitialized for your purpose. Hope this helps...

Thanks
Chandu
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A servlet is designed to respond to a request from the client, so using one for startup tasks is not really a good use of the technology. A context listener, as Chandra suggested, would be more approriate.
[ February 27, 2006: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of the servlet spec does your (BEA) container support?
 
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can define them as startup classes in weblogic.

<StartupClass ClassName="CLASSNAME" Arguments="port=PORT" DeploymentOrder="NUMBER" Name="NAME" Targets="SERVERNAME"/>

I think this is what you want to do right?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your container supports Servlet Spec 2.3 or better, follow Bear's advice and use a ContextListener.

Prior to that we had to use the <load-on-startup> attribute of the servlet entry in order to get a spec compliant way to execute startup code in a servlet app. From the looks of the last post, BEA has some proprietary ways of dealing with this as well.

Since you specifically asked about BEA solutions, I'll move this to the BEA forum where the Weblogic gurus hang out.
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic