0

我在 Tomcat 服务器上部署电梯应用程序时遇到问题。在服务器启动时,日志显示错误:

INFO: Deploying web application archive lift.war
Nov 08, 2013 5:47:18 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Nov 08, 2013 5:47:18 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/lift] startup failed due to previous errors

该错误发生在 Tomcat 6 和 7 上,在 Tomcat 7 上带有电梯版本 2.6 和 scala 2.10.3

提前致谢!

编辑:这是来自 Tomcat 的堆栈跟踪:

SCHWERWIEGEND: Exception starting filter LiftFilter
java.lang.NoSuchMethodError: scala.Predef$.Map()Lscala/collection/immutable/Map$;
at net.liftweb.common.BoxTrait$class.$init$(Box.scala:62)
at net.liftweb.common.Box$.<init>(Box.scala:49)
at net.liftweb.common.Box$.<clinit>(Box.scala)
at net.liftweb.util.Props$.mode$lzycompute(Props.scala:112)
at net.liftweb.util.Props$.mode(Props.scala:110)
at net.liftweb.util.Props$.devMode$lzycompute(Props.scala:204)
at net.liftweb.util.Props$.devMode(Props.scala:204)
at net.liftweb.http.LiftRules$.<init>(LiftRules.scala:79)
at net.liftweb.http.LiftRules$.<clinit>(LiftRules.scala)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init(ServletFilterProvider.scala:38)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:928)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4649)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5305)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

编辑:这是我的 build.sbt:

name := "lift_project"

version := "0.0.1"

organization := "net.liftweb"

scalaVersion := "2.10.3"

resolvers ++= Seq("snapshots"     at "http://oss.sonatype.org/content/repositories/snapshots",
              "staging"       at "http://oss.sonatype.org/content/repositories/staging",
              "releases"      at "http://oss.sonatype.org/content/repositories/releases"
             )

seq(com.github.siasia.WebPlugin.webSettings :_*)

unmanagedBase <<= baseDirectory { base => base / "lib" }

unmanagedJars in Compile <<= baseDirectory map { base => (base ** "*.jar").classpath }

unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }

scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-language:implicitConversions", "-language:postfixOps")

libraryDependencies ++= {
  val liftVersion = "2.6-M1"
  Seq(
    "net.liftweb"       %% "lift-webkit"        % liftVersion        % "compile",
    "net.liftweb"       %% "lift-mapper"        % liftVersion        % "compile",
    "net.liftweb"       %% "lift-ldap"        % liftVersion        % "compile",
    "org.eclipse.jetty" % "jetty-webapp"        % "8.1.7.v20120910"  % "container,test",
    "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
    "ch.qos.logback"    % "logback-classic"     % "1.0.6",
    "com.h2database"    % "h2"                  % "1.3.167",
    "mysql"             % "mysql-connector-java" % "5.1.25",
    "javax.servlet" % "servlet-api" % "2.5" % "provided->default"
  )
}

net.virtualvoid.sbt.graph.Plugin.graphSettings

编辑:以及 lib 文件夹的内容:

activation-1.1.jar
commons-codec-1.6.jar
commons-fileupload-1.2.2.jar
h2-1.3.167.jar
htmlparser-1.4.jar
iText-2.1.5.jar
jcommon-1.0.18.jar
jfreechart-1.0.15.jar
jfreechart-1.0.15-demo.jar
jfreechart-1.0.15-experimental.jar
jfreechart-1.0.15-swt.jar
joda-convert-1.2.jar
joda-time-2.1.jar
junit.jar
lift-actor_2.10-2.6-M1.jar
lift-common_2.10-2.6-M1.jar
lift-db_2.10-2.6-M1.jar
lift-json_2.10-2.6-M1.jar
lift-ldap_2.10-2.6-M1.jar
lift-mapper_2.10-2.6-M1.jar
lift-markdown_2.10-2.6-M1.jar
lift-proto_2.10-2.6-M1.jar
lift-util_2.10-2.6-M1.jar
lift-webkit_2.10-2.6-M1.jar
logback-classic-1.0.6.jar
logback-core-1.0.6.jar
mail-1.4.4.jar
mysql-connector-java-5.1.25.jar
paranamer-2.4.1.jar
sbt-launch.jar
scala-compiler.jar
scala-library.jar
scalap-2.10.0.jar
scala-reflect-2.10.3.jar
slf4j-api-1.7.2.jar
swtgraphics2d.jar
4

3 回答 3

0

scala-library.jar 看起来确实很可疑,因为我们无法从文件名中分辨出版本。也许它是一个旧的标准库,您的电梯版本无法正常工作。

尝试

unzip -p scala-library.jar META-INF/MANIFEST.MF

要查看版本,您需要它是 2.10.0 或更高版本。

我同意harp seal pup的观点,即问题可能是由您复制非托管 jar 引起的。尽量不要使用非托管 jars(删除该行,让 sbt 管理依赖项)。

于 2013-11-12T10:06:39.327 回答
0

好的。我想问题出在这里:

unmanagedJars in Compile <<= baseDirectory map { base => (base ** "*.jar").classpath }

这只是将项目下的每个 jar 添加到 WAR 中。我不知道您使用的是哪个 SBT 版本,但 IIRC 旧版本的 SBT 将 scala-library.jar 放在您的项目根目录(baseDirectory)下的构建路径中,在您的情况下,它会包含在构建过​​程中,结果在罐子冲突中。

尝试删除可疑行或将“baseDirectory”更改为更具体的内容,例如“unmanagedBase”。

于 2013-11-10T22:32:15.823 回答
0

在使用了一些尝试和错误方法后,我终于确定了导致问​​题的 jar:

sbt-launch.jar

从 lib 文件夹中删除它后,在 Tomcat(和 Jetty 也一样)上一切正常

于 2013-11-19T10:00:10.437 回答