maven中的“NoClassDefFoundError”

时间:2013-04-28 21:04:05

标签: eclipse maven neo4j m2eclipse

我正在尝试按照本教程http://docs.neo4j.org/chunked/milestone/server-plugins.html

创建服务器插件

我在eclipse中创建了一个maven项目(遵循本教程http://blog.neo4j.org/2012/03/how-to-set-up-maven-project-with-neo4j.html)并从maven存储库中添加了必要的依赖项,我实际上在pom.xml和maven依赖项列表中看到了这些依赖项,然后我使用目标“干净安装”创建我的jar并将其添加到neo4j插件。

后一个插件已正确添加,我可以检查一下,谢谢:

curl -v http://localhost:7474/db/data/ 

但奇怪的是,当我尝试从shell运行它时,我收到以下错误:

我确信在创建jar时确实添加了依赖项(我使用以下命令检查:mvn依赖项:tree -Dverbose和包含此类的包“org.lucene.lucene-spellchecker”已添加为好

任何帮助都会非常感激。

谢谢


依赖关系树:

[INFO] org.neo4j.server.plugin.custom:neo4j-didYouMean-plugin:jar:1.9.M05
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] +- org.neo4j:neo4j:jar:1.9.M05:compile
[INFO] |  +- org.neo4j:neo4j-kernel:jar:1.9.M05:compile
[INFO] |  |  \- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] |  +- org.neo4j:neo4j-lucene-index:jar:1.9.M05:compile
[INFO] |  |  +- (org.neo4j:neo4j-kernel:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  |  \- (org.apache.lucene:lucene-core:jar:3.5.0:compile - omitted for     duplicate)
[INFO] |  +- org.neo4j:neo4j-graph-algo:jar:1.9.M05:compile
[INFO] |  |  \- (org.neo4j:neo4j-kernel:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  +- org.neo4j:neo4j-udc:jar:1.9.M05:compile
[INFO] |  |  \- (org.neo4j:neo4j-kernel:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  +- org.neo4j:neo4j-graph-matching:jar:1.9.M05:compile
[INFO] |  |  \- (org.neo4j:neo4j-kernel:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  +- org.neo4j:neo4j-cypher:jar:1.9.M05:compile
[INFO] |  |  +- org.scala-lang:scala-library:jar:2.10.0:compile  
[INFO] |  |  +- (org.neo4j:neo4j-lucene-index:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  |  +- (org.neo4j:neo4j-graph-matching:jar:1.9.M05:compile - omitted for  duplicate)
[INFO] |  |  +- (org.neo4j:neo4j-kernel:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  |  +- (org.neo4j:neo4j-graph-algo:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  |  \- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap- lru:jar:1.3.1:compile
[INFO] |  \- org.neo4j:neo4j-jmx:jar:1.9.M05:compile
[INFO] +- org.neo4j:server-api:jar:1.9.M05:compile
[INFO] |  +- (org.neo4j:neo4j-kernel:jar:1.9.M05:compile - omitted for duplicate)
[INFO] |  +- org.neo4j.3rdparty.javax.ws.rs:jsr311-api:jar:1.1.2.r612:compile
[INFO] |  +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  |  +- commons-lang:commons-lang:jar:2.4:compile 
[INFO] |  |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] |  |     \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  \- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] |     +- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] |     |  \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] |     \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] \- org.apache.lucene:lucene-spellchecker:jar:3.5.0:compile
[INFO]    +- org.apache.lucene:lucene-core:jar:3.5.0:compile  
[INFO]    \- org.apache.lucene:lucene-analyzers:jar:3.5.0:compile
[INFO]       \- (org.apache.lucene:lucene-core:jar:3.5.0:compile - omitted for duplicate)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

错误:

 curl -X POST http://localhost:7474/db/data/ext/DidYouMeanPlugin/graphdb/didYouMean -H "Content-Type:application/json" -d '{"query":"san francisco", "searchType":"airports" , "max":10}'

{
  "message" : "org/apache/lucene/search/spell/LevensteinDistance",
  "exception" : "NoClassDefFoundError",
  "fullname" : "java.lang.NoClassDefFoundError",
  "stacktrace" : [    
           "org.neo4j.server.plugin.didYouMean.DidYouMeanPlugin.didYouMean(DidYouMeanPlugin.java:39)",   "java.lang.reflect.Method.invoke(Method.java:601)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:57)", "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:168)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:300)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:122)", "java.lang.reflect.Method.invoke(Method.java:601)" ]

1 个答案:

答案 0 :(得分:1)

如果lucene类真的在那里,可以用jar tf file检查jar文件吗?

你是用mvn程序集单创建的吗?

您还可以使用mvn dependency:copy-dependencies并将这些额外的jar文件复制到服务器安装的plugins文件夹中。