简体   繁体   中英

can not run servlet in cpanel+ tomcat

i use tomcat + cpanel . my jsps and tags correct run but can not run servlet .

my web.xml content is :

 <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) :

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. A lot of cheapass 3rd party hosts have due to system limitations different rules for deploying servlets. You should be reading their developer guide/documentation/FAQ how exactly to properly deploy servlets on their host. For example, some 3rd party hosts require a specific folder or package structure, or they require a specific URL structure.

Godaddy, for example, requires you to use the URL structure /servlet/YourServletClassName , with the /servlet prefix path, see also their 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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