aspose file tools*
The moose likes BEA/Weblogic and the fly likes Servlet does not start when WL 11g is restarted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Servlet does not start when WL 11g is restarted " Watch "Servlet does not start when WL 11g is restarted " New topic
Author

Servlet does not start when WL 11g is restarted

Ong Vua
Ranch Hand

Joined: Jan 24, 2008
Posts: 59
I have a simple web application and in the web.xml, I have the following

<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<servlet-name>StartSchedulerServlet</servlet-name>
<servlet-class>com.abc.scheduler.StartSchedulerServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>StartSchedulerServlet</servlet-name>
<url-pattern>/startscheduler</url-pattern>
</servlet-mapping>
</web-app>

After I deployed it onto the SOA server. I started WL (startWeblogic) and the managed domain (startManagedWeblogic soa_server1), the servlet does not start up.

Do you have any idea? I'm using WL 11g.

Thanks
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

What is your definition of startup ? The servlet class is not loaded ? If you are performing application startup activities they probably belong in a startup listener instead.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Ong Vua
Ranch Hand

Joined: Jan 24, 2008
Posts: 59
Yes, I want the servlet to load when the WL server is restarted. Right now, I have to manually start it by entering in the URL in the browser.

Where is the startup listener please?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Here -> ServletContextListener
Ong Vua
Ranch Hand

Joined: Jan 24, 2008
Posts: 59
I just tried it out and actually the servlet is being loaded when the server is restarted without implenting the SerlvetContextListener.

It called the init(ServletConfig config) method. I have my logic in the service(HttpServletRequest request, HttpServletResponse response),

how do I call the service() from within the init() method please?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Overriding service() is a bad idea.

Can you place your login inside init() ?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet does not start when WL 11g is restarted