插入couchdb时获取异常

时间:2016-07-04 15:36:06

标签: java json exception gwt couchdb

我正在尝试将数据插入couchdb,但却遇到了这些异常 这是日志。

Starting Jetty on port 8888
   [WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String org.rz.client.GreetingService.rr() throws java.lang.IllegalArgumentException' threw an unexpected exception: net.sf.json.JSONException: JSONObject["error"] is not a JSONObject.
	at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:415)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:605)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:370)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
	at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:745)
Caused by: net.sf.json.JSONException: JSONObject["error"] is not a JSONObject.
	at net.sf.json.JSONObject.getJSONObject(JSONObject.java:2163)
	at com.fourspaces.couchdb.CouchResponse.<init>(CouchResponse.java:90)
	at com.fourspaces.couchdb.Session.http(Session.java:365)
	at com.fourspaces.couchdb.Session.get(Session.java:325)
	at com.fourspaces.couchdb.Session.getDatabase(Session.java:183)
	at org.rz.server.GreetingServiceImpl.rr(GreetingServiceImpl.java:21)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:587)
	... 31 more
[ERROR] 500 - POST /rz/greet (127.0.0.1) 57 bytes
   Request headers
      Host: 127.0.0.1:8888
      User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      Accept-Language: en-US,en;q=0.5
      Accept-Encoding: gzip, deflate
      DNT: 1
      Content-Type: text/x-gwt-rpc; charset=utf-8
      X-GWT-Permutation: 98267CD3F923780B0E51298DEFE71EBA
      X-GWT-Module-Base: http://127.0.0.1:8888/rz/
      Referer: http://127.0.0.1:8888/Rz.html
      Content-Length: 108
      Connection: keep-alive
   Response headers
      Content-Type: text/plain

fjjkbk HKJ JK kjhkbħGHJĴjhvjg CH VG jhvbbbbbbbbbbbbbbbbbbbbbt YGY GY宇gygggggugihngdlh d jgdfj hgdhgd HJD GHD dhdkjfhgdg汞柱SG DF GF DGJ fdkjg KDG d ghkd gkdh kgdghf gdfjkgkdkgd公斤FKG kdkgkdf GDF克dfgjkdgd GJ dgdkgkdh DJD GDK gkfg kdkfkgdk GDK gkfghdkf gkdf ghdkfgkd fhg fkg fd ghdfk gd ghfkgkfdgkf ghk

GreetingServiceImpl.java

http://pastebin.com/yZvQGLz7

1 个答案:

答案 0 :(得分:0)

嗯,你是根据你的源代码从Host: 127.0.0.1:8888请求的,不是你的数据库端口。您可能还想尝试使用此example来查看您的设置是否错误或是否是您的代码。