Tag Archives: Unable to access javax.servlet.servletexception

Unable to access javax.servlet.servletexception [How to Solve]

Using idea, a spring boot project based on Maven is created. In the process of deploying the project with war package and Linux (providing JDK environment, Tomcat), when packaging, you will be prompted that javax. Servlet. ServletException
cannot be accessed

You need to remove tomcat from the web dependency
		<dependency>
		  <groupId>org.springframework.boot</groupId>
		  <artifactId>spring-boot-starter-web</artifactId>
		  <exclusions>
		    <exclusion>
		      <groupId>org.springframework.boot</groupId>
		      <artifactId>spring-boot-starter-tomcat</artifactId>
		    </exclusion>
		  </exclusions>
		</dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
 <plugin>		No web required for packaging
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
    </plugin>