HTML Publisher plugin failed to extract (only when Serenity tests fail) - jenkins

I am using Serenity BDD for my automation test framework and now I wish to publish the the results onto Jenkins using the HTML Publisher plugin.
When all my tests pass, no problem, I can publish the report with no issues, but if 1 single test fails, I get an error during the publishing stage from the HTML Publisher plugin. The error I receive is due to "truncated TAR archive". Not really sure what this means. Looking deeper at the error, I can see:
Caused by: java.io.IOException: Entry 'pagesource11965942031956863624.html' closed at '0' before the '106438' bytes specified in the header were written, but I also don't know what this means.
Here is the full error (with some directory partly hidden):
java.io.IOException: Failed to extract /home/jenkins/agent/workspace/*<someJenkinsDirs>*/target/site/serenity/**/*
at hudson.FilePath.readFromTar(FilePath.java:2982)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2742)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2706)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2694)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2677)
at htmlpublisher.HtmlPublisher.publishReports(HtmlPublisher.java:242)
at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:62)
at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:44)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Suppressed: java.util.concurrent.ExecutionException: java.io.IOException: Entry 'pagesource11965942031956863624.html' closed at '0' before the '106438' bytes specified in the header were written
at hudson.remoting.Channel$2.adapt(Channel.java:1036)
at hudson.remoting.Channel$2.adapt(Channel.java:1030)
at hudson.remoting.FutureAdapter.get(FutureAdapter.java:66)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2745)
... 12 more
Caused by: java.io.IOException: Entry 'pagesource11965942031956863624.html' closed at '0' before the '106438' bytes specified in the header were written
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.closeArchiveEntry(TarArchiveOutputStream.java:429)
at hudson.util.io.TarArchiver.visit(TarArchiver.java:117)
at hudson.util.DirScanner.scanSingle(DirScanner.java:51)
at hudson.util.DirScanner$Glob.scan(DirScanner.java:146)
at hudson.FilePath.writeToTar(FilePath.java:2943)
at hudson.FilePath$CopyRecursiveRemoteToLocal.invoke(FilePath.java:2908)
at hudson.FilePath$CopyRecursiveRemoteToLocal.invoke(FilePath.java:2893)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3492)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:121)
at java.base/java.lang.Thread.run(Unknown Source)
Suppressed: java.io.IOException: This archive contains unclosed entries.
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:291)
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:309)
at hudson.util.io.TarArchiver.close(TarArchiver.java:124)
at hudson.FilePath.writeToTar(FilePath.java:2942)
... 12 more
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 61.0.33.251/61.0.33.251:52128
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel$2.adapt(Channel.java:1034)
at hudson.remoting.Channel$2.adapt(Channel.java:1030)
at hudson.remoting.FutureAdapter.get(FutureAdapter.java:66)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2745)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2706)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2694)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2677)
at htmlpublisher.HtmlPublisher.publishReports(HtmlPublisher.java:242)
at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:62)
at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:44)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: Truncated TAR archive
at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.read(TarArchiveInputStream.java:743)
at java.base/java.io.InputStream.read(InputStream.java:205)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1309)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:978)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1282)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:953)
at hudson.util.IOUtils.copy(IOUtils.java:52)
at hudson.FilePath.readFromTar(FilePath.java:2972)
... 13 more
I've also tried using archiveArtefacts but I get the exact same error (guessing they both function in similar ways).
How do I fix this error?
EDIT:
I've done some more digging into this issue and I've found that the pagesource<random20numbers>.html is generated when either a test fails or a test has an error (not sure if there are other situations in which this file in generated). The file itself seems to be the HTML and CSS code for the webpage that Serenity can "see" in the test failure/error (ie, the page being viewed by the Selenium webdriver when the test fails).
I've tried deleting the file in my Jenkins pipeline with a simple rm pagesource<numbers> command, but ran into permission issues (will speak to people on team to resolve this) and I've also tried to use the includes parameter for the HTML publisher plugin. The Glob expression I have tried is **/!(pagesource)* but this then causes me to get the error:
ERROR: Directory '<someJenkinsDirs>/target/site/serenity' exists but failed copying to '<someJenkinsDirs>/builds/29/htmlreports/Serenity_20Report'.

I've managed to find 1 solution to this problem, it's not quite what I wanted, but it'll until I find or am shown another way.
Serenity takes screenshots during the test and this functionality can be customised in the serenity.properties file. The options available are:
FOR_EACH_ACTION
BEFORE_AND_AFTER_EACH_STEP
AFTER_EACH_STEP
FOR_FAILURES
DISABLED
I simply disabled the screenshot functionality and the pagesource<numbers>.html is no longer generated. More about managing Serenity screenshots here
I believe the pagesource.html file is generated so that a tester can debug why the test is failing or erroring out. Disabling screenshots means that the following page isn't available in the Serenity report, meaning that there is no need to generate the pagesource.html file (the HTML source button links to the pagesource.html file).
If anyone finds a better solution to this problem that doesn't involve disabling screenshots, please post it, as I'd prefer to have screenshots enabled so that it is easier for our BA's to see the user journey.

For others, that might be Googling and find a similar stack trace. We had that cryptic stack trace, because Windows Defender removed file while copying. The fix was, that we had to disable "Real-time protection".

Related

Jenkins CI: 'NumberFormatException: empty String'

We have a Jenkins installation and some projects which are tested by NUnit. This works fine and it writes an NUnit results XML file.
Then we have a 'Publish NUnit test result report' post-build step. But since friday it produces this error:
Recording NUnit tests results
ERROR: Step ‘Publish NUnit test result report’ aborted due to exception:
java.io.IOException: remote file operation failed: C:\Jenkins\workspace\xxx at hudson.remoting.Channel#205d5d5c:CIAgent: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
at hudson.FilePath.act(FilePath.java:986)
at hudson.FilePath.act(FilePath.java:968)
at hudson.plugins.nunit.NUnitPublisher.getTestResult(NUnitPublisher.java:226)
[...]
Caused by: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
at hudson.tasks.junit.TestResult.parse(TestResult.java:306)
at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244)
at hudson.tasks.junit.TestResult.parse(TestResult.java:175)
[...]
... 13 more
Caused by: java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
at java.lang.Float.parseFloat(Unknown Source)
[...]
Archiving artifacts
Finished: FAILURE
The XML file is present in the working directory. I mentioned that the first line of this file looks like this:
<?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="xxx_Tests.TestsWithRealServers.TestWithTwoLocals" skipped="6" tests="6" time="">
So I guess it fails because the time attribe is empty.
Does anyone how I can fix this or why this error occurs?
Thanks!
Did you recently upgrade the jenkins JUnit plugin to 1.12? There is a reported issue in this update. You might try downgrading back to 1.11.
By the way, Jenkins plugins does not support Nunit 3 XML format. I also had a similar problem on Jenkins. I used to convert Nunit 3 result format to Nunit 2 format.
"C:\NUnit 3.5.0\nunit3-console.exe" /result:\MyApplication.xml;format=nunit2 "D:\Jenkins\workspace\MyApplication.Tests.dll"

MobileFirst Server - Application Center Configure Ant Task (configure-appcenter-liberty-mysql.xml) Error

I'm trying to install & configure the application center for MobileFirst Server using the ant task to install. Prior to the install task I was able to use the database task to create necessary tables in the app center database.
I get the error mentioned in the logs below when running
ant -f configure-appcenter-liberty-mysql.xml install
Ref
https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.installconfig.doc/appcenter/t_ac_deploy_cons_serv_ant_tasks.html?lang=en
Ant Script Output
root#ubuntu:/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples# sudo ant -v -f configure-appcenter-liberty-mysql-edited.xml install
Apache Ant(TM) version 1.9.3 compiled on April 8 2014
Buildfile: /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml
Detected Java version: 1.7 in: /usr/lib/jvm/java-7-openjdk-amd64/jre
Detected OS: Linux
parsing buildfile /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml with URI = file:/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml
Project base dir set to: /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Build sequence for target(s) `install' is [install]
Complete build sequence is [install, help, minimal-update, databases, uninstall, ]
install:
[installApplicationCenter] Logging output of task <installApplicationCenter> to file /root/.mobilefirst_platform_server/configuration-logs/installApplicationCenter_2016_04_20_22_42_09.log
[installApplicationCenter] Copying /opt/IBM/MobileFirst_Platform_Server/tools/mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar to /opt/IBM/WebSphere/Liberty/usr/shared/resources/mysql/mysql-connector-java-5.1.38-bin.jar
[installApplicationCenter] Copying /opt/IBM/MobileFirst_Platform_Server/tools/mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar to /opt/IBM/WebSphere/Liberty/usr/shared/resources/mysql/mysql-connector-java-5.1.38-bin.jar
[installApplicationCenter] Copying /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml to /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml.bak2
[installApplicationCenter] Modifying /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml
[installApplicationCenter] Deleting /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml.bak2
BUILD FAILED
/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml:74: An error occured while reading file /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml. Error: null.
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.wasLibertyAugmentConfigFiles(AppCenterAppServerTask.java:654)
at com.ibm.worklight.config.ant.appserver.AppServerTask.configureAppServer(AppServerTask.java:4423)
at com.ibm.worklight.config.ant.appserver.AppServerTask.installItems(AppServerTask.java:4165)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.installItems(AppCenterAppServerTask.java:1143)
at com.ibm.worklight.config.ant.appserver.AppServerTask.processItems(AppServerTask.java:4114)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.buildAndProcessItems(AppCenterAppServerTask.java:1088)
at com.ibm.worklight.config.ant.appserver.AppServerTask.setupBuildAndProcessItems(AppServerTask.java:3064)
at com.ibm.worklight.config.ant.appserver.AppServerTask.doExecute(AppServerTask.java:307)
at com.ibm.worklight.config.ant.appserver.InstallApplicationCenterTask.execute(InstallApplicationCenterTask.java:28)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
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 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.NullPointerException
at com.ibm.worklight.config.helper.appserver.WASLibertyAugmentServerXML.addAppCenterApplicationAndDataSourceElements(WASLibertyAugmentServerXML.java:1921)
at com.ibm.worklight.config.helper.appserver.WASLibertyAugmentServerXML.mainInstallApplicationCenter(WASLibertyAugmentServerXML.java:143)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.wasLibertyAugmentConfigFiles(AppCenterAppServerTask.java:642)
... 25 more
Total time: 7 seconds
Just based on the name of the Ant file you're using, and the pathnames displayed in in the message output you included, it looks like you started from the wrong sample Ant file - in other words, it appears that you are using Liberty Profile as your application server, but you started from the sample Ant file for use with WebSphere Application Server.
Assuming that is in fact the case, you should start with the sample configuration file "configure-appcenter-liberty-mysql.xml" instead.
Also, just as a hint - it appears that even with the file you are using, you modified the sample Ant file provided with MobileFirst Platform Foundation 7.1 "in place" and wrote it back to it's original filename and used it? As mentioned in the documentation link you have in your question, it's actually recommended to make a copy of this file and work with the copy, rather than modifying the one we provide - that way, you'll always have the unmodified samples we provide, in case you want to refer to them, or use them as templates for a different server and/or different configuration.
I think you use Liberty Profile 8.5.5.9. There were some changes concerning the password decoding mechanism in this version that is no more compatible with MobileFirst.
Either you ask the IBM support for the APAR http://www-01.ibm.com/support/docview.wss?crawler=1&uid=swg1PI61386, either you use Liberty 8.5.5.8.

Jenkins "Pipe is already closed" when copy artifacts to slave

I am trying co setup an Linux slave for Jenkins and it seems that copyartifacts plugin fails to copy artifacts from master (Linux) to slave. It copies some of the files but always fails at last one with exception:
ERROR: Failed to copy artifacts from metabuilds-build with filter: **
java.io.IOException: Pipe is already closed
at hudson.remoting.PipeWindow.checkDeath(PipeWindow.java:83)
at hudson.remoting.PipeWindow$Real.get(PipeWindow.java:165)
at hudson.remoting.ProxyOutputStream._write(ProxyOutputStream.java:118)
at hudson.remoting.ProxyOutputStream.write(ProxyOutputStream.java:103)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:161)
at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:118)
at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
at org.apache.tools.tar.TarBuffer.writeBlock(TarBuffer.java:410)
at org.apache.tools.tar.TarBuffer.writeRecord(TarBuffer.java:351)
at hudson.org.apache.tools.tar.TarOutputStream.writeEOFRecord(TarOutputStream.java:356)
at hudson.org.apache.tools.tar.TarOutputStream.finish(TarOutputStream.java:137)
at hudson.org.apache.tools.tar.TarOutputStream.close(TarOutputStream.java:149)
at hudson.util.io.TarArchiver.close(TarArchiver.java:119)
at hudson.FilePath.writeToTar(FilePath.java:1619)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1544)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1473)
at hudson.plugins.copyartifact.FilePathCopyMethod.copyAll(FilePathCopyMethod.java:51)
at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:225)
at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:199)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:662)
at hudson.model.Build$RunnerImpl.build(Build.java:177)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:429)
at hudson.model.Run.run(Run.java:1374)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: Pipe is already closed
at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:147)
at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:131)
at hudson.remoting.ProxyOutputStream$Chunk$1.run(ProxyOutputStream.java:185)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: hudson.remoting.FastPipedInputStream$ClosedBy: The pipe was closed at...
at hudson.remoting.FastPipedInputStream.close(FastPipedInputStream.java:112)
at hudson.FilePath$32.invoke(FilePath.java:1540)
at hudson.FilePath$32.invoke(FilePath.java:1534)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1979)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:270)
... 6 more
Any ideas? We have Jenkins 1.413 and copyartifacts plugin of version 1.17.
It turned out that I had inapriopriate permissions in the slave directory. In case of anyone needed I will write exactly what I have done:
At the first time of copy artifacts invocation the error inspired by JENKINS-9540 I updated the copyartifacts plugin to version 1.17 - did not helped.
After that I tried to pass the build further so I disabled the copyartifacts step and manually uploaded the content to the slave (as root! that introduced bad file permissions for jenkins user)
When the build succeeded I returned to the main error and updated the plugin to version 1.20. This did not helped, but decided th check if the permissions are OK and noticed that the files I was trying to replace was owned by root.
After a little chown and chgrp the problem was fixed.
SUMMARY: Check the actual file/directory permissions when such problem occurs first and after that try newer version of the plugin.
Seems like an issue with the plugin. You need to upgrade to a newer version or to the latest version depending on whether the latest plugin version is compatible with the Jenkins version you have. Please check the last two latest comment in the link: https://issues.jenkins-ci.org/browse/JENKINS-9540

Jenkins Ruby metrics plugin fail to copy .gitkeep

Jenkins Ruby metrics plugin cause error when copy .gitkeep file to log directory, because it fails to create log directory.
Error message is below.
Publishing rcov report...
ERROR: Publisher hudson.plugins.rubyMetrics.rcov.RcovPublisher aborted due to exception
Failed to copy /Users/Shared/Jenkins/Home/jobs/RailsApp/workspace/log/.gitkeep to /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep due to failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:914)
at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:567)
at hudson.Util.copyFile(Util.java:922)
at hudson.FilePath$38$1.visit(FilePath.java:1937)
at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
at hudson.util.DirScanner$Glob.scan(DirScanner.java:131)
at hudson.FilePath$38.invoke(FilePath.java:1932)
at hudson.FilePath$38.invoke(FilePath.java:1925)
at hudson.FilePath.act(FilePath.java:914)
at hudson.FilePath.act(FilePath.java:887)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1925)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:28)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:12)
at hudson.plugins.rubyMetrics.HtmlPublisher.prepareMetricsReportBeforeParse(HtmlPublisher.java:30)
at hudson.plugins.rubyMetrics.rcov.RcovPublisher.perform(RcovPublisher.java:50)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:784)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:756)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705)
at hudson.model.Run.execute(Run.java:1695)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: java.io.IOException: failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:512)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:899)
... 25 more
Jenkins didn't create log 'directory' but log 'file'. Jenkins have permission to read/write of the directory of course. Any ideas? Thanks in advance.
I spend a lot of time to fix this issue.
In fact, when you activate the Ruby metrics plugin, you have to provide a directory. If you don't, the default folder is log, and it is the cause of your error.
So, go to your project configuration and in the Publish Rcov Report section, you just fill the directory.
Enjoy :)

Saxon stops working after installing batik-rasterizer

Could someone please help me with the following problem?
Yesterday I was trying to add a process to my ANT script (Windows XP, ANT version 1.8.2, mostly XSLT 2.0, Saxon 9 simply added to my ant/lib) whereby it converts a directory of SVGs to PDFs using Batik's rasterizertask. Initially I had a lot of trouble getting ANT to recognize the rasterizertask but after reinstalling Batik from source and with the help of the following link I was able to get it to work.
https://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/200605.mbox/%3C445B43B9.4010403#harcotechnology.com%3E
Though these instructions did not state to do so, I found I needed to recompile/rebuild the rasterizertask.jar.
As a side note, I had also already added the path to the batik-rasterizer.jar and rasterizertask classes to my CLASSPATH as recommended on the official Batik site.
And voila, I had the rasterizer task working. Alas, all my XSLT 2.0 tasks that followed the rasterizertask in my ANT script stopped working. From what I could tell, something I had done caused the default XSLT processor to be changed to Xalan-j. And Xalan does not support much of my XSLT.
For example, this is the error I get from Xalan (I know why I am getting this error, which is why I use Saxon):
[xslt] Processing D:\workDirs\PLMXML2HeirarchalXML\source\plmxml.xml to D:\workDirs\PLMXML2HeirarchalXML\target\step1.xml
[xslt] Loading stylesheet D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step1.xsl
[xslt] D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step1.xsl:10:16: Warning! Created using: Apache Software Foundation, http://xml.apache.org/xalan-j
[xslt] D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step1.xsl:10:16: Warning! Created using: Apache Software Foundation, http://xml.apache.org/xalan-j
[xslt] Processing D:\workDirs\PLMXML2HeirarchalXML\target\step1.xml to D:\workDirs\PLMXML2HeirarchalXML\target\step2.xml
[xslt] Loading stylesheet D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step2.xsl
[xslt] D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step2.xsl:134:53: Fatal Error! java.lang.ClassCastException: org.apache.xpath.objects.XRTreeFrag cannot be cast to org.apache.xpath.objects.XNodeSet Cause: java.lang.ClassCastException: org.apache.xpath.objects.XRTreeFrag cannot be cast to org.apache.xpath.objects.XNodeSet
[xslt] Failed to process D:\workDirs\PLMXML2HeirarchalXML\target\step1.xml
BUILD FAILED
D:\workDirs\PLMXML2HeirarchalXML\build.xml:5: Fatal error during transformation
And all methods I have found and tried to force ANT to use Saxon (ie. adding Saxon to CLASSPATH, xslt/factory) seem to result in Saxon being called rather than Xalan but now I get the following error:
java.lang.NullPointerException
at org.apache.xerces.parsers.AbstractSAXParser.setContentHandler(Unknown Source)
at net.sf.saxon.Configuration.reuseStyleParser(Configuration.java:2346)
at net.sf.saxon.PreparedStylesheet.loadStylesheetModule(PreparedStylesheet.java:261)
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:185)
at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:132)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:300)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:317)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:178)
at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:853)
at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:389)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
So if I let Xalan do the processing, the rasterizer task still works, but my previously working XSLT does not, and if I use Saxon nothing works. I tried installing ANT 1.8.4, but I get the same results.
I have exhausted all of the resources I have found, including similar posts on this site, but all solutions seem to point to things I have already tried.
Hopefully this is enough information for someone to give me some advice or assistance.
Thanks,
Keith
There's a long history here of different problems in different Ant releases. (As a result, I for one have a lot of legacy Ant code using to call Saxon via the command line interface.) But I believe that with recent Ant releases, the trax factory mechanism works properly. Are you using
<xslt...>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
?
Trying to control which XSLT processor is used via the classpath is intrinsically failure-prone. That applies to any application, not just to Ant. And I think there are still bugs in the way Ant manipulates the classpath - or at any rate, to be more polite, behaviours that are not apparent from the documentation.

Resources