• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet does not start when WL 11g is restarted

 
Ong Vua
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ong Vua
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here -> ServletContextListener
 
Ong Vua
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Overriding service() is a bad idea.

Can you place your login inside init() ?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic