Load on Startup of my Servlet
Hi All,
I have a Java Program which needs to run whenever the Oracle Application Server's OC4J is started. For this, I can write a Servlet and its init() method, I can instantiate the Java Program and it will start running. Now I need to tell Oracle Application Server to load this servlet on start up. Can you please let me know the configuration files that needs to be changed along with the details of the changes. The Java program I have to start is a background process. There is no browser interaction. Also, I dont have any web application ( ear ) for that Java program. Please advise.
Regards
Ramesh
Refer this:
http://download.oracle.com/docs/cd/B32110_01/web.1013/b28959/invoke.htm#sthref71
Thanks
Shail
Similar Messages
-
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 thisYou'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 thisSounds 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 -
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 advanceIn 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? -
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.
>
-
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. -
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
> >
-
"load-on-startup" servlet configuration
Dear All,
I am trying to load a servlet "SettingServlet" at the startup of the application, the configuration I am using inside the web.xml file is as following:
<web-app>
<servlet>
<servlet-name>SettingsServlet</servlet-name>
<servlet-class>com.myPack.SettingsServlet</servlet-class>
<init-param>
<param-name>fichierConfig</param-name>
<param-value>D:/tomcat41/webapps/init.conf</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
</web-app>
It seems that the "SettingsServlet" servlet is not started at the startup.Even it's started in the tomcat window I am getting something like
(SEVERE: Parse error at line......column...:Element type ....not declared ..)
and that for the servlet-name, parma-name,servlet-class, init-param...etc
Do I missed something in the configuration?, please tcheck the few lines above. because Simply I got stuck ! ,,,,,Please help me to fix it, I am waiting for you reply guys.
Thanks and Regards,
kifwetTake a look at the header of your web.xml file, the part about:<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"> And go check the dtd for your version.
Some versions are very picky about the order of parameters.
Hope this helps. -
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 -
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
amitindiaFrom 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
AjayIs 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 -
Does the loading of Servlets work in WL 5.1 sp5? In previous vesions it
didn't. If its not fixed yet when will it be fixed?
Thanks
http://www.weblogic.com/docs51/classdocs/API_servlet.html#128566
Make sure you have the latest service pack installed, because this
thing was broken.
Dimitri
Tom Gerber <[email protected]> wrote:
> Do I have define a Main method? All the other Servlet engines I have used just
> call the Init() method for a servlet. Is it different for WebLogic?
> Dimitri Rakitine wrote:
>> weblogic.system.startupClass.Foo=weblogic.servlet.utils.ServletStartup
>> weblogic.system.startupArgs.Foo=servlet=FooServlet
>>
>> Tom Gerber <[email protected]> wrote:
>> > Can you post an example of the properties file that tells WL to load on
>> > startup?
>>
>> > Thanks
>>
>> > Dimitri Rakitine wrote:
>>
>> >> It works for me with sp6.
>> >>
>> >> Tom Gerber <[email protected]> wrote:
>> >> > Does the loading of Servlets work in WL 5.1 sp5? In previous vesions it
>> >> > didn't. If its not fixed yet when will it be fixed?
>> >>
>> >> > Thanks
>> >>
>> >> Dimitri
>>
>> Dimitri
-
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.
When you shut down this window appears.
Uncheck the reopen box and it should stop this from happening
Maybe you are looking for
-
New ipad I set up now try to sync w ITunes gives me 2 choices 1 - set up as new iPad 2 - use backup from old iPad. I only want to sync it. What do I do? Judy
-
Message in status "scheduled for outbound processing"
Hi, I was tring to perfom volume test. The scenario is XMLFILE --> XI --> IDOC(R/3). I reduced the polloing interval to 2secs and it went well for 15 min. Later I left it like that for an hour and found that all the messages are queued up scheduled f
-
Simple question - which HD to chose?
Hi everybody, I have a really simple question, I am about to buy an external HD, my doubt is: do any HD work with TimeMachine in order to use it for my backups?
-
Hi, I have installed ID CS 3 in my MacBook, and in my PC. I have no problem to export a booklet PDF for my printer in my PC(2-up Saddle Stich): Print settings/Printer: PDF, etc. But in my Mac I can't, I have Acrobat Professional (+ Distiller) but I d
-
Is it possible to have a scroll bar in a view
Hi I have a bam dashbaord and it is having 4 different views(Graph Type) .One of the views is a bar chart. This graph shows up a large amount of data and bars are getting squeezed.Is there anyway we can have a scroll bar in the view so that bar chart