Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Startup

 
Anila Mathew
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need a startup class for weblogic which instantiates some classes.Is it mandatory that startup should always have the public static void main() method?

Thanks,
Anila
 
Anila Mathew
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone had a chance to look at my question??
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a startup class for weblogic which instantiates some classes.Is it mandatory that startup should always have the public static void main() method?


Write a class called StartupServlet which extends GenricServlet.
In the init method instanciate all the class which you want to load.

In the web.xml use following tag.
<servlet>
<servlet-name>Startup Servlet</servlet-name>
<servlet-class>StartupServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
 
Rejeev Divakaran
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I understand it needs to have public main() method. Not necesary to be static or void.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic