Unable to write log file error I am getting in Jenkins for build.xml

223 views
Skip to first unread message

chinmoy padhi

unread,
Oct 12, 2016, 8:53:59 AM10/12/16
to Jenkins Users
Hi Google Users,

Need a help on the mentioned subject line.
I have installed the jenkins using "rpm -ivh" command 
Currently I am running the Jenkins on
1. Linux RHEL 5.8 (32-bit)
2. java version "1.7.0_79"
3. Master mode only
4. Jenkins Version 1.651.3

Steps to Execute
--------------------------
1. I am trying to run the junit test cases from build.xml using Ant(Apache Ant(TM) version 1.9.7 compiled on April 9 2016)
2. Same project I am running from Windows 7 for easy debugging using Eclipse for build.xml and other class files.
3. I copied the Windows project to Linux path and created a job and workspace in /var/lib/jenkins/
4. Run the build from Jenkins which required desired configuration and it run perfectly.
5. Later I compiled the AllTest.java file from Windows and copied the .java and .class file from windows and copied the respective files to /var/lib/jenkins/workspace/project/src folder and .class file to /var/lib/jenkins/workspace/project/target/class folder.
6. When I build the project again from Jenkins it started to throw error after all my test cases got executed.
7. Every time its pointing to Junit task in the build.xml file, I tried to google but didn't get the exact answers.
8. When I didn't find any resolution I have removed the jenkins rpm using "rpm -e" command. But it didn't removed the jenkins folder from /var/lib/jenkins 
9. Re-installed the same rpm and freshly created new freestyle project but it didn't resolve the same error and again after running all the test cases it throws the error.

Appreciate your help. Please find the attached build.xml

Thanks,
Chinmoy
build.xml
Jenkins-console-output.txt

Björn Pedersen

unread,
Oct 12, 2016, 10:53:45 AM10/12/16
to Jenkins Users
Hi,

probably you need to check the access permission on your workspace (and contents).
Jenkins normally will run the jobs as an other user as you used to do your manual test.

Björn

chinmoy padhi

unread,
Oct 13, 2016, 3:33:18 AM10/13/16
to Jenkins Users
I tried to check the owner and permission of jobs(jenkins for both directory and contents) directory and workspace(jrootsfor both directory and contents) directory

Even I changed the workspace to jenkins from root , also gave chmod 777 * to all but still getting the error.

chinmoy padhi

unread,
Oct 17, 2016, 12:48:33 PM10/17/16
to Jenkins Users
Hi All,

I have resolved the above error with some trial and error but not sure whether this is 100% work for others or not, but what I did I am sharing my experience.

Steps
----------
  1. service jenkins stop or sudo /etc/init.d/jenkins stop
  2. Make sure all services are stopped. Even u should not be able to access the jenkins url from browser.
  3. check the rpm -qa|grep jenkins. It will show your jenkins rpm package.
  4. Run the find / -name jenkins to check where and all jenkins is used.

    [root@localhost]# find / -name "jenkins"
    /etc/rc.d/init.d/jenkins
    /etc/logrotate.d/jenkins
    /etc/sysconfig/jenkins
    /usr/lib/jenkins
    /var/lib/jenkins
    /var/cache/jenkins
    /var/cache/yum/jenkins
    /var/log/jenkins
    [root@localhost]#

  5. Take backup of /var/lib/jenkins/ folders to /var/lib/jenkins.old 
  6. Now run the "rpm -e --nodeps jenkins-1.651.3-1.1" to remove the package.

  7. Repeat Step 4 again and make sure /var/cache/jenkins and /var/cache/yum/jenkins are the two directories which remains
  8. Now run "rpm -ivh /etc/yum.repos.d/jenkins-1.651.3-1.1.noarch.rpm" to install the jenkins package
  9. Run "service jenkins start" so that it will listen on port 8080
  10. Open the jenkins url with IP and Port.
  11. Create a free-style project with some name and make sure the project should be created in /var/lib/jenkins/jobs
  12. Configure the necessary steps such as JDK Installation, Ant installations etc., in manage jenkins options.
  13. Now run the build for your project without configuring build.xml path, so that it will create a workspace folder in /var/lib/jenkins/workspace/<project name>
  14. Now copy the build.xml file from existing project and put the file in /var/lib/jenkins/workspace/<project name>
  15. Build project from Jenkins.
  16. Try to resolve script label errors such as it will complain for lib, src folders not found and copy/create those folders to resolve the compilation errors.
  17. Once done with all errors try to run the build again so that you will get Build Successful.
  18. Make sure you copy/create src and lib folder and don't copy/create the target folder.
  19. Make sure target folder must be created automatically by Jenkins with jenkins ownership and jenkins file permission. Rest all may be root owner and root file permission.
  20. Now configure the junit report and email notifications to get the build reports in email.
Reply all
Reply to author
Forward
0 new messages