jenkins 插件开发 java.lang.UnsupportedOperationException: Refusing to marshal net.sf.json.JSONObject for security reasons; see https://jenkins.io/redirect/class-filter/

 

 

java.lang.UnsupportedOperationException: Refusing to marshal net.sf.json.JSONObject for security reasons; see https://jenkins.io/redirect/class-filter/

 

 在jenkins上开发svn插件,由于我在类中使用JSONObject去持久化config.jelly 页面上的数据,最后点击保存会报上述错误。

错误原因详见 jenkins官方文档:https://jenkins.io/redirect/class-filter/

具体解决办法有三种:

1.把private JSONObject upfile 改成 private String upfile  但是我代码基本开发完成,这个错误也是在jenkins war的2.1x 版本上出的问题,我在开发的jenkins war 版本 2.7.3 没有这个问题,所以我不想改代码,因此这个方法跳过

2.参考 https://github.com/jenkinsci/workflow-support-plugin/pull/50/files 这个仓库代码 ,把报错的三方jar包加入白名单,该方法我已验证,可行

3.https://issues.jenkins-ci.org/browse/JENKINS-51909?jql=labels%20%3D%20JEP-200%20AND%20text%20~%20%22JSONObject%22  参考文档回复,项目中使用DeployHub Plugin version 8.0.13 版本插件,该方法我没有尝试,如果有使用这个方法尝试成功的朋友请留言。

 

至于在pom.xml 中加入如下配置 根本没用

 

posted @ 2019-05-15 20:07  margo  阅读(727)  评论(0编辑  收藏  举报