jfinal 3.2默认 json 实现暂不支持 json 到 object 的转换


java.lang.RuntimeException: java.lang.RuntimeException: jfinal 3.2默认 json 实现暂不支持 json 到 object 的转换,建议使用 active recrord 的 Generator 生成 base model,再通过 me.setJsonFactory(new MixedJsonFactory()) 来支持

at com.jfinal.weixin.sdk.api.AccessToken.<init>(AccessToken.java:48)

at com.jfinal.weixin.sdk.api.AccessTokenApi$1.call(AccessTokenApi.java:104)

at com.jfinal.weixin.sdk.api.AccessTokenApi$1.call(AccessTokenApi.java:99)

at com.jfinal.weixin.sdk.utils.RetryUtils.retryOnException(RetryUtils.java:32)

at com.jfinal.weixin.sdk.api.AccessTokenApi.refreshAccessToken(AccessTokenApi.java:99)

at com.jfinal.weixin.sdk.api.AccessTokenApi.refreshAccessTokenIfNecessary(AccessTokenApi.java:77)

at com.jfinal.weixin.sdk.api.AccessTokenApi.getAccessToken(AccessTokenApi.java:44)

at com.jfinal.weixin.sdk.api.AccessTokenApi.getAccessTokenStr(AccessTokenApi.java:66)

at com.jfinal.weixin.sdk.api.MenuApi.createMenu(MenuApi.java:38)

at com.chefuwanjia.wx.api.WxApiController.createMenu(WxApiController.java:51)

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.jfinal.aop.Invocation.invoke(Invocation.java:73)

at com.jfinal.weixin.sdk.jfinal.ApiInterceptor.intercept(ApiInterceptor.java:28)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:82)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)

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.Server.handle(Server.java:365)

at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)

at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)

at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)

at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)

at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)

at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)

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(Unknown Source)

Caused by: java.lang.RuntimeException: jfinal 3.2默认 json 实现暂不支持 json 到 object 的转换,建议使用 active recrord 的 Generator 生成 base model,再通过 me.setJsonFactory(new MixedJsonFactory()) 来支持

at com.jfinal.json.JFinalJson.parse(JFinalJson.java:341)

at com.jfinal.weixin.sdk.utils.JsonUtils.parse(JsonUtils.java:149)

at com.jfinal.weixin.sdk.api.AccessToken.<init>(AccessToken.java:34)

... 41 more


评论区

JFinal

2017-11-25 11:00

异常提示已经很明确告诉了解决办法:
me.setJsonFactory(new MixedJsonFactory());

李耀

2017-11-26 15:32

@JFinal 我放到这个方法configConstant把me.setJsonFactory(new MixedJsonFactory()); 还是这个错误 不支持

u8weixin

2017-12-07 16:47

@JFinal me是什么对象?

JFinal

2017-12-07 17:48

是 YourJFinalConfig extends JFinalConfig 中的 configConstant(Constants me) 方法中的参数,由于回复的次数很多,加上jfinal demo、jfinal 手册与源代码中都这么使用,所以也就省略了解释性说明

ybbwxz

2018-06-25 15:44

用jetty启动没有问题,用Tomcat启动为什么就会报这个错误?

热门反馈

扫码入社