Webservlet突然停止工作

时间:2016-08-23 07:11:04

标签: maven servlets web.xml

我有一个Webservlet(动态Web模块3.1),它看起来像这样:

package de.timetoact.cce;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ibm.sbt.services.client.ClientServicesException;

import de.timetoact.cce.handler.ContentHandler;
import de.timetoact.cce.util.Connect;
import de.timetoact.cce.util.Util;
import de.timetoact.cce.util.Variables;

@WebServlet(urlPatterns = { "/main" }, loadOnStartup = 1)
public class InitServlet extends HttpServlet {

    private static final long serialVersionUID = 1L;


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

        String actionn = request.getParameter("action").toLowerCase();
            if (actionn.equals("delete")) {
                System.out.println("It does work");
            }
    }
}

Web.xml中:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    version="3.1">
    <display-name>Archetype Created Web Application</display-name>
    <servlet>
        <description>The service servlet handles requests from the toolkit to access external resources.</description>
        <display-name>Social Business Toolkit Service Servlet</display-name>
        <servlet-name>ServiceServlet</servlet-name>
        <servlet-class>com.ibm.sbt.service.core.servlet.ServiceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ServiceServlet</servlet-name>
        <url-pattern>/service/*</url-pattern>
    </servlet-mapping>

    <servlet>
        <description>This servlet initializes the specified JavaScript library for use by the Social Business Toolkit.</description>
        <display-name>Social Business Toolkit Library Servlet</display-name>
        <servlet-name>LibraryServlet</servlet-name>
        <servlet-class>com.ibm.sbt.jslibrary.servlet.LibraryServlet</servlet-class>
        <init-param>
            <param-name>toolkitExtUrl</param-name>
            <param-value>%local_server%/sbtx</param-value>
        </init-param>
        <init-param>
            <param-name>jsLibraryUrl</param-name>
            <param-value>%local_server%/sbt/js/libs</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>LibraryServlet</servlet-name>
        <url-pattern>/library/*</url-pattern>
    </servlet-mapping>
    <filter>
        <description>This filter is responsible for creating the toolkit application and context objects for every servlet within this web application.</description>
        <display-name>Social Business Toolkit Filter</display-name>
        <filter-name>SBTFilter</filter-name>
        <filter-class>com.ibm.sbt.util.SBTFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>SBTFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>CorsFilter</filter-name>
        <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>CorsFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

昨天它工作得很好,但今天我收到了消息:

The requested resource is not available.  /CCE/main

我清理了项目并进行了更新(Maven更新项目)

尽管我没有改变任何东西,但我得到了这个上下文错误。

这里有什么问题?

1 个答案:

答案 0 :(得分:0)

此问题是由在eclipse或tomcat中运行项目的两个实例引起的。您可以通过重新启动eclipse或tomcat来解决此问题。