On Startup - Servlet to be invoked
Hi
When a Servlet is configured as load-on-startup, what is the life cycle it follows ? is it that only init() gets called?
How to invoke a Servlet/JSP when the Tomcat is started wihtout any user(manual) interaction? ie. would like to invoke on Startup.
Thanks in Advance
Yes, only the init() method gets called. What do you want to get called? It wouldn't make sense to call doPost() or doGet() as they would be expecting some context from the client site - i.e. the HttpServletRequest.
Would it be possible to call whatever you need at startup in the init() method?
Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums.
Sure they're new - come get them started!
Similar Messages
-
ADF Bindings Servlet/Filter not invoking Faces Servlet
I'm getting ADF Faces and Facelets working properly with pages written in jspx format, but the Faces Servlet being mapped to jsf format.
The problem I'm getting is while displaying ADF Tables with data retrieved from the database using Toplink and bindings provided by ADF Databindings.
The following is the Web.xml mappings for Faces Servlet and ADF bindings filter:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>resources</servlet-name>
<url-pattern>/adf/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<filter-name>adfBindings</filter-name>
<filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>adfBindings</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>adfBindings</filter-name>
<url-pattern>*.jspx</url-pattern>
</filter-mapping>
I'm getting the ADF tables displayed using ADF Bindings, if the faces servlet is mapped for jspx format;but, at the cost of losing Facelets...Facelets is not working with Faces Servlet mapped to jspx format(though written in jspx format, the faces servlet mappping has to be made for jsf format.On the other hand, if I use faces servlet mapping for jsf pages I'm getting Facelets working but ADF Databindings are not working ,(I guess) and hence ADF Faces Tables are not being displayed(I'm getting Access Denied message).
I even tried to change the ADF binding filter mappings
---- from ---- jsp &jspx---- to ----- jsp and jsf ----
But I got the same Access denied message.
I read a similar post on this forum by Mr.Ashish Kumar who said he is using java script and automatic form submission, to refresh the page and that gave him the table working.
as quoted in the post:
af:table displays Access Denied
Why should the page be refreshed at all. I Guess , the Faces Servlet is not being invoked by the ADF Bindings Filter/Servlet, and for this , I suppose , Mr.Ashish is using java script to provide the action required.
And one more thing which that Automatic Refreshing of page using JavaScript cannot do.
Suppose,
I need customised display, rather than just a Table or Form,like:
public String getEmp() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding("findAllEmp");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
List<Emp> res=(List<Emp>)result;
for(int i=0;i<res.size();i++)
Emp myrec=res.get(i);
System.out.println("Employee ["+myrec.getEname()+"], Salary ["+myrec.getSal()+"]");
return "";
where I do some customisation in the backing bean.
and I call that method binded to a button as below:
<af:commandButton
text="findAllEmp"
disabled="#{!bindings.findAllEmp.enabled}"
binding="#{backing_Success.commandButton1}"
id="commandButton1"
action="#{backing_Success.getEmp}"/>
What I'm getting is a disabled button.
Why doesn't ADF bindings servlet invoke the faces Servlet?
Can't we make ADF Bindings Servlet invoke Faces Servlet by configuring in the web.xml?
Can't we get ADF Bindings filter mapped to work with jsf pages?
Won't ADF Bindings work with jsf pages, will they work only with jspx pages?
ADF Team,
Please Help me.
Thanking you,
SambaHi! Frank,
Thankyou for your Reply.
Yes, Mr.Adam Winer has contributed that library, I guess.
But I already have that adf-facelets.jar in my lib folder ; and with out that the Facelets won't work with ADF faces , in the first place.
I'm getting Facelets working excellently with ADF Faces but I'm not getting ADF Bindings working with Faceletpages.
The thing is even in another application which does not have facelets in it, if we use mapping for jsf pages, ADF Bindings are not working.
I think the ADF bindings filter is configured some where to work with jspx pages only.Could you tell me where to change that entry to make ADF Bindings work with jsf extension?
Thanking you,
Samba. -
Startup servlet problem in weblogic81
Hi
I created one web application in weblogic81 and it contains one servlet and act as startup servlet.When i m trying to get jndi context to connect to DataSource in init method, i m getting the following exception
javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://16.138.181.88:7501: Dest
ination unreachable; nested exception is:
java.net.ConnectException: Connection refused; No available router to de
stination]
init method
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL,"t3://16.138.181.88:7501" );
jndiContext = new InitialContext(env);
web.xml
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.MyServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
Please help me out.
Regards
ChandraTo use the /servlet/ notaton you will need to enable the invoker servlet. To do this open the conf/web.xml and search on "invoker". Follow the directions.
An alternative would be to map the servlet to a url and use that url to call the servlet
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/TestServlet</url-pattern>
</servlet-mapping>
now you should be able to access the servlet with /Fortune/TestServlet -
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
-
Class not found for Startup servlet
I have deployed a war file under weblogic 7. The application has some startup servlets,
which are failing to load during startup. It returns the following error messages
for each servlet
####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer> <Thread-8>
<kernel identity> <> <101249> <[ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet for servlet
StartupTSContentDaemonServlet could not be loaded because the requested class
was not found in the classpath D:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerces2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
java.lang.UnsupportedClassVersionError: com/abc/servlets/startup/StartupTSContentDaemonServlet
(Unsupported major.minor version 48.0)>
####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer> <Thread-8>
<kernel identity> <> <101216> <Servlet: "StartupTSContentDaemonServlet" failed
to preload on startup in webapp: "abcApps">
javax.servlet.ServletException: [ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet for servlet
StartupTSContentDaemonServlet could not be loaded because the requested class
was not found in the classpath D:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerces2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
java.lang.UnsupportedClassVersionError: com/abc/servlets/startup/StartupTSContentDaemonServlet
(Unsupported major.minor version 48.0)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:785)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2763)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:2708)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:2681)
at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:552)
at weblogic.servlet.internal.WebService.preloadResources(WebService.java:476)
at weblogic.t3.srvr.ServletInitRunner$1.run(ServletInitRunner.java:50)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:744)
at weblogic.t3.srvr.ServletInitRunner.run(ServletInitRunner.java:46)
at java.lang.Thread.run(Thread.java:479)
When i look into the directories weblogic created after deployment, there is a
cls2372.jar at 1 level above the web-inf folder and it has all the servlets in
the correct package structure i.e. com/abc/servlets/startup
Any idea on why this is happening or what i am doing wrong?also posting to servlet newsgroup.
"Ram" <[email protected]> wrote in message
news:[email protected]...
>
I have deployed a war file under weblogic 7. The application has somestartup servlets,
which are failing to load during startup. It returns the following errormessages
for each servlet
####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer><Thread-8>
<kernel identity> <> <101249><[ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet forservlet
StartupTSContentDaemonServlet could not be loaded because the requestedclass
was not found in the classpathD:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea
\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381
\jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAp
pServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.j
ar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApp
s_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.
\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerc
es2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApp
s_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\ab
cdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF
\lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdel
ete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
java.lang.UnsupportedClassVersionError:com/abc/servlets/startup/StartupTSContentDaemonServlet
(Unsupported major.minor version 48.0)>
####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer><Thread-8>
<kernel identity> <> <101216> <Servlet: "StartupTSContentDaemonServlet"failed
to preload on startup in webapp: "abcApps">
javax.servlet.ServletException:[ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet forservlet
StartupTSContentDaemonServlet could not be loaded because the requestedclass
was not found in the classpathD:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea
\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381
\jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAp
pServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.j
ar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApp
s_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.
\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerc
es2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApp
s_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\ab
cdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF
\lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdel
ete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
java.lang.UnsupportedClassVersionError:com/abc/servlets/startup/StartupTSContentDaemonServlet
(Unsupported major.minor version 48.0)
atweblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
a:785)
atweblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletC
ontext.java:2763)
atweblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServlet
Context.java:2708)
atweblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServle
tContext.java:2681)
atweblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:552)
atweblogic.servlet.internal.WebService.preloadResources(WebService.java:476)
at weblogic.t3.srvr.ServletInitRunner$1.run(ServletInitRunner.java:50)
atweblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
r.java:744)
at weblogic.t3.srvr.ServletInitRunner.run(ServletInitRunner.java:46)
at java.lang.Thread.run(Thread.java:479)
When i look into the directories weblogic created after deployment, thereis a
cls2372.jar at 1 level above the web-inf folder and it has all theservlets in
the correct package structure i.e. com/abc/servlets/startup
Any idea on why this is happening or what i am doing wrong? -
Problem setting up startup servlets in iWS 4.x
I have configured iPlanet Web Server(iWS) 4.1 SP9 to use a startup servlet. However, the error log does not show that the servlet has been initialized. Instead, it shows only the following entries:
Loading Simple Session Manager by default. Specify MMapSessionManager in servlets.properties to load persistent session manager
I found in the Knowledgebase that we need to copy the the configuration entry that was created in context.properties file into the servlets.properties file
My question that ...do we need to copy all the contents of the context.properties file or some portion of that file to servlets.properties .
Please suggest asap, I cant take a risk as this is a live server.
Thanks.Hi,
You need not to copy entry file. In your servlets.properties file at the end of the file you can see the parameters settings of servlet which you have been configured as a servlet.
For example the below setting are for "HelloWorldServlet" servlet configuration. You need to copy that line only.
servlet.HelloWorldServlet.classpath=/export/home/41sp9/docs/servlet
servlet.HelloWorldServlet.code=HelloWorldServlet.class
Note: Make sure that before changing(copying)any changes in file take backup of the old file(present).
Regards,
Dakshin.
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support. -
Weblogic 7.0 startup servlet problem
I have added a new startup servlet to my existing web application.
While deploying the same, weblogic is throwing the following
exception.
I'm very sure that class (com/lbx/util/LbxProperties) is part of
webapp war file I created. Can somebody please throw some light about
this.
I'm trying to do the .ear file deployment.
Thank you very much
Santhosh.
<Dec 30, 2002 12:04:27 PM PST> <Error> <HTTP> <101216> <Servlet:
"StartupServlet" failed to preload on startup in webapp: "wliWEB"
javax.servlet.ServletException: com/lbx/util/LbxProperties
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:912)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:833)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:773)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2763)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:2708)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:2681)
at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:4746)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:539)
at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:983)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1017)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
>
Hi Santhosh,
Yeah , if its part of the system class path, it should find it. How are u referencing
the file? Try wrapping the code that gets the Resource and see what exception
you get.
-Raj
"Santhosh Kumar" <[email protected]> wrote:
>
>Raj, you are right. I'm trying to load the properties from within the
>that class.
>However, path (external to ear file) where I placed all those properties
>is part
>of system class path. So wl should find those property files, right?
>
>-Santhosh.
>
>"Raj" <[email protected]> wrote:
>>
>>Hi
>>Are you trying to load any property file in your startup servlet? I
>think
>>WL does
>>not extract the file "automatically" from within the war file. You should
>>probably
>>try referencing the file using some other mechanism or try loading it
>>from ur
>>EJB(as EJB JARs are loaded before WARs).
>>
>>-Raj
>>
>>
>>[email protected] (Santhosh Kumar) wrote:
>>>I have added a new startup servlet to my existing web application.
>>>While deploying the same, weblogic is throwing the following
>>>exception.
>>>
>>>I'm very sure that class (com/lbx/util/LbxProperties) is part of
>>>webapp war file I created. Can somebody please throw some light about
>>>this.
>>>
>>>I'm trying to do the .ear file deployment.
>>>
>>>Thank you very much
>>>Santhosh.
>>>
>>><Dec 30, 2002 12:04:27 PM PST> <Error> <HTTP> <101216> <Servlet:
>>>"StartupServlet" failed to preload on startup in webapp: "wliWEB"
>>>javax.servlet.ServletException: com/lbx/util/LbxProperties
>>> at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:912)
>>> at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:833)
>>> at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:773)
>>> at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2763)
>>> at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:2708)
>>> at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:2681)
>>> at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:4746)
>>> at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:539)
>>> at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:983)
>>> at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1017)
>>> at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
>>> at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
>>> at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
>>> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
>>> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
>>>>
>>
>
-
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. -
I have added a new startup servlet to my existing web application.
While deploying the same, weblogic is throwing the following
exception.
I'm very sure that class (com/lbx/util/LbxProperties) is part of
webapp war file I created. Can somebody please throw some light about
this.
I'm trying to do the .ear file deployment.
Thank you very much
Santhosh.
<Dec 30, 2002 12:04:27 PM PST> <Error> <HTTP> <101216> <Servlet:
"StartupServlet" failed to preload on startup in webapp: "wliWEB"
javax.servlet.ServletException: com/lbx/util/LbxProperties
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:912)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:833)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:773)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2763)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:2708)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:2681)
at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:4746)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:539)
at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:983)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1017)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
>
I have added a new startup servlet to my existing web application.
While deploying the same, weblogic is throwing the following
exception.
I'm very sure that class (com/lbx/util/LbxProperties) is part of
webapp war file I created. Can somebody please throw some light about
this.
I'm trying to do the .ear file deployment.
Thank you very much
Santhosh.
<Dec 30, 2002 12:04:27 PM PST> <Error> <HTTP> <101216> <Servlet:
"StartupServlet" failed to preload on startup in webapp: "wliWEB"
javax.servlet.ServletException: com/lbx/util/LbxProperties
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:912)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:833)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:773)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2763)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:2708)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:2681)
at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:4746)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:539)
at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:983)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1017)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1112)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:732)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
>
-
Hi all,
Present we are using IIS web server for our website and internally we add Tomcat3.2.3 plugin to run servlets and jsp pages.For getting connection pool we are using web.xml descriptor file to invoke one start up servlet which internally calls some other class files to create connection pooling.Presently we are placing this web.xml file in web-inf directiory of tomcat container.The actual functinality of web.xml file is whenever we start up the web server it automatically invoke the startup servelet and the start up servlet will take care of connection pooling.
Recently we had taken oracle 9i application server.It is internally using apache webserver.we have configure servlet through servlet zones ,Apache intenally using Jserv servlet container to run servlet files.But we are unable to find such folder to place web.xml descriptor file.
regards
RadhikaRadhika,
Oracle 9iAS has OC4J as Java application server (although, JServ is there but you need not to use that). OC4J has similar structure as Tomcat that you can use. Also, it have xml based configuration so you can use the same web.xml with OC4J under WEB-INF folder. It is recommended that you use OC4J and not JServ. See OC4J documentation for more detail. Since you have used Tomcat earlier, you should not have any problem using OC4J.
-Ram Jadvani -
Order of startup servlets in WLS 5.1
Is there any way to set the order in which servlets are started up using ServletStartup.
I have something similar to this in my weblogic.properties file -
weblogic.system.startupClass.StartServletA=weblogic.servlet.utils.ServletStartup
weblogic.system.startupArgs.StartServletA=servlet=ServletA weblogic.system.startupClass.StartServletB=weblogic.servlet.utils.ServletStartup
weblogic.system.startupArgs.StartServletB=servlet=ServletB
I'd like ServletA to load first and then ServletB, but ServletB always seems to
load first.
Any ideas?
Thanks...
ps - using WLS 5.1, SP6
If, for some reason, you do not deploy your application as a webapp,
you can use ServletStartup:
http://www.weblogic.com/docs51/classdocs/API_servlet.html#128566
> Dimitri,
> Thanks for the response. But wouldn't this restrict me to only
> servlets that are deployed within a WebApp? would the servlet
> run even when the webApp is not deployed?
> Modou.
> Dimitri Rakitine <[email protected]> wrote:
>>The portable way is to specify load-on-startup in the
>>web.xml - 5.1sp7 or 8
>>supports this (but not before).
>>
>>Modou <[email protected]> wrote:
>>
>>> Hi,
>>> I would like to know if:
>>> 1) a servlet can be used as a startup class in WLS 5.1.
>>If so,
>>> are there any restriction on what can be done inside
>>this servlet?
>>> Or
>>
>>> 2) can we load a servlet from a startup class? if so?
>>how?
>>
>>> any ideas?
>>
>>> regards,
>>> Modou.
>>
>>--
>>Dimitri
Dimitri
-
Weblogic startup servlet loading
Hi
I am encountering problems in loading a Servlet on Weblogic
server startup.
The steps to be followed to load a servlet on webLogic
Server startup are as follows
Register the following in the Weblogic properties
file.
1.register the servlet
weblogic.httpd.register.MyServlet=\
examples.servlets.myservletclass
2.weblogic.system.startupClass.StartMyServlet=\
weblogic.servlet.utils.ServletStartup
3.weblogic.system.startupArgs.StartMyServlet=\
servlet=MyServlet
where MyServlet is the synonym used for registering the
servlet in the file and myservletclass is the Actual
name of the servlet.
I have followed the steps accordingly but the server
is failing to load my servlet on startup.
Any suggestions,solutions for the above problem
will be most welcome.
Thanx
Tapan.Hi
I am encountering problems in loading a Servlet on Weblogic
server startup.
The steps to be followed to load a servlet on webLogic
Server startup are as follows
Register the following in the Weblogic properties
file.
1.register the servlet
weblogic.httpd.register.MyServlet=\
examples.servlets.myservletclass
2.weblogic.system.startupClass.StartMyServlet=\
weblogic.servlet.utils.ServletStartup
3.weblogic.system.startupArgs.StartMyServlet=\
servlet=MyServlet
where MyServlet is the synonym used for registering the
servlet in the file and myservletclass is the Actual
name of the servlet.
I have followed the steps accordingly but the server
is failing to load my servlet on startup.
Any suggestions,solutions for the above problem
will be most welcome.
Thanx
Tapan. -
Hi,
I am encountering problems in running a Servlet on Weblogic
server startup.
The steps to be followed to execute a servlet on webLogic
Server startup are as follows
Register the following in the Weblogic properties
file.
1.register the servlet
weblogic.httpd.register.MyServlet=\
examples.servlets.myservletclass
2.weblogic.system.startupClass.StartMyServlet=\
weblogic.servlet.utils.ServletStartup
3.weblogic.system.startupArgs.StartMyServlet=\
servlet=MyServlet
where MyServlet is the synonym used for registering the
servlet in the file and myservletclass is the Actual
name of the servlet.
I have followed the steps accordingly but the server
is failing to execute my servlet on startup.
Any suggestions,solutions for the above problem
will be most welcome.
Thanx
Tapan.
HOw did you specified the load-on-startup? and what error you get
upon startup/deployment time?
Kumar
Giulia Esposito wrote:
> I try to load my servlet on startup of Bea WebLogic Server 6.1 (SP 3) cluster.
> This load failed.
>
> Can you help me?
>
> Tank's!
>
-
Startup Servlet failure ?????
Weblogic 5.1 allows us to write a startup class for startup operations also it comes with a utils class
weblogic.servlet.utils.ServletStartup
however when we gave it initargs like this
weblogic.system.startupClass.servletTest=weblogic.servlet.utils.ServletStartup
weblogic.system.startupArgs.servletTest=servlet=com.frictionless.display.servlet.InitServlet
Weblogic does not find the servlet to be started at startup time and comes back with a servlet "NOT FOUND" message ...
what can be the reason for this where do I have to put my servlet so that it can be found at startup time buy the utils class ?????Try the servlet classpath...
Deepak Konale wrote:
Weblogic 5.1 allows us to write a startup class for startup operations also it comes with a utils class
weblogic.servlet.utils.ServletStartup
however when we gave it initargs like this
weblogic.system.startupClass.servletTest=weblogic.servlet.utils.ServletStartup
weblogic.system.startupArgs.servletTest=servlet=com.frictionless.display.servlet.InitServlet
Weblogic does not find the servlet to be started at startup time and comes back with a servlet "NOT FOUND" message ...
what can be the reason for this where do I have to put my servlet so that it can be found at startup time buy the utils class ?????
Maybe you are looking for
-
No GR/IR items cleared after GR/IR clearing by F.19 and SM35
Hi experts, After I execute the GR/IR clearing program through F.19 and then post the batch through SM35, I found the GR/IR open items have not been cleared, even though they match the clearing conditions. I test to create a PO, make the invoice rece
-
I searched online to find out how to find my address book and found an article that said to look in Users\username\appdata\local\thunderbird. I did not find it there, so I did more searching and found it in Users\username\appdata\roaming\thunderbird.
-
Getting general error when saving site using "create PDF from"
I'm using Adobe Acrobat Professional 8.0.0 for Mac, trying to save websites. This started working fine, but I had to shut down in the middle of a site being saved. Now when I try to save a site using Web Capture/create PDF from I get a "general erro
-
What is the best qay to create a simple page with three textbox fields
Hi I try to create a Portal page for Password change. At first look, I taught that to create that basic page will be easy as one, two , three. Unfortunately not. I need to create three textbox and include pl/sql validation agains our BD. I usually wo
-
How do i unlock my daughters ipod, she lost her code
My daughter locked her ipod and cant remember her code...how do we unlock it?