简体   繁体   English

无法让Jenkins开始使用Tomcat

[英]Can't get Jenkins to start using Tomcat

I'm having a problem trying to deploy Jenkins war to Tomcat. 我在尝试将Jenkins战争部署到Tomcat时遇到了问题。 I'm using CentOS with Java 1.6.0_28, Tomcat 6.0.24 and last version of jenkins as of January 21, 2014. 我正在使用CentOS与Java 1.6.0_28,Tomcat 6.0.24和jenkins的最新版本截至2014年1月21日。

I think the problem is more related to Jenkins because of the log but not sure. 我认为问题与Jenkins有关,因为日志但不确定。 When I google the error only find the classes that fire the exception but no solution. 当我谷歌时,错误只找到引发异常但没有解决方案的类。 Here is the log. 这是日志。 Any help is appreciated. 任何帮助表示赞赏。

Jan 21, 2014 9:30:26 PM hudson.util.BootFailure publish
SEVERE: Failed to initialize Jenkins
hudson.util.NoHomeDir
    at hudson.WebAppMain.contextInitialized(WebAppMain.java:126)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
    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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Jenkins tries to create /usr/share/tomcat7/.jenkins to store its data, but the directory isnt created, so it throws NoHome Exception. Jenkins尝试创建/usr/share/tomcat7/.jenkins来存储其数据,但目录未创建,因此它会抛出NoHome Exception。

To fix this, create the .jenkins manually (with correct own/grp permissions to tomcat) and restart tomcat. 要解决此问题,请手动创建.jenkins(对tomcat具有正确的自己/ grp权限)并重新启动tomcat。

I was facing exactly the same problem. 我面临着同样的问题。 In my case it all started with a Jenkins/Git error: 在我的情况下,这一切都始于Jenkins / Git错误:

"error: could not lock config file /usr/share/tomcat6/.gitconfig: Permission denied".

Apparently all permissions were OK and .gitconfig was not locked. 显然所有权限都没问题,并且.gitconfig没有被锁定。 I've executed a chown for tomcat user and everything was just fine again after a service restart: 我为tomcat用户执行了一个chown,在服务重启后一切都很好了:

sudo chown -R tomcat6:tomcat6 /var/lib/tomcat6/
sudo chown -R tomcat6:tomcat6 /etc/tomcat6/
sudo chown -R tomcat6:tomcat6 /usr/share/tomcat6/

(My Linux is Debian based) (我的Linux是基于Debian的)

I am not sure what user you are running tomcat as, but it looks like jenkins can't create it's home directory. 我不确定你运行tomcat的用户是什么,但看起来jenkins无法创建它的主目录。 Look into the JENKINS_HOME parameter. 查看JENKINS_HOME参数。

尝试检查一些目录,比如/ var / lib /来检测权限是否正确,也许这是一个“拒绝权限”阻止在“/ var / lib / jenkins”上创建jenkins home

Finally I had to go through the hard way. 最后,我不得不经历艰难的道路。 I got ride of the Tomcat6 package from repo and reinstalled manually. 我从repo乘坐Tomcat6包并手动重新安装。 It solved the problem. 它解决了这个问题。 I really hate when Linux "official" packages don't work. 当Linux“官方”软件包无效时,我真的很讨厌。

Thanks anyway. 不管怎么说,还是要谢谢你。

Check which is the user running tomcat. 检查哪个是运行tomcat的用户。 And check which is the home directory of that user in /etc/passwd The home folder is probably missing. 并在/ etc / passwd中检查该用户的主目录。可能缺少主文件夹。 Create the folder and give ownership to the running tomcat user 创建文件夹并为正在运行的tomcat用户授予所有权

Jenkins Configuration Issue Jenkins配置问题

I was trying to setup Jenkins web app inside the Tomcat server and it continuously gave me this error: 我试图在Tomcat服务器中设置Jenkins Web应用程序,它不断给我这个错误:

SEVERE: Failed to initialize Jenkins hudson.util.NoHomeDir 严重:无法初始化Jenkins hudson.util.NoHomeDir

This I fixed by creating the folder as follows: 我通过创建文件夹修复如下:

mkdir /usr/share/tomcat7/.jenkins

On redeploying Jenkins I again noticed the following error: 在重新部署Jenkins时,我再次注意到以下错误:

WARNING: Failed to record boot attempts java.io.FileNotFoundException: /usr/share/tomcat7/.jenkins/failed-boot-attempts.txt (Permission denied) 警告:无法记录引导尝试java.io.FileNotFoundException:/usr/share/tomcat7/.jenkins/failed-boot-attempts.txt(权限被拒绝)

I fixed this issue by giving full access to this folder. 我通过提供对此文件夹的完全访问权限来解决此问题。

sudo chmod 777 /usr/share/tomcat7/.jenkins

I believe 777 is not a good approach in a production environment, but for development perspective it looks ok. 我相信777在生产环境中不是一个好方法,但从开发角度来看,它看起来还不错。

Credits to: http://www.cyberaka.com/?p=422 致记: http ://www.cyberaka.com/?p = 422

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM