I try to execute behat in my jenkins server (similar to this).
My build xml:
<target name="behat" description="Execute the behat tests">
<exec command="${basedir}/bin/behat --profile jenkins -c ${basedir}/config/behat.yml" />
</target>
(Yes, my bin is at ./bin and not ./vendor/bin)
However I get this error:
var/lib/jenkins/jobs/defTest/workspace/build.xml:116: Execute failed: java.io.IOException: Cannot run program "/var/lib/jenkins/jobs/defTest/workspace/bin/behat": error=13, Keine Berechtigung
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at java.lang.Runtime.exec(Runtime.java:617)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
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:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
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:809)
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)
Caused by: java.io.IOException: error=13, Keine Berechtigung
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
... 23 more
("Keine Berechtigung" is German for "Permission denied") I tried to chmod the behat file to 777 but as I pull from a mercurial repository my changes seem always to be undone.
Do you have any ideas how to fix my problem?
Add a prebuild shell task:
chmod 777 /PATH_TO_BEHAT/bin/behat
Related
I have Jenkins v2.219 installed (running in docker if it matters) and iv'e installed:
Database plugin v1.5
MySQL Database Plugin v1.3
I've created the simplest pipeline to check the db connection and it doesn't work.
My pipeline is:
import groovy.sql.Sql
node {
Class.forName("com.mysql.jdbc.Driver")
def sql = Sql.newInstance("jdbc:mysql://<mysql_db_host>:3306/<db_name>", "myuser","mypass", "com.mysql.jdbc.Driver")
sql.execute "SELECT * FROM table"
}
And when I run it I get:
Rebuilds build #47
Running in Durability level: MAX_SURVIVABILITY
Running on Jenkins in /var/jenkins_home/workspace/pipeline_playground
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:543)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at org.codehaus.groovy.runtime.callsite.CallSiteClassLoader.loadClass(CallSiteClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.loadClass(ClassLoaderForClassArtifacts.java:60)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java_lang_Class$forName$1.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:191)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onStaticCall(GroovyInterceptor.java:35)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:186)
at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:189)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:193)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:98)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript:3)
at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
at com.cloudbees.groovy.cps.Next.step(Next.java:83)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:405)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:317)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:281)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
I've also tried running it without: "Class.forName("com.mysql.jdbc.Driver")" that gave me "java.sql.SQLException: No suitable driver found for ..."
UPDATE:
btw, i do see:
database-mysql.jar, mysql-connector-java-8.0.13.jar, protobuf-java-3.6.1.jar
at: /plugins/database-mysql/WEB-INF/lib
I had the same problem and this was how I fixed it.
First link the database jar files to your jenkins system.
To find out where jenkins is looking for jar files go to the script console of your jenkins server and run this code
println System.getProperty("java.ext.dirs")
Result
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.fc29.x86_64/jre/lib/ext:/usr/java/packages/lib/ext
Next go to one of those directories and create symlinks to the jar files of the plugins. On a linux system...
cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.fc29.x86_64/jre/lib/ext
ln -s /var/lib/jenkins/plugins/database-mysql/WEB-INF/lib/database-mysql.jar
ln -s /var/lib/jenkins/plugins/database-mysql/WEB-INF/lib/mysql-connector-java-8.0.13.jar
Restart jenkins so that the jar files are loaded.
Now you can query your MySQL database from your jenkins pipeline
import groovy.sql.Sql
node{
def conn = Sql.newInstance("jdbc:mysql://localhost:3306/cms", "fred", "fredpassword", "com.mysql.jdbc.Driver")
def rows = conn.rows("select username from users LIMIT 10")
assert rows.size() == 10
println rows.join('\n')
}
I try to use Hudson (3.3.3) and Legacy Maven 2 job type Plugin (3.0.2) with Maven (3.2.1), but I get an error. Is there a way to use Maven 3.2.1?
Job log:
Found mavenVersion 3.2.1 from file jar:file:/C:/Users/dur/.hudson/tools/Maven_3.2.1/lib/maven-core-3.2.1.jar!/META-INF/maven/org.apache.maven/maven-core/pom.properties
Parsing POMs
[workspace] $ "C:\Program Files\Java\jdk1.7.0_25/bin/java" -cp C:\Users\dur\.hudson\plugins\maven-plugin\WEB-INF\lib\maven3-agent-3.0.2.jar;C:\Users\dur\.hudson\tools\Maven_3.2.1\boot\plexus-classworlds-2.5.1.jar org.jvnet.hudson.maven3.agent.Maven3Main C:\Users\dur\.hudson\tools\Maven_3.2.1 C:\Users\dur\.hudson\war\webapp\WEB-INF\lib\hudson-remoting-3.0.3.jar C:\Users\dur\.hudson\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-3.0.2.jar 61659
<===[HUDSON REMOTING CAPACITY]===>channel started
Executing Maven: -B -f C:\Users\dur\.hudson\jobs\Test\workspace\pom.xml clean install -P Hudson
java.lang.reflect.InvocationTargetException
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.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:146)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:124)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:107)
at hudson.remoting.UserRequest.perform(UserRequest.java:41)
at hudson.remoting.Request$2.run(Request.java:276)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/cli/MavenLoggerManager
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:73)
... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.cli.MavenLoggerManager
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 19 more
channel stopped
I found following questions:
Eclipse Community Forums
GitHub
User list for the Hudson continuous build server
but with no working answer.
I found a work-around with Hudson (3.3.3) free-style project and Maven 3 Build Plugin (3.0.5):
Maven 3 Build Plugin configuration (see Hudson Book):
Build Step configuration (see Hudson Book):
I am trying to install new-relic jar to my Openshift application (wildfly cartridge), but it fails with permission denied. Here is the log
\> java -jar newrelic.jar install
Jan 29, 2015 15:01:14 -0500 [64858 1] com.newrelic INFO: Agent is using Logback
***** ( ( o)) New Relic Java Agent Installer
***** Installing version 3.13.0 ...
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf.20150129_150114 (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.backup(EditableFile.java:251)
at com.newrelic.agent.install.SelfInstaller.backup(SelfInstaller.java:125)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:51)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:35)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:263)
at com.newrelic.agent.util.EditableFile.append(EditableFile.java:240)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:55)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:35)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Added agent switch to start script /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf.20150129_150114 (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.backup(EditableFile.java:251)
at com.newrelic.agent.install.SelfInstaller.backup(SelfInstaller.java:125)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:51)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:37)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Problem writing file to disk
java.io.FileNotFoundException: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
at java.io.FileWriter.<init>(FileWriter.java:63)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:273)
at com.newrelic.agent.util.EditableFile.write(EditableFile.java:263)
at com.newrelic.agent.util.EditableFile.append(EditableFile.java:240)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEdit(JBoss7SelfInstaller.java:55)
at com.newrelic.agent.install.JBoss7SelfInstaller.backupAndEditStartScript(JBoss7SelfInstaller.java:37)
at com.newrelic.agent.AgentCommandLineParser.installCommand(AgentCommandLineParser.java:138)
at com.newrelic.agent.AgentCommandLineParser.parseCommand(AgentCommandLineParser.java:81)
at com.newrelic.agent.Agent.main(Agent.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.newrelic.bootstrap.BootstrapAgent.main(BootstrapAgent.java:84)
Added agent switch to start script /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/bin/standalone.conf
No need to create New Relic configuration file because:
.:. A config file already exists: /var/lib/openshift/544c2c3be0b8cdf8da000253/wildfly/newrelic/newrelic.yml
***** Install successful
***** Next steps:
You're almost done! To see performance data for your app:
.:. Restart your app server
.:. Exercise your app
.:. Log into http://rpm.newrelic.com
Within two minutes, your app should show up, ready to monitor and troubleshoot.
If app data doesn't appear, check newrelic/logs/newrelic_agent.log for errors.
How can I install it? Where can I get permission?
Looks like NewRelic is attempting to create a backup of the WildFly configuration file which it finds at ~/wildfly/bin/standalone.conf. Unfortunately it fails due because the ~/wildfly/bin is locked by the WildFly cartridge as you can see by its permissions and entry in the cartridge's managed_files.yml:
\> ls -ld wildfly/bin/
drwxr-xr-x. 6 root 544c2c3be0b8cdf8da000253 4096 Dec 23 20:01 wildfly/bin/
\> cat wildfly/metadata/managed_files.yml
---
[...]
locked_files:
- bin/
- bin/*
[...]
I see three options, in order of complexity.
See if newrelic.jar accepts an flag to not perform a backup of the config file.
Since it looks like newrelic.jar is trying to automatically modify standalone.conf for you, try running this step on a local environment with WildFly where you do have permissions. Then check in the new standalone.conf to OpenShift git.
Fork the WildFly cart repo and remove the bin/ and bin/* entries from the locked_files key in managed_files.yml. But make sure to create these manually within the cart's bin/setup script, as locking would normally do that for you. See Locking cartridges for more info.
Situation
We're running sonar with a MySQL database, jenkins and a build environment with maven.
Problem
When executing a jenkins job it is aborted with the message:
[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on
project playground_eb: Can not execute Sonar: Fail to connect to
database: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver'
for connect URL 'http://192.168.1.220:3306': No suitable driver
Configuration
Servers
192.168.1.220 (Debian 6.0.6):
- runs Jenkins (# port 8080)
- Sonar (# port 9000)
- MySQL Database (# port 3306)
192.168.1.221 (Windows 7):
- runs Maven and the whole build environment
Configurations
The database was configured in the sonar.properties file - with localhost.
Sonar and its database were configured via the jenkins web interface - with the IP.
I guess this could cause errors but configuring the IP in the sonar.properties file causes sonar to not even start up anymore.
Full exception stack
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project playground_eb: Can not execute Sonar
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IllegalStateException: Fail to connect to database
at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:74)
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:601)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:760)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:72)
at org.sonar.batch.bootstrap.Module.start(Module.java:67)
at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:83)
at org.sonar.batch.bootstrap.Module.start(Module.java:68)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:75)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:60)
at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:142)
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
... 23 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'http://192.168.1.220:3306'
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
at org.apache.commons.dbcp.BasicDataSource.getLogWriter(BasicDataSource.java:1098)
at org.apache.commons.dbcp.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:350)
at org.sonar.core.persistence.DefaultDatabase.initDatasource(DefaultDatabase.java:131)
at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:68)
... 44 more
Caused by: java.sql.SQLException: No suitable driver
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1443)
... 49 more
Just found the problem.
In Jenkins the Sonar database URL was set to
http://192.168.1.221:3306/sonar
Now I set it to the WHOLE JDBC-URL (including jdbc: ...) just like in the sonar.properties file
... and now it works.
I'm testing JsTestDriver with Jenkins locally on Windows XP with Cygwin (at the front of my system Path).
Jenkins calls a .sh script which contains the following:
java -jar "D:\Tools\jstestdriverexample\JsTestDriver-1.3.4.b.jar" --port 9876 --server http://localhost:9876 --tests all --reset --config jsTestDriver-Jasmine.conf --testOutput results-jasmine --browser "C:/Program Files/Internet Explorer/iexplore.exe","C:/Program Files/Mozilla Firefox/firefox.exe","C:\Documents and Settings\alynch\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"
When Google Chrome is included, the Jenkins job stalls and I eventually get this error in the console output:
Failures during test run.
Caused by:
Tried 1times:
com.google.jstestdriver.util.RetryException:
Failure 1: java.lang.NullPointerException
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:62)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
at java.util.concurrent.FutureTask.run(Unknown
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.google.jstestdriver.browser.CommandLineBrowserRunner.stopBrowser(CommandLineBrowserRunner.java:94)
at com.google.jstestdriver.browser.BrowserControl.stopBrowser(BrowserControl.java:148)
at com.google.jstestdriver.browser.BrowserCallable.call(BrowserCallable.java:30)
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:49)
... 10 more
at com.google.jstestdriver.browser.BrowserActionExecutorAction.run(BrowserActionExecutorAction.java:154)
at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:81)
at com.google.jstestdriver.embedded.JsTestDriverImpl.runConfigurationWithFlags(JsTestDriverImpl.java:342)
at com.google.jstestdriver.embedded.JsTestDriverImpl.runConfiguration(JsTestDriverImpl.java:233)
at com.google.jstestdriver.Main.main(Main.java:70)
Caused by:
Tried 1times:
com.google.jstestdriver.util.RetryException:
Failure 1: java.lang.NullPointerException
If I try to run Google Chrome in Cygwin it works but I get the following message:
[5424:5192:3977000:ERROR:gpu_info_collector_win.cc(90)] Can't retrieve a valid WinSAT assessment.
Is the problem that I'm running Jenkins as a Windows service and it can't run Chrome because it needs to run as me (my user profile)?
The symptoms indeed point to running Jenkins as a service as the problem. To find out if that's indeed the case run Jenkins in the foreground:
java -jar jenkins.war <other options>
You can find the list of common options here.