J
J
Jake Taylor2020-09-24 13:58:23
Java
Jake Taylor, 2020-09-24 13:58:23

Why does Tomcat see a servtel when deploying a project, which in fact does not exist?

Why does Tomcat see a servtel when deploying a project, which in fact does not exist?

pom.xml structure:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>by.tarasiuk</groupId>
    <artifactId>task_02</artifactId>
    <version>1.0</version>
    <name>task_02</name>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

    <dependencies>
        <!-- Servlet API for tomcat 9 -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- JavaServer Pages API for tomcat 9 -->
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.3</version>
            <scope>provided</scope>
        </dependency>

        <!-- MySQL Connector/J -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.21</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.0</version>
            </plugin>
        </plugins>
    </build>
</project>



The web.xml structure:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <!-- ERROR PAGE -->
    <error-page>
        <location>/error</location>
    </error-page>

</web-app>



Error thrown by Tomcat:
spoiler

[by.tarasiuk.task_02.command.controller.ErrorHandlerServlet] and [by.tarasiuk.task_02.command.servlet.ErrorHandlerServlet] are both mapped to the url-pattern [/error] which is not permitted
    at org.apache.tomcat.util.descriptor.web.WebXml.addServletMappingDecoded(WebXml.java:343)
    at org.apache.tomcat.util.descriptor.web.WebXml.addServletMapping(WebXml.java:336)
    at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2676)
    at org.apache.catalina.startup.ContextConfig.processClass(ContextConfig.java:2352)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2341)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2233)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2227)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2227)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2227)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2227)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2227)
    at org.apache.catalina.startup.ContextConfig.processClasses(ContextConfig.java:1439)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1351)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:983)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5044)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 44 more
[2020-09-24 01:56:41,178] Artifact task_02:war exploded: Error during artifact deployment. See server log for details.



Here is the line that says that I have two servlets with the same name in the directories, but the servlet is only in one folder, here is the screen:
5f6c7bae1a314556482026.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question