0

I have created a simple web application for Tomcat. I run the application with tomcat7 which is included by a mavin-plugin. See the pom.xml

It works but there are problems when I make minor changes. For example in the Login.Servlet.java file that it does not update/reload the code automatically. I changed the URL to: login.do1 then control + s and then the exceptions appear in the console.

Then I undo the change to: login.do then control + s. In the console nothing happend. Why? I have included in the pom.xml that tomecat should be reloaded. But nothing happened automatically, normally it should. See the pom.xml.

I tried update Maven Projekt, but it doesnot help. Here are some pictures and the code:

[LoginServlet]

    @WebServlet(urlPatterns = "/login.do")
    public class LoginServlet extends HttpServlet {

        
    @Override
    protected void doGet(HttpServletRequest request, 
    HttpServletResponse response) throws IOException, 
    ServletException 
    {
        request.getRequestDispatcher("/WEB- 
    INF/views/login.jsp").forward(request, response);
    }

[pom.xml]

    <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>com.in28minutes</groupId>
    <artifactId>in28Minutes-first-webapp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

     <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
     </dependencies>

     <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <verbose>true</verbose>
                        <source>1.8</source>
                        <target>1.8</target>
                        <showWarnings>true</showWarnings>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>2.2</version>
                    <configuration>
                        <path>/</path>
                        <contextReloadable>true</contextReloadable>
                    </configuration>
                </plugin>
            </plugins>
         </pluginManagement>
      </build>
    </project>

it works Exceptions Exceptions2

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
OliI
  • 1
  • 2

0 Answers0