NullPointerException in Jenkins - jenkins

I'm currently reading the book 'Jenkins Continuous Integration Cookbook', and I came across this error after building a project on Jenkins:
ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users#googlegroups.com
java.lang.NullPointerException
at java.io.File.<init>(File.java:239)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:58)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:41)
at hudson.FilePath.act(FilePath.java:1001)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:604)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1604)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
project=hudson.maven.MavenModuleSet#68f55ff2[A]
project.getModules()=[]
project.getRootModule()=null
I'm confused why I'm getting this, since my Java code is all autogenerated via Maven, and my tests in HTML format. I was able to successfully build the code using maven, before placing a directory with /src and pom.xml as it's children onto bitbucket.
Any ideas why this error is showing? Any advice will be appreciated.
Adding the rest of the error logs below (couldn't before because I was getting formatting errors).
FATAL: null
java.lang.NullPointerException
at java.io.File.<init>(File.java:239)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:58)
at hudson.maven.MavenVersionCallable.call(MavenVersionCallable.java:41)
at hudson.FilePath.act(FilePath.java:1001)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:604)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1604)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)

According a similar bug report (but not exactly the same) I guess that your problem may be caused by a wrong configuration in Jenkins.
I suggest you to check the MAVEN_HOME used by Jenkins (i.e. check that it is really a MAVEN_HOME directory and is the correct maven version)

Related

Jenkins build fails because it is looking for log path defined in logback.xml when executing junit test

I am getting the following error on Jenkins when I try to do a gradle build of my code along with Junit tests:
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Failed to create parent directories for xxxxxx
Basically Jenkins is trying to look for the directory specified in the logback.xml, but it doesn't have permission to build the directory structure.
I am using the Jacoco plugin with Jenkins for generating test reports.
Any help to resolve this issue is very much appreciated.
Thanks
I resolved the issue by using
#TestPropertySource(properties = "logging.config=classpath:logback.xml")
where in the logback-spring.xml was ignored during Jenkins build.

Getting an "Error while reading the sourcefile!" error from Jenkins jacoco plugin

My source code is written in scala. I have used sbt-jacoco sbt plugin of version 3.0.3 for code coverage. Jenkins plugin used is JaCoCo Plugin of version 3.0.1
I have implemented jacoco within my Jenkinsfile as :
step([$class: 'JacocoPublisher', sourcePattern: '**/src'])
The plugin works perfectly fine , shows the code percentages covered and missed. But when I go to check the actual lines of code covered through the Jenkins UI, I get the above error "Error while reading the sourcefile!"
Would you help me figure out what I am doing wrong?
Attached screenshots
look at jenkins log (usually at /var/log/jenkins/jenkins.log) for exceptions like java.io.FileNotFoundException to figure out where the plugin think the file located at, or any other errors while trying to read the file.
what solve it for me was setting the sourcePattern to '**/src/*/java'
which by default it is set to '**/src/main/java'
based on git

Travis CI - android gradle project

I'm attempting to create a travis build to run this android gradle project.
Travis is erroring on this java related SSL exception. I can't figure out what I'm missing. Any help would be greatly appreciated. I've attached the link to the build, with the full error and build info.
$ ./gradlew clean build
Downloading https://services.gradle.org/distributions/gradle-2.2.1- all.zip
Exception in thread "main" java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching services.gradle.org found.
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Here is the full build.
Travis Build
Here's the cause:
http://discuss.gradle.org/t/urgent-ssl-apache-configuration-for-services-gradle-org-is-bad/8808
Workaround would be to modify gradle/wrapper/gradle-wrapper.properties with distributionUrl using http instead of https. Until they fix the problem.

Insufficient privileges error with sonarRunner

I am getting Insufficient privileges error running sonar. This started happening after I upgraded sonarQube to 5.0.
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Fail to decorate 'org.sonar.api.resources.File#152f931e[key=........]'
ERROR: Caused by: {"errors":[{"msg":"Insufficient privileges"}]}
For the existing projects, I renamed the key and now I have new sonar projects. Those seems to be working fine for now. The new projects that are created are throwing this error. Any suggestions?
The issue appears to be a bug in the Sonar Server 5.0 release.
https://jira.codehaus.org/browse/SONAR-6091
In order to work around it the 'SEE SOURCE CODE' project permissions can be set to include 'Anyone' from the admin page as in the below screen shot:
Obviously, this is not ideal in an unprotected environment because the source code can be viewed by anyone with access to the Sonar server API, but hopefully its addressed in the 5.1 release of Sonar Server.
The problem for me (Sonar 6.1) was caused by the creation of the project in SonarQube: at the first execussion of the scanner, it creates the corresponding project in SonarQube, what I didn't allow for all users...
Restore the right for creating projects allow the scanner to successfully work.

Jenkins build breaks on SaxParsing xsd scheme

i have a maven2 project which is built periodically by jenkins. The bad thing about it ... it won´t build anymore.
I´m not sure what has changed, because i don´t have any tickets in the code itself or jenkins configuration, but strange as it is..... the local build works.
Normally that would hint on a configuration problem in jenkins, but the error in jenkins is:
[ERROR] XJC while parsing schema(s) file:/global/contint/build_server/jenkins/jobs/ERIC_E4N%20Continuous-Trunk-Check/workspace/Eric4N-publishing-xsd/src/main/resources/E4N_E4D_InterfaceSalesAllowanceDoType.xsd[76,14]: org.xml.sax.SAXParseException: 'SalesAllowanceDoType' is already defined
Locally I don´t get this error....
Any clues where I could continue my search ?
Thanks alot and Greetings !

Resources