SSH 整合时 json报错 java.sql.SQLException: Positioned Update not supported

文章分类:Java编程 关键字: positioned update not supported异常解决备忘
今天在SSH项目中遇到运用JSON插件,产生如下异常:
Java代码
  1. 2008-11-15 12:58:21 org.apache.catalina.core.StandardWrapperValve invoke  
  2. 严重: Servlet.service() for servlet default threw exception  
  3. java.sql.SQLException: Positioned Update not supported.  
  4.     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)  
  5.     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)  
  6.     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)  
  7.     at com.mysql.jdbc.ResultSetImpl.getCursorName(ResultSetImpl.java:2050)  
  8.     at com.mchange.v2.c3p0.impl.NewProxyResultSet.getCursorName(NewProxyResultSet.java:545)  
  9.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
  10.     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
  11.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
  12.     at java.lang.reflect.Method.invoke(Unknown Source)  
  13.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:224)  
  14.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  15.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  16.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  17.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  18.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  19.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  20.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  21.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  22.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  23.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  24.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  25.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  26.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  27.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  28.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  29.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  30.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  31.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  32.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  33.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  34.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  35.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  36.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  37.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  38.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  39.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  40.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  41.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  42.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  43.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  44.     at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)  
  45.     at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)  
  46.     at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)  
  47.     at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)  
  48.     at com.googlecode.jsonplugin.JSONWriter.write(JSONWriter.java:91)  
  49.     at com.googlecode.jsonplugin.JSONUtil.serialize(JSONUtil.java:90)  
  50.     at com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:173)  
  51.     at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)  
  52.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)  
  53.     at zz.WebNews.util.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:62)  
  54.     at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)  
  55.     at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)  
  56.     at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)  
  57.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)  
  58.     at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)  
  59.     at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)  
  60.     at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)  
  61.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)  
  62.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
  63.     at zz.WebNews.util.AuthFilter.doFilter(AuthFilter.java:62)  
  64.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)  
  65.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
  66.     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)  
  67.     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)  
  68.     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)  
  69.     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)  
  70.     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)  
  71.     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)  
  72.     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)  
  73.     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)  
  74.     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)  
  75.     at java.lang.Thread.run(Unknown Source)  
2008-11-15 12:58:21 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
java.sql.SQLException: Positioned Update not supported.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
	at com.mysql.jdbc.ResultSetImpl.getCursorName(ResultSetImpl.java:2050)
	at com.mchange.v2.c3p0.impl.NewProxyResultSet.getCursorName(NewProxyResultSet.java:545)
	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.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:224)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.add(JSONWriter.java:321)
	at com.googlecode.jsonplugin.JSONWriter.bean(JSONWriter.java:225)
	at com.googlecode.jsonplugin.JSONWriter.process(JSONWriter.java:157)
	at com.googlecode.jsonplugin.JSONWriter.value(JSONWriter.java:123)
	at com.googlecode.jsonplugin.JSONWriter.write(JSONWriter.java:91)
	at com.googlecode.jsonplugin.JSONUtil.serialize(JSONUtil.java:90)
	at com.googlecode.jsonplugin.JSONResult.execute(JSONResult.java:173)
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
	at zz.WebNews.util.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:62)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
	at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at zz.WebNews.util.AuthFilter.doFilter(AuthFilter.java:62)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)


该异常有两种解决方法:
第一:在struts.xml文件的配置中排除不要被JSON序列化的属性,例如:
Java代码
  1. <action name="functions" class="getFunctionsAction" method="functions_getList">  
  2.             <result type="json">  
  3.              <param name="excludeProperties">functionsService</param>  
  4.             </result>  
  5.         </action>  
<action name="functions" class="getFunctionsAction" method="functions_getList">
    		<result type="json">
    		 <param name="excludeProperties">functionsService</param>
    		</result>
    	</action>

其中functionsService就是不要被JSON序列化的属性。
第二:在Action文件中去除不要被JSON序列化的属性的get()方法,例如:
Java代码
  1. public IFunctionsService getFunctionsService() {  
  2.         return functionsService;  
  3.     }  
public IFunctionsService getFunctionsService() {
		return functionsService;
	}

这样做functionsService同样不会被JSON序列化。

你可能感兴趣的:(java,apache,sql,json,ssh)