我开发了maven应用程序,它使用mongo-hadoop连接器从mongodb中提取数据并使用Apache spark处理它。如果我在嵌入式Jetty服务器上运行它,整个过程将顺利运行。但是,如果我将它部署到Tomcat服务器7,它总是在代码行中断,该代码行从JavaPairRDD收集数据,但不能解释问题可能是什么:
15/07/09 20:42:05 INFO storage.BlockManagerInfo: Added broadcast_0_piece0 in memory on localhost:58302 (size: 6.3 KB, free: 946.6 MB)
15/07/09 20:42:05 INFO spark.SparkContext: Created broadcast 0 from newAPIHadoopRDD at SparkCategoryRecommender.java:106
Exception in thread "Thread-6" java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2918)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1174)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.spark.mapreduce.SparkHadoopMapReduceUtil$class.firstAvailableClass(SparkHadoopMapReduceUtil.scala:74)
at org.apache.spark.mapreduce.SparkHadoopMapReduceUtil$class.newJobContext(SparkHadoopMapReduceUtil.scala:28)
at org.apache.spark.rdd.NewHadoopRDD.newJobContext(NewHadoopRDD.scala:66)
at org.apache.spark.rdd.NewHadoopRDD.getPartitions(NewHadoopRDD.scala:94)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:219)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:217)
at scala.Option.getOrElse(Option.scala:120)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:217)
at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:32)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:219)
at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:217)
at scala.Option.getOrElse(Option.scala:120)
at org.apache.spark.rdd.RDD.partitions(RDD.scala:217)
at org.apache.spark.SparkContext.runJob(SparkContext.scala:1779)
at org.apache.spark.rdd.RDD$$anonfun$collect$1.apply(RDD.scala:885)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:148)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:109)
at org.apache.spark.rdd.RDD.withScope(RDD.scala:286)
at org.apache.spark.rdd.RDD.collect(RDD.scala:884)
at org.apache.spark.api.java.JavaRDDLike$class.collect(JavaRDDLike.scala:335)
at org.apache.spark.api.java.AbstractJavaRDDLike.collect(JavaRDDLike.scala:47)
at com.warrantylife.iqmetrix.spark.SparkCategoryRecommender.buildDataModelOnProductid(SparkCategoryRecommender.java:149)
at com.warrantylife.iqmetrix.spark.SparkCategoryRecommender.computeAndStoreRecommendationsForProductsInCategory(SparkCategoryRecommender.java:179)
at com.warrantylife.recommendation.impl.CategoryRecommendationManagerImpl.computeRecommendationsForCategory(CategoryRecommendationManagerImpl.java:105)
at com.warrantylife.testdata.TestDataGeneratorService$1.run(TestDataGeneratorService.java:55)
at java.lang.Thread.run(Thread.java:745)
我猜Tomcat上发生了一些库冲突,但我不知道在哪里寻找问题。
这是我的整个依赖树:
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ warranty-analytics ---
[INFO] org.warrantylife:warranty-analytics:war:0.1.0-SNAPSHOT
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided
[INFO] +- com.sun.jersey:jersey-client:jar:1.19:compile
[INFO] +- com.sun.jersey:jersey-server:jar:1.19:compile
[INFO] +- com.sun.jersey:jersey-core:jar:1.19:compile
[INFO] | \- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] +- com.sun.jersey:jersey-servlet:jar:1.19:compile
[INFO] +- org.apache.hadoop:hadoop-common:jar:2.4.1:compile
[INFO] | +- org.apache.hadoop:hadoop-annotations:jar:2.4.1:compile
[INFO] | | \- jdk.tools:jdk.tools:jar:1.6:system
[INFO] | +- com.google.guava:guava:jar:11.0.2:compile
[INFO] | +- commons-cli:commons-cli:jar:1.2:compile
[INFO] | +- xmlenc:xmlenc:jar:0.52:compile
[INFO] | +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | +- commons-codec:commons-codec:jar:1.4:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- commons-net:commons-net:jar:3.1:compile
[INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] | +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] | +- com.sun.jersey:jersey-json:jar:1.9:compile
[INFO] | +- tomcat:jasper-compiler:jar:5.5.23:runtime
[INFO] | +- tomcat:jasper-runtime:jar:5.5.23:runtime
[INFO] | +- javax.servlet.jsp:jsp-api:jar:2.1:runtime
[INFO] | +- net.java.dev.jets3t:jets3t:jar:0.9.0:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.1.2:compile
[INFO] | | \- com.jamesmurty.utils:java-xmlbuilder:jar:0.4:compile
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] | | +- commons-digester:commons-digester:jar:1.8:compile
[INFO] | | | \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] | | \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.8.8:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.8.8:compile
[INFO] | +- org.apache.avro:avro:jar:1.7.4:compile
[INFO] | | \- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] | +- org.apache.hadoop:hadoop-auth:jar:2.4.1:compile
[INFO] | +- com.jcraft:jsch:jar:0.1.42:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- org.apache.zookeeper:zookeeper:jar:3.4.5:compile
[INFO] | \- org.apache.commons:commons-compress:jar:1.4.1:compile
[INFO] | \- org.tukaani:xz:jar:1.0:compile
[INFO] +- org.mongodb.mongo-hadoop:mongo-hadoop-core:jar:1.3.2:compile
[INFO] | +- org.apache.hadoop:hadoop-mapreduce-client-app:jar:2.4.1:compile
[INFO] | | +- org.apache.hadoop:hadoop-yarn-server-web-proxy:jar:2.4.1:compile
[INFO] | | +- com.google.inject.extensions:guice-servlet:jar:3.0:compile
[INFO] | | | \- com.google.inject:guice:jar:3.0:compile
[INFO] | | | +- javax.inject:javax.inject:jar:1:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | \- io.netty:netty:jar:3.6.2.Final:compile
[INFO] | +- org.apache.hadoop:hadoop-mapreduce-client-shuffle:jar:2.4.1:compile
[INFO] | | \- org.apache.hadoop:hadoop-yarn-server-nodemanager:jar:2.4.1:compile
[INFO] | | \- com.sun.jersey.contribs:jersey-guice:jar:1.9:compile
[INFO] | +- org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.4.1:compile
[INFO] | +- org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.4.1:compile
[INFO] | | +- org.apache.hadoop:hadoop-yarn-common:jar:2.4.1:compile
[INFO] | | +- org.apache.hadoop:hadoop-yarn-client:jar:2.4.1:compile
[INFO] | | \- org.apache.hadoop:hadoop-yarn-server-common:jar:2.4.1:compile
[INFO] | \- org.apache.hadoop:hadoop-mapreduce-client-core:jar:2.4.1:compile
[INFO] +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.12:compile
[INFO] +- org.jboss.resteasy:resteasy-json-p-provider:jar:3.0.9.Final:compile
[INFO] | +- javax.json:javax.json-api:jar:1.0:compile
[INFO] | \- org.glassfish:javax.json:jar:1.0.3:compile
[INFO] +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.9.Final:compile
[INFO] | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | +- javax.activation:activation:jar:1.1:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.2.6:compile
[INFO] | \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] +- org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.9.Final:compile
[INFO] | \- org.codehaus.jackson:jackson-xc:jar:1.9.12:compile
[INFO] +- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.0.9.Final:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.2.7:compile
[INFO] | +- com.sun.xml.bind:jaxb-core:jar:2.2.7:compile
[INFO] | | +- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] | | \- com.sun.istack:istack-commons-runtime:jar:2.16:compile
[INFO] | \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.12:compile
[INFO] | \- javax.xml.bind:jsr173_api:jar:1.0:compile
[INFO] +- org.codehaus.jettison:jettison:jar:1.3.2:compile
[INFO] | \- stax:stax-api:jar:1.0.1:compile
[INFO] +- org.apache.mahout:mahout-core:jar:0.9:compile
[INFO] | +- org.apache.mahout:mahout-math:jar:0.9:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.4:compile
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | +- org.apache.lucene:lucene-core:jar:4.6.1:compile
[INFO] | +- org.apache.mahout.commons:commons-cli:jar:2.0-mahout:compile
[INFO] | +- org.apache.solr:solr-commons-csv:jar:3.5.0:compile
[INFO] | \- org.apache.hadoop:hadoop-core:jar:1.2.1:compile
[INFO] | +- org.apache.commons:commons-math:jar:2.1:compile
[INFO] | \- commons-el:commons-el:jar:1.0:compile
[INFO] +- org.apache.mahout:mahout-integration:jar:0.10.0:compile
[INFO] | +- org.apache.mahout:mahout-hdfs:jar:0.10.0:compile
[INFO] | +- org.apache.mahout:mahout-mr:jar:0.10.0:compile
[INFO] | \- org.apache.hbase:hbase-client:jar:1.0.0:compile
[INFO] | +- org.apache.hbase:hbase-annotations:jar:1.0.0:compile
[INFO] | +- org.apache.hbase:hbase-common:jar:1.0.0:compile
[INFO] | +- org.apache.hbase:hbase-protocol:jar:1.0.0:compile
[INFO] | +- org.apache.htrace:htrace-core:jar:3.1.0-incubating:compile
[INFO] | +- org.jruby.jcodings:jcodings:jar:1.0.8:compile
[INFO] | +- org.jruby.joni:joni:jar:2.1.2:compile
[INFO] | \- com.github.stephenc.findbugs:findbugs-annotations:jar:1.3.9-1:compile
[INFO] +- org.apache.lucene:lucene-benchmark:jar:4.10.0:compile
[INFO] | +- org.apache.lucene:lucene-codecs:jar:4.10.0:compile
[INFO] | +- org.apache.lucene:lucene-facet:jar:4.10.0:compile
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:4.10.0:compile
[INFO] | +- org.apache.lucene:lucene-memory:jar:4.10.0:compile
[INFO] | +- org.apache.lucene:lucene-queries:jar:4.10.0:compile
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:4.10.0:compile
[INFO] | +- org.apache.lucene:lucene-spatial:jar:4.10.0:compile
[INFO] | +- com.ibm.icu:icu4j:jar:53.1:compile
[INFO] | +- com.spatial4j:spatial4j:jar:0.4.1:compile
[INFO] | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.17:compile
[INFO] | \- xerces:xercesImpl:jar:2.9.1:compile
[INFO] +- org.apache.lucene:lucene-analyzers-common:jar:4.10.0:compile
[INFO] +- com.carrotsearch.randomizedtesting:randomizedtesting-runner:jar:2.1.6:compile
[INFO] +- org.easymock:easymock:jar:3.2:compile
[INFO] | +- cglib:cglib-nodep:jar:2.2.2:compile
[INFO] | \- org.objenesis:objenesis:jar:1.3:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.32:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.3.6.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.6.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.3.2.Final:compile
[INFO] | \- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:4.3.2.Final:compile
[INFO] | \- net.sf.ehcache:ehcache-core:jar:2.4.3:compile
[INFO] +- junit:junit:jar:4.11:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- org.mongodb:mongo-java-driver:jar:3.0.2:compile
[INFO] +- org.mongodb:bson:jar:3.0.2:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.7:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.7:compile
[INFO] +- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.apache.commons:commons-math3:jar:3.5:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- com.typesafe:config:jar:1.2.1:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] | \- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] +- com.novemberain:quartz-mongodb:jar:1.6.0:compile
[INFO] | \- joda-time:joda-time:jar:2.3:compile
[INFO] +- com.google.code.gson:gson:jar:2.2.2:compile
[INFO] \- org.apache.spark:spark-core_2.10:jar:1.4.0:compile
[INFO] +- com.twitter:chill_2.10:jar:0.5.0:compile
[INFO] | \- com.esotericsoftware.kryo:kryo:jar:2.21:compile
[INFO] | +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:compile
[INFO] | \- com.esotericsoftware.minlog:minlog:jar:1.2:compile
[INFO] +- com.twitter:chill-java:jar:0.5.0:compile
[INFO] +- org.apache.hadoop:hadoop-client:jar:2.2.0:compile
[INFO] | +- org.apache.hadoop:hadoop-hdfs:jar:2.2.0:compile
[INFO] | \- org.apache.hadoop:hadoop-yarn-api:jar:2.2.0:compile
[INFO] +- org.apache.spark:spark-launcher_2.10:jar:1.4.0:compile
[INFO] +- org.apache.spark:spark-network-common_2.10:jar:1.4.0:compile
[INFO] +- org.apache.spark:spark-network-shuffle_2.10:jar:1.4.0:compile
[INFO] +- org.apache.spark:spark-unsafe_2.10:jar:1.4.0:compile
[INFO] +- org.apache.curator:curator-recipes:jar:2.4.0:compile
[INFO] | \- org.apache.curator:curator-framework:jar:2.4.0:compile
[INFO] | \- org.apache.curator:curator-client:jar:2.4.0:compile
[INFO] +- org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile
[INFO] +- org.slf4j:jul-to-slf4j:jar:1.7.10:compile
[INFO] +- com.ning:compress-lzf:jar:1.0.3:compile
[INFO] +- org.xerial.snappy:snappy-java:jar:1.1.1.7:compile
[INFO] +- net.jpountz.lz4:lz4:jar:1.2.0:compile
[INFO] +- org.roaringbitmap:RoaringBitmap:jar:0.4.5:compile
[INFO] +- org.spark-project.akka:akka-remote_2.10:jar:2.3.4-spark:compile
[INFO] | +- org.spark-project.akka:akka-actor_2.10:jar:2.3.4-spark:compile
[INFO] | +- org.spark-project.protobuf:protobuf-java:jar:2.5.0-spark:compile
[INFO] | \- org.uncommons.maths:uncommons-maths:jar:1.2.2a:compile
[INFO] +- org.spark-project.akka:akka-slf4j_2.10:jar:2.3.4-spark:compile
[INFO] +- org.scala-lang:scala-library:jar:2.10.4:compile
[INFO] +- org.json4s:json4s-jackson_2.10:jar:3.2.10:compile
[INFO] | \- org.json4s:json4s-core_2.10:jar:3.2.10:compile
[INFO] | +- org.json4s:json4s-ast_2.10:jar:3.2.10:compile
[INFO] | \- org.scala-lang:scalap:jar:2.10.0:compile
[INFO] | \- org.scala-lang:scala-compiler:jar:2.10.0:compile
[INFO] +- org.apache.mesos:mesos:jar:shaded-protobuf:0.21.1:compile
[INFO] +- io.netty:netty-all:jar:4.0.23.Final:compile
[INFO] +- com.clearspring.analytics:stream:jar:2.7.0:compile
[INFO] +- io.dropwizard.metrics:metrics-core:jar:3.1.0:compile
[INFO] +- io.dropwizard.metrics:metrics-jvm:jar:3.1.0:compile
[INFO] +- io.dropwizard.metrics:metrics-json:jar:3.1.0:compile
[INFO] +- io.dropwizard.metrics:metrics-graphite:jar:3.1.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.4:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.4:compile
[INFO] +- com.fasterxml.jackson.module:jackson-module-scala_2.10:jar:2.4.4:compile
[INFO] | \- org.scala-lang:scala-reflect:jar:2.10.4:compile
[INFO] +- org.apache.ivy:ivy:jar:2.4.0:compile
[INFO] +- oro:oro:jar:2.0.8:compile
[INFO] +- org.tachyonproject:tachyon-client:jar:0.6.4:compile
[INFO] | \- org.tachyonproject:tachyon:jar:0.6.4:compile
[INFO] +- net.razorvine:pyrolite:jar:4.4:compile
[INFO] +- net.sf.py4j:py4j:jar:0.8.2.1:compile
[INFO] \- org.spark-project.spark:unused:jar:1.0.0:compile
修改 我解决了这个问题。似乎问题出在Java 8和Tomcat 7的组合中。迁移到Tomcat 8后,问题就消失了。
一些相关的讨论帮助我理解了这个问题: org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15