0

I am trying to start SpringBoot Application as jar from Linux machine and I am getting the below error where the jar is working fine in Windows machine,

I am using Java version 1.8 and spring-boot-dependencies with 1.3.6.RELEASE.

12:03:16.266 [localhost-startStop-1] ERROR o.a.c.c.C.[.[localhost].[/myapp] - Exception sending context initialized event to listener instance of class org.apache.tomcat.websocket.server.WsContextListener 
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
    at org.apache.tomcat.websocket.server.WsServerContainer.(WsServerContainer.java:149)
    at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)
    at org.apache.tomcat.websocket.server.WsContextListener.contextInitialized(WsContextListener.java:39)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
12:03:16.288 [localhost-startStop-1] ERROR o.a.catalina.core.StandardContext - One or more listeners failed to start. Full details will be found in the appropriate container log file 
12:03:25.928 [localhost-startStop-1] INFO  o.a.c.util.SessionIdGeneratorBase - Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [9,636] milliseconds. 
12:03:25.932 [localhost-startStop-1] ERROR o.a.catalina.core.StandardContext - Context [/myapp] startup failed due to previous errors 
 <properties>
    <start-class>com.myapp.Application</start-class>
    <camunda.version>7.4.0</camunda.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <camunda.version>7.4.0</camunda.version>
    <org.springframework.version>4.2.6.RELEASE</org.springframework.version>
    <java.version>1.8</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
</properties>


<dependencyManagement>
    <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.3.6.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.mockftpserver</groupId>
        <artifactId>MockFtpServer</artifactId>
        <version>2.4</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- http://mvnrepository.com/artifact/org.springframework/spring-test -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-ftp</artifactId>
    </dependency>

    <dependency>
        <groupId>org.camunda.bpm.extension</groupId>
        <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
        <version>1.1.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
    </dependency>

    <dependency>
        <groupId>org.camunda.bpm.identity</groupId>
        <artifactId>camunda-identity-ldap</artifactId>
        <version>${camunda.version}</version>
    </dependency>

    <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-engine-rest</artifactId>
        <version>${camunda.version}</version>
        <classifier>classes</classifier>
    </dependency>

    <dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>jtds</artifactId>
        <version>1.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.6</version>
    </dependency>

    <dependency>
        <!-- AssertJ Testing Library -->
        <groupId>org.camunda.bpm.extension</groupId>
        <artifactId>camunda-bpm-assert</artifactId>
        <version>1.2</version>
        <scope>test</scope>
    </dependency>

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


    <dependency>
        <!-- Used to generate test coverage reports, see https://github.com/camunda/camunda-consulting/tree/master/snippets/process-test-coverage -->
        <groupId>org.camunda.consulting.snippets</groupId>
        <artifactId>process-test-coverage</artifactId>
        <version>0.2.3</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>javax.ejb</groupId>
        <artifactId>javax.ejb-api</artifactId>
        <version>3.2</version>
    </dependency>


    <dependency>
        <groupId>com.jcabi</groupId>
        <artifactId>jcabi-aspects</artifactId>
        <version>0.22.4</version>
    </dependency>

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.7</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId>
        <version>1.4</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.uuid</groupId>
        <artifactId>java-uuid-generator</artifactId>
        <scope>provided</scope>
        <version>3.1.2</version>
    </dependency>

    <!-- Required to use Spin dataformat support in unit tests -->
    <dependency>
        <groupId>org.camunda.spin</groupId>
        <artifactId>camunda-spin-dataformat-all</artifactId>
        <version>1.2.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-engine-plugin-spin</artifactId>
        <version>${camunda.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-engine-plugin-connect</artifactId>
        <version>${camunda.version}</version>
    </dependency>
    <!-- DLI -->
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0</version>
    </dependency>

</dependencies>

<repositories>
    <repository>
        <id>camunda-bpm-nexus</id>
        <name>Camunda BPM Maven Repository</name>
        <url>https://app.camunda.com/nexus/content/groups/public</url>
    </repository>
</repositories>

<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <!-- Following plugin executes the testng tests -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14.1</version>
            <configuration>
                <!-- Suite testng xml file to consider for test execution -->
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin> 
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.3.6.RELEASE</version>
            <configuration>
                <mainClass>${start-class}</mainClass>
                <layout>ZIP</layout>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Please let me know why I am facing this problem. Please find the screenshots for the dependencies used,

[![Dependencies][1]][1]
[![Dependencies2][2]][2]
[![Dependencies3][3]][3]

  [1]: https://i.stack.imgur.com/6mqr8.jpg
  [2]: https://i.stack.imgur.com/ybBmS.jpg
  [3]: https://i.stack.imgur.com/RveD5.jpg
user3428736
  • 864
  • 2
  • 13
  • 33
  • Seems like you don't have the Servlet 3.0 spec on your classpath. Perhaps it would be a good idea to check your dependencies if there's another, older, servlet-spec lurking around... – Florian Schaetz Aug 30 '16 at 11:18
  • could you add more info? command, that you use. Dependencies (pom.xml or something else). – emoleumassi Aug 30 '16 at 11:31
  • please check also http://stackoverflow.com/a/8611825/6372139 – Daniel Bubenheim Aug 30 '16 at 11:31
  • I have added my pom.xml dependencies and the servlet version is 3.0.1 , please let me know why I am getting this issue and I am wondering only it is happening in Linux and not in windows. – user3428736 Aug 30 '16 at 12:12

1 Answers1

0

Quoting from the Spring website

That setup does not allow you to override individual dependencies using a property as explained above. To achieve the same result, you’d need to add an entry in the dependencyManagement of your project before the spring-boot-dependencies entry. For instance, to upgrade to another Spring Data release train you’d add the following to your pom.xml.

I don't think the servlet container is appropriately imported. Can you use STS or other IDE to view the maven dependency management graph? Would be helpful if you can pass it over.

Balajee
  • 201
  • 2
  • 7
  • Thanks!! It is working fine with Eclipse & IDE in Windows but after deploying in linux machine I am facing the issue and I have taken screenshots for the dependencies used. – user3428736 Aug 30 '16 at 13:56
  • Added dependecies as screenshot in the below url, [1]: http://i.stack.imgur.com/6mqr8.jpg [2]: http://i.stack.imgur.com/ybBmS.jpg [3]: http://i.stack.imgur.com/RveD5.jpg – user3428736 Aug 31 '16 at 05:44