Load on startup

I have one problem with my application.
When web application startup ,we write initialization code in one servlet and set the setting for that servlet in web.xml as:
<load-on-startup> tag .
so servlet loads when tomcat run.
how can i load normal class which having public static void main()
when web appliction startup.i can write initialization code in main method();
please help me.
thank you in advance

In a web application, I have to write a welcome message and version information in logs, for example many application server write "Server started on port 8080" etc.
So, I want to load a class that prints like "Server v4.2.0.31 started." so what could be the solution?

Similar Messages

  • load-on-startup problem

    Hai all,
    I want to run a servlet on start up
    i did following
    1) Add following to web.xml
    <servlet>
    <servlet-name>Schedular</servlet-name>
    <servlet-class>com.abc.xyz.Schedular</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    2) copied the file to com.abc.xyz
    but when i restarting iam getting following errror
    Cannot load Servlet name
    my java files shown below....am around it
    import java.util.Timer;
    import java.util.TimerTask;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Schedular extends HttpServlet {
    Timer timer;
    public Schedular(int seconds) {
    timer = new Timer();
    timer.schedule(new RemindTask(), seconds*1000);
    class RemindTask extends TimerTask {
    public void run() {
    System.out.println("hai !");
    timer.cancel(); //Terminate the timer thread
    public void init(ServletConfig config) throws ServletException {
         super.init(config);
    System.out.println("About to schedule task.");
    new Schedular(5);
    System.out.println("Task scheduled.");
    public void service(HttpServletRequest request, HttpServletResponse response)
         throws IOException, ServletException
                   System.out.println("servee.");
    }

    In web.xml, you say the servlet class is com.abc.xyz.Schedular but your servlet isn't in the package.
    You need to add the following to your servlet...
    package com.abc.xyz;Hope this helps,
    JEB

  • Date/time icon and other movable icons on menu bar cannot be loaded on startup,but it works if manually loaded

    Strange things happened since my mbp 13' (MD-101) was upgraded to 10.8.4 ----------- time icon, battery icon,and language icon (these icons can be moved when held Command key and drag) cannot be loaded on startup, but they still can be loaded when you get into System Preferences and manually  turn them on, as well as iStat Menus
    However, some other icons didn't bother, things like BetterTouchTool, NewsBar. They are immovable!! I guess it is the key factor that the icon is movable or not making the difference.
    Someone please lend me a helping hand?
    I've attached some pictures in order to make my situation easier to be understood.
    these icons can't be loaded on my loggin in.
    but they can be loaded manually
    however, these icons will be loaded on startup
    I've almost despaired to resolve it . Thanks for your help!

    I have a similar issue. When the computer goes into "Hibernate" mode -- that is, it loses power while sleeping and it writes the contents of it's memory to disk in order to boot into that exact configuration when woken up -- many of my icons when Apple-Tab'ing to another application appear as static. They look like a slightly colorized version of the "static snow" you see when tuning into a station that doesn't exist on a UHF antenna television. Also, icons in Chrome such as web sites "favorite icons" or favicon.ico (the icons that appear in the URL bar and bookmarks) will be scrambled in the same fashion , at first , until the actual icon is loaded.
    Between this, my menu bar and finder icons not displaying, and being unable to boot into safe mode, I'm getting quite ******. I have no idea what the **** is going on with my Macbook Pro. The issue of the scrambled icons actually existed prior to installing an SSD and doing a fresh install of Mountain Lion. I may end up throwing in the towl and re-installing the operating system but I'm sure SOMETHING will happen. It seems the latest update, 10.8.2, is absolute garbage.
    What the ****, Apple? And I really don't want to take the computer to the morons at the Apple Store. They are not "geniuses" by any measure.

  • How do I stop Adobe Bridge, Excel, Word and Adobe Photo Downloader from loading at startup under Mac OS 10.7.1, they are not loaded in login items.

    How do I stop Adobe Bridge, Excel, Word and Adobe Photo Downloader from loading at startup under Mac OS 10.7.1, they are not loaded in login items.

    When you shut down this window appears.
    Uncheck the reopen box and it should stop this from happening

  • load-on-startup 1 /load-on-startup not working in Weblogic 9.1

    Hi
              I have the following xml tag in web.xml file
              <load-on-startup>1</load-on-startup> for some servlets, i have given then sequence 1 to 5, but for some reason 5 is loading first and the whole application crashes because of this.
              do i have to mention anything in weblogic.xml?
              Any ideas how do i fix this

    You're right, your situation is very similar to the situation the other poster describes. However, the main similarity is that neither of you have given us any information about what is going wrong. We can't read minds or read what's on your screen. We need to see specific error messages, stack traces, and specific code that shows what you are trying to do.
              However, it's likely that you're running into problems with the issues with "tag reuse" and "tag pooling". You should first read the JSP specification in the areas that talk about this issue, although this will probably leave you with more questions than you started with.
              I'm guessing that your "<gui:button>" element doesn't have any attributes. It's possible that WebLogic is reusing a single "<gui:button>" tag instance for each occurrence in your page. You may have to figure out how to turn off tag pooling in the JSP compiler, but I'm not sure how to do that.
              It's possible that Websphere doesn't give you an issue with this because perhaps they didn't bother with the tag pooling optimization (it is a good thing to have it available).

  • load-on-startup not working in weblogic 9.1

    Hi
    I have the following xml tag in web.xml file
    <load-on-startup>1</load-on-startup> for some servlets, i have given then sequence 1 to 5, but for some reason 5 is loading first and the whole application crashes because of this.
    do i have to mention anything in weblogic.xml?
    Any ideas how do i fix this

    Sounds like a bug. I'd suggest opening a case with [email protected]
    FWIW, I get a little nervous about inter-application dependencies like
    this, but the feature should work.
    -- Rob
    Subramanian V wrote:
    Hi,
    I have two applications -
    ear1 is deployed in zipped format with a deployment order of 110
    ear2 is deployed in exploded format with a deployment order of 150.
    But when I start up weblogic, its almost always ear2 which is deployed first.
    The behaviour seems random and it looks to me as if Weblogic is just picking at
    random the application to deploy first.
    Is there any solution for this?
    rgds

  • How long load-on-startup servlet stays in weblogic6.1 sp2

    does anybody know how long a load-on-startup servlet exists (before
              gets destroyed) in weblogic6.1 sp2. What i want is in load-on-startup
              servlet, I want to schedule a java.util.Timer and when application
              gets undeployed, i want to cancel that timer. if load-on-startup
              servlet exists for the whole application life span then i could do
              timer.cancel() on the destroy method of load-on-startup servlet.
              any suggestion?
              thanks in adv,
              soumik
              

    You can simply use ServletContextListener instead - that way you do not
              have to worry if (or when) WebLogic decides to destroy the servlet.
              soumik <[email protected]> wrote:
              > does anybody know how long a load-on-startup servlet exists (before
              > gets destroyed) in weblogic6.1 sp2. What i want is in load-on-startup
              > servlet, I want to schedule a java.util.Timer and when application
              > gets undeployed, i want to cancel that timer. if load-on-startup
              > servlet exists for the whole application life span then i could do
              > timer.cancel() on the destroy method of load-on-startup servlet.
              > any suggestion?
              > thanks in adv,
              > soumik
              Dimitri
              

  • Can't get Servlet to Load On Startup

              I am trying to get a servlet to run at startup, and I have put the xml below in WEB-INF/web.xml to make this happen, but it is not working. The servlet does not run at startup.
              Anybody have any idea what the problem is?
              <servlet>
                   <servlet-name>Cocoon</servlet-name>
                   <servlet-class>org.apache.cocoon.Cocoon</servlet-class>
                   <init-param>
                        <param-name>properties</param-name>
                        <param-value>./WEB-INF/cocoon.properties</param-value>
                   </init-param>
                   <load-on-startup/>
              </servlet>
              <servlet-mapping>
                   <servlet-name>Cocoon</servlet-name>
                   <url-pattern>*.xml</url-pattern>
              </servlet-mapping>
              ALSO, The servlet in this case is the Cocoon servlet, and the reason I am trying to get it to run at startup is because in my application I am calling it from another servlet, instead of through a direct call to an *.xml file, and so it requires a direct call to Initialize the Cocoon Engine. So, if anyone knows anything about how to solve this problem, that would also be helpful.
              Thanks.
              Harris.
              

              Thank you!
              That worked.
              Ruslan Bilorusets <[email protected]> wrote:
              >Harris,
              >
              >Please, try to specify a value for the <load-on-startup> element. It looks like a bug in our code.
              >
              >So,
              ><load-on-startup>1</load-on-startup>
              >should do the trick.
              >
              >Thanks,
              >-ruslan
              >
              >harris wrote:
              >
              >> I am trying to get a servlet to run at startup, and I have put the xml below in WEB-INF/web.xml to make this happen, but it is not working. The servlet does not run at startup.
              >>
              >> Anybody have any idea what the problem is?
              >>
              >> <servlet>
              >> <servlet-name>Cocoon</servlet-name>
              >> <servlet-class>org.apache.cocoon.Cocoon</servlet-class>
              >> <init-param>
              >> <param-name>properties</param-name>
              >> <param-value>./WEB-INF/cocoon.properties</param-value>
              >> </init-param>
              >> <load-on-startup/>
              >> </servlet>
              >> <servlet-mapping>
              >> <servlet-name>Cocoon</servlet-name>
              >> <url-pattern>*.xml</url-pattern>
              >> </servlet-mapping>
              >>
              >> ALSO, The servlet in this case is the Cocoon servlet, and the reason I am trying to get it to run at startup is because in my application I am calling it from another servlet, instead of through a direct call to an *.xml file, and so it requires a direct call to Initialize the Cocoon Engine. So, if anyone knows anything about how to solve this problem, that would also be helpful.
              >>
              >> Thanks.
              >> Harris.
              >
              

  • How can I get my homepage to load on startup?

    My Yahoo homepage used to load on startup before I installed OS update.
    How can I get it to load automatically again?

    I have Snow Leapord and now when I startup Safari, my original homepage is gone, and there are only two choices: blank page or all the open pages from the previous session!!  What happened to putting in the startup page option?  When did the Preferences change?

  • What will happen if i mention like load-on-startup -1 /load-on-startup   ?

    Hi All,
    In my web.xml what will happen if i mention like <load-on-startup>
    -1</load-on-startup> ?

    It's not WebLogic-specific, the load-on-startup web.xml element is a standard common component to all application servers.
    As for what it does, then yes, the BEA link explains it well enough. So that explanation applies to WAS too.

  • What does this mean ---- load-on-startup 1 /load-on-startup

    Hi All,
    Anybody please tell me what does this mean:
    <load-on-startup>1</load-on-startup>
    Thanks in advance
    amitindia

    From the dtd :
    The load-on-startup element indicates that this servlet should be
    loaded (instantiated and have its init() called) on the startup
    of the web application. The optional contents of
    these element must be an integer indicating the order in which
    the servlet should be loaded. If the value is a negative integer,
    or the element is not present, the container is free to load the
    servlet whenever it chooses. If the value is a positive integer
    or 0, the container must load and initialize the servlet as the
    application is deployed. The container must guarantee that
    servlets marked with lower integers are loaded before servlets
    marked with higher integers. The container may choose the order
    of loading of servlets with the same load-on-start-up value.

  • load-on-startup is not working !!

    Hello all ... I have a servlet....CSVReaderServlet.java
    and following code in web.xml
    <web-app>
    <servlet>
    <servlet-name>
    CSVReader
    </servlet-name>
    <servlet-class>
    com.xpedion.CSVReaderServlet
    </servlet-class>
    <init-param>
    <param-name>root</param-name>
    <param-value>/app/agents</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    </web-app>
    having this all i expect when i start my weblogic ... servlet should run on start up, but it does not. If i make a call from browser then it runs perfect.
    Any clue.... ??
    Thanks
    Ajay

    Is there a particular reason you feel it necessary to post this over and over again?
    http://forum.java.sun.com/thread.jsp?forum=31&thread=428054

  • Servlet failed to load on startup

    Hi all,
    I recently added a new servlet definition to my web.xml file, and specified a <load-on-startup> value of 1 for this servlet. Even though this works and the new servlet gets initialised properly, one of my old servlets with a <load-on-startup> value of 2 has stopped working. There were no changes to this old servlet, and it was working fine before. I get the following error from the weblogic logs. I have tried swapping the load order around but that doesn't make any difference. Any suggestions as to why this could happen?
    Thanks in advance
    <Nov 14, 2005 1:34:59 PM SGT> <Error> <HTTP> <BEA-101216> <Servlet: "action" failed to preload on startup in Web application: "/".
    javax.servlet.ServletException
    at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:884)
    at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:848)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:787)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3260)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3205)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3182)
    at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:5663)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
    at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2022)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2063)
    at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
    at weblogic.management.deploy.slave.SlaveDeployer.commitUpdate(SlaveDeployer.java:608)
    at weblogic.drs.internal.SlaveCallbackHandler$2.execute(SlaveCallbackHandler.java:35)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

    I am running into the same error. Has anyone been able to find a solution?
    thanks.

  • Active protection system fails to load on startup

    I'm using a T 60 for over one year. Recently noticed missing icon after startup. Checked problem reports, noticed item stating compatibility problem. I am able to run tpshocks.exe to load program. I tried to reinstall hprotect from lenovo download site, but still doesn't load on startup. Stumped. Does anyone have any ideas. Is there a way to change compatibility mode for this app?
    Thanks.

    AD,
    If you are using Weblogic 10.3.4 then it's a bug - odiconsole throws that error. There is no issue with weblogic 10.3.3. Try with Weblogic 10.3.3 it works for us.
    Regards,
    Henry.

  • Load on startup servlet and references

              Weblogic 6.1 SP2
              No jars specified in the classpath. A Singleton is located in a utility.jar file
              inside a .ear file.
              If I create a Singleton from a load on startup servlet, how long will the singleton
              be around? I know that if I undeploy the application, the singleton will be destroyed
              since the classloader is unloaded. However, if I never undeploy my application,
              will the Singleton always be around? Does Weblogic keep a reference alive to
              this Singleton forever?
              Please provide some more details on this!
              Thanks.
              Dan
              

              Dan Baumbach wrote:
              > So, because the startup servlet has a static reference to the singleton, the servlet
              > will never be garbage collected?
              Correct.
              >
              >
              > What if there's a class that is not a singleton, but there are static methods.
              > How would garbage collection work in this case?
              >
              A class object is not an instance object. If the class object has been loaded by the
              classloader, it will not be unloaded or garbage collected, regardless of whether or not
              it has static methods. If an instance of a class is instatiated on the heap, and a
              reference to that object is placed in a static member of its associated class object,
              also referred to as a class member, then the instance will not be garbage collected.
              >
              > Thanks.
              > Dan
              >
              > William Kemp <[email protected]> wrote:
              > >The jvm will not garbage collect an object that has a static reference
              > >to it. Which is how
              > >I am assuming you have implemented the singleton.
              > >
              > >Bill
              > >
              > >Dan Baumbach wrote:
              > >
              > >> Weblogic 6.1 SP2
              > >> No jars specified in the classpath. A Singleton is located in a utility.jar
              > >file
              > >> inside a .ear file.
              > >>
              > >> If I create a Singleton from a load on startup servlet, how long will
              > >the singleton
              > >> be around? I know that if I undeploy the application, the singleton
              > >will be destroyed
              > >> since the classloader is unloaded. However, if I never undeploy my
              > >application,
              > >> will the Singleton always be around? Does Weblogic keep a reference
              > >alive to
              > >> this Singleton forever?
              > >>
              > >> Please provide some more details on this!
              > >> Thanks.
              > >> Dan
              > >
              

Maybe you are looking for

  • HOW DO I SYNC MY IPOD AND ITUNES LIBARY

    i really dont understand all this computor stuff, so im begging for help!!!! i recedntly had a lot of problems with my comp and had to get it wiped, when i was back up and running i had to reinstall my itunes, for a start all my music (5 days worth!!

  • I own more than 5 computers

    In each room in my household I have a computer hooked up to the screen to watch video and play music. With 3 computers hooked into my tv's 2 laptops and one desktop thats 6 computers and the itunes store only allows 5. Currently I have to deauthorize

  • Small crack on my 4s

    small crack on my 4s just the glass broke not LCD screen how much would it cost me?

  • Cash Flow as per as per Indian GAAP

    Hi, I need to get a report of Cash Flow as per Indian GAAP in the system.Please suggest me where i can check this. Is there any standard report available for this?or is it possible to define in the system through Report painter fucntionality? Please

  • HElp!! Red screen of death!!

    I have an iPhone 5s. i was out today and the battery died. I plugged it into the car charger. When it awoke all I could get was the error message that the phone did not shut down properly. i tried holding down the power button, but nothing happened.