简体   繁体   English

无法在cpanel + tomcat中运行servlet

[英]can not run servlet in cpanel+ tomcat

i use tomcat + cpanel . 我使用tomcat + cpanel。 my jsps and tags correct run but can not run servlet . 我的jsps和标签正确运行,但无法运行servlet。

my web.xml content is : 我的web.xml内容是:

 <servlet>
        <servlet-name>Servlet1</servlet-name>
        <servlet-class>pack1.Servlet1</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Servlet1</servlet-name>
        <url-pattern>/Servlet1</url-pattern>
    </servlet-mapping>

when request www.mydomain.com/Servlet1 get this error (404) : 当请求www.mydomain.com/Servlet1时收到此错误(404):

Not Found

The requested URL /Servlet1 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

please help me. 请帮我。

The cpanel suggests that you're using a 3rd party host. cpanel建议您使用的是第三方主机。 A lot of cheapass 3rd party hosts have due to system limitations different rules for deploying servlets. 由于系统的限制,许多cheapass 3rd主机都有不同的规则来部署servlet。 You should be reading their developer guide/documentation/FAQ how exactly to properly deploy servlets on their host. 您应该阅读他们的开发人员指南/文档/常见问题解答,了解如何在其主机上正确部署servlet。 For example, some 3rd party hosts require a specific folder or package structure, or they require a specific URL structure. 例如,某些第三方主机需要特定的文件夹或程序包结构,或者它们需要特定的URL结构。

Godaddy, for example, requires you to use the URL structure /servlet/YourServletClassName , with the /servlet prefix path, see also their FAQ . 例如,Godaddy要求您使用URL结构/servlet/YourServletClassName/servlet前缀路径,另请参见其FAQ

If you want to have full control over deployment or want to follow standard Java EE rules, you'd rather look for a different host. 如果要完全控制部署或要遵循标准的Java EE规则,则宁愿寻找其他主机。 For example, OpenShift , which is a completely free cloud hosting service using the full fledged JBoss AS 7 application server, including EJB and JPA support and all on em and the free choice between MySQL and PostgreSQL databases. 例如, OpenShift是一项完全免费的云托管服务,它使用成熟的JBoss AS 7应用程序服务器,包括EJB和JPA支持以及所有功能,并且可以在MySQL和PostgreSQL数据库之间自由选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM