JsonSlurper执行失败

时间:2016-12-23 17:07:12

标签: groovy jsonslurper

我正在尝试使用JsonSlurper从不同的文件中输入变量。但它在第二次执行时失败了。有人能帮助我吗?

它从步骤Jenkins_File_Path = readFile ( "${Local_Path_App}" + "/Jenkinsfile" )

失败了

Main.groovy

import groovy.json.JsonSlurper

Global_Settings_Path = readFile ("${Main_Local_Path}" + "/Config/GlobalSettings_Java.json" )
def jsonSlurper = new JsonSlurper()
def GlobalVariables = jsonSlurper.parseText(Global_Settings_Path)

Jenkins_File_Path = readFile ( "${Local_Path_App}" + "/Jenkinsfile" )
def jsonSlurper1 = new JsonSlurper()
def json = jsonSlurper1.parseText(Jenkins_File_Path)

GlobalSettings_Java.json

{
    "LOB": {
        "SVN_Config_Path": "testpath",
        "Local_Path_LOB": "test",
    }
}

Jenkinsfile

{
    "BUILD_INFO": {
        "Build_Type" : "Maven",
    }
}

错误记录

  

java.io.NotSerializableException:groovy.json.internal.LazyMap       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)       在org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)       在org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)       at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)       at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)       在java.util.HashMap.internalWriteEntries(HashMap.java:1785)       在java.util.HashMap.writeObject(HashMap.java:1362)       at sun.reflect.GeneratedMethodAccessor469.invoke(Unknown Source)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)       at java.lang.reflect.Method.invoke(Method.java:498)       at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)       在org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)       在org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)       在org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)       在org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)       在org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)       在org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)       at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)       at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)       在java.util.TreeMap.writeObject(TreeMap.java:2438)       at sun.reflect.GeneratedMethodAccessor475.invoke(Unknown Source)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)       at java.lang.reflect.Method.invoke(Method.java:498)       at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)       在org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)       在org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)       在org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)       at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)       在org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)       在org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:132)       在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:433)       在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:412)       在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:357)       在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access $ 100(CpsThreadGroup.java:78)       在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup $ 2.call(CpsThreadGroup.java:236)       在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup $ 2.call(CpsThreadGroup.java:224)       at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService $ 2.call(CpsVmExecutorService.java:63)       at java.util.concurrent.FutureTask.run(FutureTask.java:266)       在hudson.remoting.SingleLaneExecutorService $ 1.run(SingleLaneExecutorService.java:112)       在jenkins.util.ContextResettingExecutorService $ 1.run(ContextResettingExecutorService.java:28)       at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)       at java.util.concurrent.FutureTask.run(FutureTask.java:266)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)       at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)       在java.lang.Thread.run(Thread.java:745)   引起:发生的异常:       在当地的本地人       在现场来电者       在现场e       在实地计划       在字段线程中       在对象org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@7abaf96e   完成:失败

0 个答案:

没有答案