Having trouble starting Jenkins: “java.io.FileNotF

2020-04-17 06:27发布

I just downloaded the Jenkins WAR, version 1.651.1. I’m trying to set it up on my Amazon Linux box. I’m running Java 1.7. I moved the WAR into its own directory, /usr/share/java/jenkins, and then set JENKINS_HOME to be that directory. Then I ran the command listed here — https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins . Looked so simple on the web site. But wouldn’t you know it. Got the below error

[davea@mydevbox ~]$ java -jar /usr/share/java/jenkins/jenkins.war 
Running from: /usr/share/java/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Apr 19, 2016 9:29:34 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 19, 2016 9:29:34 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Apr 19, 2016 9:29:34 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.FileNotFoundException: /usr/share/java/jenkins/war/META-INF/MANIFEST.MF (No such file or directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:280)
    at winstone.HostConfiguration.<init>(HostConfiguration.java:83)
    at winstone.HostGroup.initHost(HostGroup.java:66)
    at winstone.HostGroup.<init>(HostGroup.java:45)
    at winstone.Launcher.<init>(Launcher.java:145)
    at winstone.Launcher.main(Launcher.java:356)
    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:606)
    at Main._main(Main.java:307)
    at Main.main(Main.java:98)

What else do I need to do to get Jenkins started?

Edit: Output in response to the suggestion given ...

[davea@mydevbox ~]$ sudo useradd jenkins
[davea@mydevbox ~]$ sudo chown -R jenkins:jenkins /usr/share/java/jenkins/jenkins.war 
[davea@mydevbox ~]$ 
[davea@mydevbox ~]$ sudo su - jenkins
[jenkins@mydevbox ~]$ java -jar /usr/share/java/jenkins/jenkins.war
Running from: /usr/share/java/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Apr 21, 2016 4:46:08 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 21, 2016 4:46:08 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Apr 21, 2016 4:46:08 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.FileNotFoundException: /usr/java/jboss/standalone/deployments/jenkins.war/war/META-INF/MANIFEST.MF (No such file or directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:280)
    at winstone.HostConfiguration.<init>(HostConfiguration.java:83)
    at winstone.HostGroup.initHost(HostGroup.java:66)
    at winstone.HostGroup.<init>(HostGroup.java:45)
    at winstone.Launcher.<init>(Launcher.java:145)
    at winstone.Launcher.main(Launcher.java:356)
    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:606)
    at Main._main(Main.java:307)
    at Main.main(Main.java:98)

8条回答
【Aperson】
2楼-- · 2020-04-17 06:46

My two cents: not only must be jenkins user be the owner of $JENKINS_HOME, it looks like it also has to be the owner of jenkins.war (not just have access to it). Found out the hard way while configuring sytemd unit file for Jenkins.

查看更多
别忘想泡老子
3楼-- · 2020-04-17 06:47

Probably the userid that you are using is not the owner of JENKINS_HOME.

This has happened to me on Vagrant, when trying to use the jenkins user on a JENKINS_HOME owned by vagrant. jenkins did have write permissions to on JENKINS_HOME, but it is not enough: it has to be the owner.

I learned this because when I tried sudo -u jenkins touch file-in-jenkins-home I got touch: setting times (...): Operation not permitted. And then I found https://unix.stackexchange.com/questions/64848/cannot-touch-m-a-writable-file

查看更多
Melony?
4楼-- · 2020-04-17 06:48

I was facing the same issue after i accidently deleted the cache from /var/cache/jenkins. I resolved it by manually creating the jenkins folder in /var/cache/ with the same permission which is there in /var/lib/jenkins and it worked.

查看更多
爷、活的狠高调
5楼-- · 2020-04-17 06:49

I had exactly the same issue. Unable to change the user, I changed the hosted port by appending --httpPort=9090 to my java run command.

$ java -jar /usr/share/java/jenkins/jenkins.war --httpPort=9090

查看更多
地球回转人心会变
6楼-- · 2020-04-17 06:55

“java.io.FileNotFoundException: /usr/share/java/jenkins/war/META-INF/MANIFEST.MF (No such file or directory)”

Guys be chill.

Just run below command.

mkdir /var/cache/jenkins;chown jenkins:jenkins /var/cache/jenkins;

and the start the app.

查看更多
欢心
7楼-- · 2020-04-17 07:00

I have an old jenkins version 1.641, and downloaded the war file of 2.240.1, when run

java -jar jenkins.war

I got similar errors:

java.io.FileNotFoundException: c:\jenkins.jenkins\war\META-INF\MANIFEST.MF (Access is denied) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:278) at winstone.HostConfiguration.(HostConfiguration.java:81) at winstone.HostGroup.initHost(HostGroup.java:66) at winstone.HostGroup.(HostGroup.java:45) at winstone.Launcher.(Launcher.java:172) at winstone.Launcher.main(Launcher.java:362) 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 Main._main(Main.java:375) at Main.main(Main.java:151) 2020-02-07 22:06:19.010+0000 [id=1] SEVERE winstone.Logger#logInternal: Container startup failed java.io.FileNotFoundException: c:\jenkins.jenkins\war\META-INF\MANIFEST.MF (Access is denied) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at winstone.HostConfiguration.getWebRoot(HostConfiguration.java:278) at winstone.HostConfiguration.(HostConfiguration.java:81) at winstone.HostGroup.initHost(HostGroup.java:66) at winstone.HostGroup.(HostGroup.java:45) at winstone.Launcher.(Launcher.java:172) at winstone.Launcher.main(Launcher.java:362) 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 Main._main(Main.java:375) at Main.main(Main.java:151)

it is found that the folder c:\jenkins\.jenkins\war did not exist.

After manually created the folder, the new Jenkins works.

查看更多
登录 后发表回答