404错误在cloudbees上运行基本servlet

时间:2013-12-15 13:09:00

标签: java servlets cloudbees

我提到cloudbee的原因是为了确保没有必须改变的特殊设置。

这是我的测试代码,以确保它正常工作......

package test;

import java.io.IOException;
import java.io.PrintWriter;

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

/**
 * Servlet implementation class testing
 */
@WebServlet("/testing")
public class testing extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**i
     * @see HttpServlet#HttpServlet()
     */
    public testing() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println("test");
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */`enter code here`
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

}

它适用于本地tomcat7 ...但是当我通过.war文件将其上传到Cloudbees时,我收到404错误。

Error

我尝试使用Java 6导出,有/无优化tomcat 7(因为cloudbees有tomcat6)...

我缺少另一种设置的想法?

1 个答案:

答案 0 :(得分:0)

好吧我明白了......

由于某种原因,未创建默认的web.xml文件。根本不存在。怪异。