我想在服务器启动时调用以下类。
AlertsData 在 com.mongo.service 中:
public class AlertsData extends HttpServlet{
public void init(ServletConfig config) throws ServletException{
super.init(config);
alertingPoolsData();
}
}
网页.xml:
<servlet-mapping>
<servlet-name>AlertsData</servlet-name>
<display-name>AlertsData</display-name>
<servlet-class>com.mongo.service.AlertsData</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet-mapping>
出现以下错误:
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/lbmongo]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
由于此服务器未启动并出现以下错误..请有人帮忙:(我想在服务器启动时调用 AlertsData 类。