我的网络应用程序存在问题。我使用netbeans和glassfish作为默认Web服务器创建了我的应用程序。每当我编译和部署我的程序到localhost时,它工作正常,但当我尝试将其部署在具有apache tomcat 7.xx版本的远程Web服务器上时,只要程序访问servlet,它就会返回http状态404错误。我检查了servlet映射,一切似乎都没问题。这是我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 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_3_0.xsd">
<servlet>
<servlet-name>mainservlet</servlet-name>
<servlet-class>controller.MainServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>loginservlet</servlet-name>
<servlet-class>controller.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mainservlet</servlet-name>
<url-pattern>/mainservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>loginservlet</servlet-name>
<url-pattern>/loginservlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>