запуск и развертывание сервлета с Eclipse и Tomcat 7

I created a test project based on Tomcat HelloWorld Servlet with Eclipse and tried to run it from Eclipse as is with Tomcat 7, which I have configured to run on 127.0.0.1 - but I get Page cannot be found at 127.0.0.1/helloworld/HelloWorld I also tried exporting as war file and deploying it to the (otherwise working) Tomcat server running as a Windows service - and deployed with the Tomcat Application Manager - manifest.mf and the classes are nicely copied to tomcat/webapps/helloworld, but trying to navigate to 127.0.0.1/helloworld/HelloWorld fails again, showing HTTP Status 404 From default @WebServlet to web.xml configuration

Далее в HelloWorld.java я попытался закомментировать

//@WebServlet("/HelloWorld")

а затем добавьте конфигурацию web.xml для веб-приложения:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
    <servlet>
        <servlet-name>HelloWorld</servlet-name>
        <servlet-class>HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>HelloWorld</servlet-name>
        <url-pattern>/HelloWorld</url-pattern>
    </servlet-mapping>
</web-app>

Но результаты все те же - без ответа!

Solutions? Given the linked tutorial provides instructions for Tomcat 6, should I change something to make it work with Tomcat 7? Specifically, is the default @WebServlet("/HelloWorld") added by Eclipse sufficient? What is needed for the annotation-based configuration of Servlet 3.0 to work (without web.xml)? Or could it be that something is blocking any web app deployment at the global tomcat server level? I have changed the server configuration somewhat, and unfortunately i do not remember exactly what, except for making it serve on 127.0.0.1 rather than 127.0.0.1:8080

Ответы на вопрос(2)

Ваш ответ на вопрос