有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Jenkins在通过jenkinscli创建作业时失败。罐子

我在ubuntu服务器上安装了jenkins。当我试图通过jenkins cli创建工作时。罐子如下:

curl https://raw.github.com/sebastianbergmann/php-jenkins-template/master/config.xml | java -jar jenkins-cli.jar -s http://localhost:9090 create-job php-template

它失败并在终端上返回异常消息(如下)。我尝试了几种方法来克服这个问题,包括以root用户身份运行命令,并将该文件夹命名为chmod 777,但这些方法都不起作用

java.io.IOException: Unable to read /var/lib/jenkins/jobs/php-template/config.xml
        at hudson.XmlFile.read(XmlFile.java:144)
        at hudson.model.Items.load(Items.java:278)
        at hudson.model.ItemGroupMixIn$4.call(ItemGroupMixIn.java:258)
        at hudson.model.ItemGroupMixIn$4.call(ItemGroupMixIn.java:256)
        at hudson.model.Items.whileUpdatingByXml(Items.java:90)
        at hudson.model.ItemGroupMixIn.createProjectFromXML(ItemGroupMixIn.java:256)
        at jenkins.model.Jenkins.createProjectFromXML(Jenkins.java:3055)
        at hudson.cli.CreateJobCommand.run(CreateJobCommand.java:73)
        at hudson.cli.CLICommand.main(CLICommand.java:237)
        at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
        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:622)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:326)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:301)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:260)
        at hudson.remoting.UserRequest.perform(UserRequest.java:121)
        at hudson.remoting.UserRequest.perform(UserRequest.java:49)
        at hudson.remoting.Request$2.run(Request.java:324)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
        at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
        at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
        at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
        at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:701)
Caused by: com.thoughtworks.xstream.io.StreamException:  : input contained no data
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:126)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1053)
        at hudson.XmlFile.read(XmlFile.java:142)
        ... 29 more
Caused by: java.io.EOFException: input contained no data
        at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3003)
        at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1410)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 38 more
bta@bta-dev:~$ curl https://raw.github.com/sebastianbergmann/php-jenkins-template/master/config.xml | java -jar jenkins-cli.jar -s http://localhost:9090 create-job php-jenkins-template
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
java.io.IOException: Unable to read /var/lib/jenkins/jobs/php-jenkins-template/config.xml
        at hudson.XmlFile.read(XmlFile.java:144)
        at hudson.model.Items.load(Items.java:278)
        at hudson.model.ItemGroupMixIn$4.call(ItemGroupMixIn.java:258)
        at hudson.model.ItemGroupMixIn$4.call(ItemGroupMixIn.java:256)
        at hudson.model.Items.whileUpdatingByXml(Items.java:90)
        at hudson.model.ItemGroupMixIn.createProjectFromXML(ItemGroupMixIn.java:256)
        at jenkins.model.Jenkins.createProjectFromXML(Jenkins.java:3055)
        at hudson.cli.CreateJobCommand.run(CreateJobCommand.java:73)
        at hudson.cli.CLICommand.main(CLICommand.java:237)
        at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
        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:622)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:326)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:301)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:260)
        at hudson.remoting.UserRequest.perform(UserRequest.java:121)
        at hudson.remoting.UserRequest.perform(UserRequest.java:49)
        at hudson.remoting.Request$2.run(Request.java:324)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
        at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
        at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
        at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
        at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:701)
Caused by: com.thoughtworks.xstream.io.StreamException:  : input contained no data
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:126)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1053)
        at hudson.XmlFile.read(XmlFile.java:142)
        ... 29 more
Caused by: java.io.EOFException: input contained no data
        at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3003)
        at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1410)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 38 more

共 (1) 个答案

  1. # 1 楼答案

    使用命令

    curl -L https://raw.githubusercontent.com/sebastianbergmann/php-jenkins-template/master/config.xml | \
     java -jar jenkins-cli.jar -s http://localhost:8080 create-job php-template