Getting NoSuchMethodError on accessing a spring mvc project

HI,
On doing localhost:8080 i get the following error :

HTTP ERROR: 500

Problem accessing /. Reason:

    java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z

Open in new window


I am using embedded Jetty. running it from a main java file and trying to configure JSP but unable to do so.

Following is my pom.xml :

<?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>org.directi.code</groupId>
    <artifactId>snippet</artifactId>
    <version>1.0-SNAPSHOT</version>

    <name>snippet</name>
    <url>http://maven.apache.org</url>

    <properties>
        <java.version>1.7</java.version>
        <spring.version>4.2.1.RELEASE</spring.version>
        <cglib.version>2.2.2</cglib.version>
        <jetty.version>9.3.5.v20151012</jetty.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- Spring core & mvc -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>

        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>

        <!-- CGLib for @Configuration -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>${cglib.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>codemirror</artifactId>
            <version>5.6</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
        </dependency>

        <!-- Servlet Spec -->

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.6.2</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>3.0-alpha-1</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.2.1.RELEASE</version>
        </dependency>


        <!-- MySQL Driver -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.36</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
            <version>9.2.13.v20150730</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-all</artifactId>
            <version>${jetty.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlets</artifactId>
            <version>${jetty.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-util</artifactId>
            <version>6.1.26</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>9.3.5.v20151012</version>
        </dependency>



    </dependencies>

    <repositories>
        <repository>
            <id>olympus.maven.central</id>
            <name>Olympus MavenCentral Proxy</name>
            <url>http://ci.aws.talk.to:8081/nexus/content/repositories/central/</url>
        </repository>
        <repository>
            <id>olympus.maven.releases</id>
            <name>Olympus Release Repository</name>
            <url>http://ci.aws.talk.to:8081/nexus/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>olympus.maven.snapshots</id>
            <name>Olympus Snapshot Repository</name>
            <url>http://ci.aws.talk.to:8081/nexus/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>olympus.maven.thirdparty</id>
            <name>Olympus Thirdparty Repository</name>
            <url>http://ci.aws.talk.to:8081/nexus/content/repositories/thirdparty/</url>
        </repository>
    </repositories>

    <build>
        <finalName>snippet</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <targetPath>webapp</targetPath>
                <directory>src/main/webapp</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                </filter>
                            </filters>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>org.directi.code.AppStart</mainClass>
                                </transformer>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.handlers</resource>
                                </transformer>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.schemas</resource>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>rpm-maven-plugin</artifactId>
                <version>2.0</version>
                <extensions>true</extensions>
                <configuration>
                    <name>flocksnippet</name>
                    <copyright>2015</copyright>
                    <group>Application/Collectors</group>
                    <projversion>1.0</projversion>
                    <defineStatements>
                        <defineStatement>groupname %{name}</defineStatement>
                        <defineStatement>username %{name}</defineStatement>
                    </defineStatements>
                    <mappings>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>pom.xml</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets/src</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>src</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets/target/classes</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>target/classes</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets/target/generated-sources</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>target/generated-sources</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets/target/maven-archiver</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>target/maven-archiver</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets/target/maven-status</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>target/maven-status</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets/target/snippet</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>target/snippet</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>true</directoryIncluded>
                            <directory>/opt/flock-snippets/target</directory>
                            <username>flocksnippet</username>
                            <groupname>flocksnippet</groupname>
                            <sources>
                                <source>
                                    <location>target/snippet.war</location>
                                </source>
                            </sources>
                        </mapping>
                        <mapping>
                            <directoryIncluded>false</directoryIncluded>
                            <directory>/etc/init.d</directory>
                            <username>root</username>
                            <groupname>root</groupname>
                            <sources>
                                <source>
                                    <location>src/main/script/init.d/snippet</location>
                                </source>
                            </sources>
                        </mapping>
                    </mappings>
                    <preinstallScriptlet>
                        <scriptFile>src/main/script/pre_deploy.sh</scriptFile>
                        <fileEncoding>utf-8</fileEncoding>
                    </preinstallScriptlet>
                    <postinstallScriptlet>
                        <scriptFile>src/main/script/post_deploy.sh</scriptFile>
                        <fileEncoding>utf-8</fileEncoding>
                    </postinstallScriptlet>
                    <preremoveScriptlet>
                        <scriptFile>src/main/script/pre_remove.sh</scriptFile>
                        <fileEncoding>utf-8</fileEncoding>
                    </preremoveScriptlet>
                    <needarch>noarch</needarch>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <fork>true</fork>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Open in new window

Rohit BajajAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gurpsbassiCommented:
Anything in jetty logs?
0
CEHJCommented:
javax.servlet.http.HttpServletRequest.isAsyncStarted

Open in new window

is a method of the Servlet 3 API. You need that version for your container to work
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mccarlIT Business Systems Analyst / Software DeveloperCommented:
What CEHJ says is correct but you may be thinking... "Hey, but I have version 3 of the servlet api defined in my POM?"

Well, the problem is that you have a very early version "3.0-alpha-1". I wouldn't use anything labelled with ALPHA. As it turns out, that method that you are having issues with mustn't have made it in the that version yet. So basically, you just need to upgrade the servlet-api version that you are using. Use this (or an even higher version) in your POM...

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>javax.servlet-api</artifactId>
	<version>3.0.1</version>
</dependency>

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.