2017-02-21 120 views
1

我收到以下错误,当我尝试运行在Tomcat中的程序:的Tomcat与Scalatra的错误 - 的NoSuchMethodError HttpServletRequest.getContentLengthLong

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getContentLengthLong()J 
org.scalatra.servlet.HttpServletRequestReadOnly.<init>(HttpServletRequestReadOnly.scala:56) 
org.scalatra.ScalatraContext$class.scalatraContext(ScalatraContext.scala:71) 

我使用了Scalatra和Tomcat 7,我试图做一个(akka actor)的AsyncResult。 我使用Maven和我的依赖性以下

<!-- https://mvnrepository.com/artifact/org.scalaj/scalaj-http_2.11 --> 
    <dependency> 
     <groupId>org.scalaj</groupId> 
     <artifactId>scalaj-http_2.11</artifactId> 
     <version>2.3.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.scala-lang</groupId> 
     <artifactId>scala-library</artifactId> 
     <version>2.11.5</version> 
    </dependency> 
    <dependency> 
     <groupId>org.scalatra</groupId> 
     <artifactId>scalatra_2.11</artifactId> 
     <version>2.5.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.scalatra</groupId> 
     <artifactId>scalatra-scalate_2.11</artifactId> 
     <version>2.5.0</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/com.typesafe.akka/akka-actor_2.11 --> 
    <dependency> 
     <groupId>com.typesafe.akka</groupId> 
     <artifactId>akka-actor_2.11</artifactId> 
     <version>2.4.16</version> 
    </dependency> 

    <dependency> 
     <groupId>com.datastax.spark</groupId> 
     <artifactId>spark-cassandra-connector_2.11</artifactId> 
     <version>2.0.0-M3</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/org.scala-lang/scala-reflect --> 
    <dependency> 
     <groupId>org.scala-lang</groupId> 
     <artifactId>scala-reflect</artifactId> 
     <version>2.11.8</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/org.scala-lang/scala-compiler --> 
    <dependency> 
     <groupId>org.scala-lang</groupId> 
     <artifactId>scala-compiler</artifactId> 
     <version>2.11.8</version> 
    </dependency> 


    <!--Spark dependencies--> 
    <dependency> 
     <groupId>org.apache.spark</groupId> 
     <artifactId>spark-core_2.11</artifactId> 
     <version>2.1.0</version> 
    </dependency> 

    <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql_2.11 --> 
    <dependency> 
     <groupId>org.apache.spark</groupId> 
     <artifactId>spark-sql_2.11</artifactId> 
     <version>2.1.0</version> 
    </dependency> 
    <dependency> 
     <groupId>com.databricks</groupId> 
     <artifactId>spark-xml_2.11</artifactId> 
     <version>0.4.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.json4s</groupId> 
     <artifactId>json4s-native_2.11</artifactId> 
     <version>3.5.0</version> 
    </dependency> 

    <!-- https://mvnrepository.com/artifact/org.scalatra/scalatra-swagger_2.11 --> 
    <dependency> 
     <groupId>org.scalatra</groupId> 
     <artifactId>scalatra-swagger_2.11</artifactId> 
     <version>2.5.0</version> 
    </dependency> 

    <!-- https://mvnrepository.com/artifact/org.scalatra/scalatra-json_2.11 --> 
    <dependency> 
     <groupId>org.scalatra</groupId> 
     <artifactId>scalatra-json_2.11</artifactId> 
     <version>2.5.0</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/net.databinder.dispatch/dispatch-core_2.11 --> 
    <dependency> 
     <groupId>net.databinder.dispatch</groupId> 
     <artifactId>dispatch-core_2.11</artifactId> 
     <version>0.11.3</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/org.scala-lang.modules/scala-xml_2.11 --> 
    <dependency> 
     <groupId>org.scala-lang.modules</groupId> 
     <artifactId>scala-xml_2.11</artifactId> 
     <version>1.0.6</version> 
    </dependency> 

    <!-- https://mvnrepository.com/artifact/org.scalatest/scalatest_2.11 --> 
    <dependency> 
     <groupId>org.scalatest</groupId> 
     <artifactId>scalatest_2.11</artifactId> 
     <version>3.0.0</version> 
     <scope>test</scope> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/junit/junit --> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.10</version> 
    </dependency> 

行代码中,我得到的错误是

new AsyncResult { 
    val is = 
     Future { 

我试过,包括依赖,不包括相关性,添加依赖......但我解决不了。任何人都知道如何解决它?

回答

0

记录最后我解决了使用Tomcat 8的问题,因为使用javax,servlet的,包括Tomcat的7对我来说没有工作。