在GWT内的SolrJ调用中显示NoClassDefError

时间:2013-05-09 15:32:49

标签: gwt solrj

我正在使用SolrJ从GWT项目中调用Solr。我在项目中包含了所有solrj依赖类,包括NoClassDefFound错误显示的类。但是我不明白什么是遗失的。这是错误。

   [WARN] Server class 'org.apache.solr.client.solrj.impl.HttpSolrServer' could not be found in the web app, but was found on the system classpath
   [WARN] Adding classpath entry 'file:/C:/Users/Nick/Documents/Project/Project/war/WEB-INF/lib/Solr/solr-solrj-4.2.1.jar' to the web app classpath for this session
   For additional info see: file:/C:/Users/Nick/Documents/Eclipse/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201208080120-rel-r37/gwt-2.4.0/doc/helpInfo/webAppClassPath.html
[WARN] Server class 'org.apache.http.NoHttpResponseException' could not be found in the web app, but was found on the system classpath
   [WARN] Adding classpath entry 'file:/C:/Users/Nick/Documents/Eclipse/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201208080120-rel-r37/gwt-2.4.0/gwt-dev.jar' to the web app classpath for this session
   For additional info see: file:/C:/Users/Nick/Documents/Eclipse/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201208080120-rel-r37/gwt-2.4.0/doc/helpInfo/webAppClassPath.html
Starting Jetty on port 8888
   [WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.Project.shared.ProjectResponse com.Project.client.GreetingService.search(com.Project.shared.ProjectQuery)' threw an unexpected exception: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at org.apache.solr.client.solrj.impl.HttpSolrServer.<clinit>(HttpSolrServer.java:79)
    at com.Project.server.GreetingServiceImpl.search(GreetingServiceImpl.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension.findClass(JettyLauncher.java:372)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
    ... 29 more
[ERROR] 500 - POST /Project/greet (127.0.0.1) 57 bytes
   Request headers
      Host: 127.0.0.1:8888
      Connection: keep-alive
      Content-Length: 213
      X-GWT-Module-Base: http://127.0.0.1:8888/Project/
      X-GWT-Permutation: HostedMode
      Origin: http://127.0.0.1:8888
      User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
      Content-Type: text/x-gwt-rpc; charset=UTF-8
      Accept: */*
      Referer: http://127.0.0.1:8888/Project.html?gwt.codesvr=127.0.0.1:9997
      Accept-Encoding: gzip,deflate,sdch
      Accept-Language: en-US,en;q=0.8
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
   Response headers
      Content-Type: text/plain

以下是我收录的罐子清单:

  • 公地编解码器-1.7.jar
  • commons-io-2.1.jar
  • 共享记录-1.1.2.jar
  • gwtquery-1.3.3.jar
  • 的HttpClient-4.2.3.jar
  • 的HttpCore-4.2.2.jar
  • httpmime-4.2.3.jar
  • SLF4J-API-1.7.5.jar
  • SLF4J-简单1.5.6.jar
  • 的solr-solrj-4.2.1.jar
  • wstx-ASL-3.2.7.jar
  • 动物园管理员-3.4.5.jar

1 个答案:

答案 0 :(得分:0)

尝试将所有这些罐子复制到WEB-INF \ lib

几个月前我遇到了类似的问题而且出现了我忘了这么做了