Selenium RC - Firefox browser does not launch - firefox

I had a problem in tools.jar so I downloaded jdk and changed the environmental variables.
Now I have the HUB and RC listening.
But when I run the test script , it is unable to launch Firefox
I tired to uninstall and install Firefox 3.6 again, then created new profile for Firefox
I went to selenium-server.jar Unzip it, find all (of 5) “install.rdf” files inside this JAR (they are under customProfileDirCUSTFF and customProfileDirCUSTFFCHROME subfolders).
Changed the line from this <em:maxVersion>3.5.*</em:maxVersion> to this <em:maxVersion>3.6.*</em:maxVersion>
But still Firefox browser is not launched.
Please help.
Following is the error message:
C:\selenium\launch>title RC5560
C:\selenium\launch>cd C:\selenium\Grid\selenium-grid-1.0.4
C:\selenium\Grid\selenium-grid-1.0.4>C:\ant\bin\ant -DseleniumArgs="-firefoxProf
ileTemplate C:\Firefoxprofile -userExtensions 'C:\selenium\abilityplayer\Seleniu
m Extension scripts\CORE Extension\user-extensions.js'" -Denvironment="*firefox"
-Dport=5560 launch-remote-control
Buildfile: build.xml
launch-remote-control:
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.RegistrationRequest execute
[java] INFO: Registering to http://localhost:4444/registration-manager/regi
ster
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: Starting selenium server with options:
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: -firefoxProfileTemplate
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: C:\Firefoxprofile
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: -userExtensions
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: C:\selenium\abilityplayer\Selenium Extension scripts\CORE Exte
nsion\user-extensions.js
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: -port
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: 5560
[java] 09:58:16.543 INFO - Java: Oracle Corporation 23.6-b04
[java] 09:58:16.543 INFO - OS: Windows XP 5.1 x86
[java] 09:58:16.543 INFO - v1.0.1 [2696], with Core v#VERSION# [#REVISION#]
[java] 09:58:16.652 INFO - Version Jetty/5.1.x
[java] 09:58:16.652 INFO - Started HttpContext[/selenium-server/driver,/sel
enium-server/driver]
[java] 09:58:16.652 INFO - Started HttpContext[/selenium-server,/selenium-s
erver]
[java] 09:58:16.652 INFO - Started HttpContext[/,/]
[java] 09:58:16.652 INFO - Started SocketListener on 0.0.0.0:5560
[java] 09:58:16.652 INFO - Started org.mortbay.jetty.Server#1eae15f
[java] 09:58:29.118 INFO - Checking Resource aliases
[java] 09:58:29.118 INFO - Checking Resource aliases
[java] 09:58:29.118 INFO - Command request: getNewBrowserSession[*firefox,
http://ondemand.shl.com/] on session null
[java] 09:58:29.134 INFO - creating new remote session
[java] 09:58:29.321 INFO - Allocated session 3c67617374474d1c98f449a724ecb9
68 for http://ondemand.shl.com/, launching...
[java] 09:58:31.024 INFO - Preparing Firefox profile...
[java] 09:58:54.035 ERROR - Failed to start new browser session, shutdown b
rowser and clear all session data
[java] java.lang.RuntimeException: Firefox refused shutdown while preparing
a profile
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:311)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:106)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.launch(FirefoxChromeLauncher.java:83)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.launchRemoteSession(FirefoxChromeLauncher.java:350)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.l
aunchRemoteSession(FirefoxLauncher.java:98)
[java] at org.openqa.selenium.server.BrowserSessionFactory.createNewRem
oteSession(BrowserSessionFactory.java:357)
[java] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowse
rSession(BrowserSessionFactory.java:122)
[java] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowse
rSession(BrowserSessionFactory.java:84)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.getN
ewBrowserSession(SeleniumDriverResourceHandler.java:699)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCo
mmand(SeleniumDriverResourceHandler.java:393)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.hand
leCommandRequest(SeleniumDriverResourceHandler.java:364)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.hand
le(SeleniumDriverResourceHandler.java:125)
[java] at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
[java] at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
[java] at org.mortbay.http.HttpServer.service(HttpServer.java:909)
[java] at org.mortbay.http.HttpConnection.service(HttpConnection.java:8
20)
[java] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.jav
a:986)
[java] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:83
7)
[java] at org.mortbay.http.SocketListener.handleConnection(SocketListen
er.java:245)
[java] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:35
7)
[java] at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:53
4)
[java] Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChrome
Launcher$FileLockRemainedException: Lock file still present! C:\DOCUME~1\ARTPUS~
1\LOCALS~1\Temp\customProfileDir3c67617374474d1c98f449a724ecb968\parent.lock
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:269)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:309)
[java] ... 20 more
When firefox prepares to launch a folder is created (say) C:\Documents and Settings\USER\Local Settings\Temp\customProfileDird47599b65f3246a9b14e72e6d7fdda84
A Parent.lock file is created . This may be preventing Firefox to launch.

By doing the change mentioned in the below link
http://girliemangalo.wordpress.com/2009/02/05/creating-firefox-profile-for-your-selenium-rc-tests/
solved my problem

Related

Jitsi include external jar for customization

Currently I am working on customization of Open Source Jitsi. And Somehow, I want to add 3rd party jar for customization.
I tried a lot to include 3rd party jar but I am facing this error.
So please help me to get rid of this error or provide some guidance to add 3rd party jar .
Auto-properties install: reference:file:sc-bundles/commons-vfs2-2.0.jar (org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/commons-vfs2-2.0.jar - java.io.IOException: Referenced file does not exist: sc-bundles\commons-vfs2-2.0.jar)
[java] org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/commons-vfs2-2.0.jar
[java] at org.apache.felix.framework.Felix.installBundle(Felix.java:2876)
[java] at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
[java] at org.apache.felix.main.AutoProcessor.processAutoProperties(AutoProcessor.java:296)
[java] at org.apache.felix.main.AutoProcessor.process(AutoProcessor.java:79)
[java] at org.apache.felix.main.Main.main(Main.java:292)
[java] at net.java.sip.communicator.launcher.SIPCommunicator.main(SIPCommunicator.java:219)
[java] Caused by: java.io.IOException: Referenced file does not exist: sc-bundles\commons-vfs2-2.0.jar
[java] at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:852)
[java] at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
[java] at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
[java] at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
[java] at org.apache.felix.framework.Felix.installBundle(Felix.java:2872)
[java] ... 5 more
Add your JAR file (custom.jar) to the lib/ directory. Then edit the two files as indicated below:
jitsi.eml - Add the following entry to the file :
<lib name="custom.jar" scope="COMPILE">
<relative-module-cls project-related="jar://$PROJECT_DIR$/lib/custom.jar!/"/>
</lib>
nbproject/project.xml - Search for <classpath mode="compile"> (there are two such occurences) and enlist your jar file as
<classpath mode="compile">lib/custom.jar:lib/felix.jar:[MORE JARS HERE]</classpath>
and
<classpath mode="compile">classes:lib/custom.jar:lib/felix.jar:[MORE JARS HERE]</classpath>
After editing the files, run ant clean; ant clean-bundles; ant make
And you are good to go.

Debugging Sonar Qube plugin

Following the guide at http://docs.sonarqube.org/display/DEV/Debugging, I have encounter an issue where the sonar-runner appears to be looking in the wrong place for the sonar-project.properties file.
This happens when I try to debug with Intellij.
Can anyone help?
Thanks
Matt
I get the following error:
SONAR_RUNNER_OPTS=-Xdebug -Xnoagent -Duser.dir=c:\dev\eci -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
INFO: Error stacktraces are turned on.
ERROR: homekey=runner.home
ERROR: homrelativePathFromHom=conf/sonar-runner.properties
ERROR: settingsKey=runner.settings
INFO: Runner configuration file: C:\Sonar\sonar-runner-2.4\conf\sonar- runner.properties
ERROR: homekey=project.home
ERROR: homrelativePathFromHom=sonar-project.properties
ERROR: settingsKey=project.settings
INFO: Project configuration file: NONE
INFO: Default locale: "en_AU", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: c:\dev\eci\.\.sonar
INFO: SonarQube Server 5.1.1
17:30:39.333 INFO - Load global repositories
17:30:39.340 DEBUG - Download: http://localhost:9000/batch/global (no proxy)
17:30:39.490 INFO - Load global repositories (done) | time=159ms
17:30:39.492 INFO - Server id: 20150731104939
17:30:39.493 INFO - User cache: C:\Users\matthewo\.sonar\cache
17:30:39.499 INFO - Install plugins
17:30:39.499 DEBUG - Download index of plugins
17:30:39.499 DEBUG - Download: http://localhost:9000/deploy/plugins/index.txt (no proxy)
17:30:39.585 DEBUG - Loaded 2138 properties from l10n bundles
17:30:39.585 INFO - Install JDBC driver
17:30:39.585 DEBUG - Download index of jdbc-driver
17:30:39.585 DEBUG - Download: http://localhost:9000/deploy/jdbc-driver.txt (no proxy)
17:30:39.592 INFO - Create JDBC datasource for jdbc:jtds:sqlserver://localhost:1433/Sonar;instance=MSSQL2012;SelectMethod=Curso r
17:31:03.765 DEBUG - Testing JDBC connection
17:31:04.351 DEBUG - Download: http://localhost:9000/api/server (no proxy)
17:31:04.368 INFO - Initializing Hibernate
17:31:04.370 DEBUG - hibernate.generate_statistics: false
17:31:04.370 DEBUG - hibernate.dialect: org.sonar.core.persistence.dialect.MsSql$MsSqlDialect
17:31:04.370 DEBUG - hibernate.connection.provider_class: org.sonar.jpa.session.CustomHibernateConnectionProvider
INFO: ---------------------------------------------------------------------- --
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 26.253s
Final Memory: 66M/340M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
at org.sonar.batch.scan.ProjectReactorBuilder.checkMandatoryProperties(ProjectReact orBuilder.java:315)
at org.sonar.batch.scan.ProjectReactorBuilder.defineRootProject(ProjectReactorBuild er.java:157)
at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:110)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:86)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Is there any way to set the working directory, so sonar-runner finds the project properties in the correct location - where I am executing the command from?
Thanks
Matt
Why are you trying to update the user directory? Try to remove -Duser.dir=c:\dev\eci from SONAR_RUNNER_OPTS

Why can't I shutdown tomcat 7 embedded from maven plugin?

I'm using tomcat7-maven-plugin 2.2 to run a webapp from command line (I'm on Windows 8.1, Java 1.7.0_51 and Maven 3.2.1).
This is the configuration (pretty straightforward, I guess):
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<address>localhost</address>
<port>8080</port>
<path>/</path>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
I run Maven with mvn tomcat7:run and it starts correctly, the server starts up, the webapp loads, and I can interact with it.
The command prompt in which I run Maven is busy showing Tomcat output (this looks fine to me):
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <project-name-here> 0.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) # <project-name-here> >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # <project-name-here> ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 25 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # <project-name-here> ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) # <project-name-here> <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) # <project-name-here> ---
[INFO] Running war on http://localhost:8080/
[INFO] Using existing Tomcat server configuration at c:\workspace\<project-name-here>\target\tomcat
[INFO] create webapp with contextPath:
apr 01, 2014 10:39:50 AM org.apache.coyote.AbstractProtocol init
Informazioni: Initializing ProtocolHandler ["http-bio-127.0.0.1-8080"]
apr 01, 2014 10:39:50 AM org.apache.catalina.core.StandardService startInternal
Informazioni: Starting service Tomcat
apr 01, 2014 10:39:50 AM org.apache.catalina.core.StandardEngine startInternal
Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.47
apr 01, 2014 10:39:52 AM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["http-bio-127.0.0.1-8080"]
Then, I want to shutdown the server: I run mvn tomcat7:shutdown from a separate command prompt, but all I get is this:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <project-name-here> 0.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:shutdown (default-cli) # <project-name-here> ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.083 s
[INFO] Finished at: 2014-04-01T10:39:59+01:00
[INFO] Final Memory: 9M/154M
[INFO] ------------------------------------------------------------------------
"cmd" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
That last line reads:
"cmd" is not a recognized internal or external command, an executable
or a batch file.
I can stop Tomcat from the first command prompt hitting Ctrl+C, but since I need to pass all this others, I'd like to offer them a script to start the webapp and a script to stop it.
What's wrong? Is it a plugin error? Is it a configuration error on my side?
EDIT
If I add <fork>true</fork> to the POM, the server crashes with this error:
[...]
Informazioni: Starting service Tomcat
apr 03, 2014 2:05:29 PM org.apache.catalina.core.StandardEngine startInternal
Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.47
apr 03, 2014 2:05:31 PM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["http-bio-127.0.0.1-8080"]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.711 s
[INFO] Finished at: 2014-04-03T14:05:31+01:00
[INFO] Final Memory: 26M/368M
[INFO] ------------------------------------------------------------------------
ERROR: IllegalAccessException for stop method in class org.apache.tomcat.maven.plugin.tomcat7.run.ExtendedTomcat
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.apache.tomcat.maven.common.run.EmbeddedRegistry.shutdownAll(EmbeddedRegistry.java:110)
at org.apache.tomcat.maven.common.run.EmbeddedRegistry$1.run(EmbeddedRegistry.java:69)
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:351)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:753)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:502)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 9 more
Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/core/ContainerBase$StopChild
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:1173)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.core.ContainerBase$StopChild
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)
... 13 more
As far as I know you need to use Ctrl + c after starting Tomcat server with mvn tomcat7:run to shut it down as it's attached to the current Maven run.
The shutdown goal is used to be called after e.g. performing some tests (integration tests) to finish all the job in a clean way.
have a look at the fork option http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/run-mojo.html#fork
So with this option you are able to start embeded tomcat run some tests then shutdown.
HTH
An alternative is if the Tomcat maven plugin had a way to enable the shutdown port (default 8005) then you can just send the default shutdown string (default "shutdown") to shut it down.
Using a JMX client, the shutdown port is set to -1 when I run the plugin run goal.

Experiencing trouble with NPM/Karma and Cloudbees

I have the following pre-build script:
# install nodejs, if using cloudbees
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.11.1 source ./use-node
# install phantomjs, karma
npm cache clean
[ -d node_modules/phantomjs ] || npm install -g phantomjs
[ -d node_modules/karma ] || npm install -g karma
[ -d node_modules/karma-junit-reporter ] || npm install -g karma-junit-reporter
[ -d node_modules/karma-phantomjs-launcher ] || npm install -g karma-phantomjs-launcher
test -d $HOME/bin || mkdir $HOME/bin
test -L $HOME/bin/karma || ln -s /scratch/jenkins/addons/node/$node_name/bin/karma $HOME/bin/karma
test -L $HOME/bin/node || ln -s /scratch/jenkins/addons/node/$node_name/bin/node $HOME/bin/node
The above script fails with the following error message:
Started by user Balteo Balteo
Building remotely on s-b13180e5 in workspace /scratch/jenkins/workspace/bignibou-unit
Checkout:bignibou-unit / /scratch/jenkins/workspace/bignibou-unit - hudson.remoting.Channel#e764b98:s-b13180e5
Using strategy: Default
Last Built Revision: Revision 66fc46cd3b57973b88969981cd25872b36fbd3db (origin/HEAD, origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Seen 2 remote branches
Commencing build of Revision 66fc46cd3b57973b88969981cd25872b36fbd3db (origin/HEAD, origin/master)
Checking out Revision 66fc46cd3b57973b88969981cd25872b36fbd3db (origin/HEAD, origin/master)
Warning : There are multiple branch changesets here
[bignibou-unit] $ /bin/sh -xe /tmp/hudson5627362406349041774.sh
+ curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
+ NODE_VERSION=0.11.1
+ source ./use-node
++ [[ -z 0.11.1 ]]
++ set -e
++ mkdir -p /scratch/jenkins/addons/node
+++ uname -m
++ ARCH=x86_64
++ node_name=node-0.11.1-x86_64
++ test -f /scratch/jenkins/addons/node/node-0.11.1-x86_64.tar.bz2
++ test -f /scratch/jenkins/addons/node/node-0.11.1-x86_64/bin/node
++ export PATH=/scratch/jenkins/addons/node/node-0.11.1-x86_64/bin:/opt/maven/latest/bin:/opt/jdk/jdk1.7.latest/bin:/opt/jdk/jdk1.7.latest/bin:/opt/jdk/latest/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/opt/maven/latest/bin:/opt/ant/latest/bin:/opt/android/android-sdk-linux/tools:/opt/gradle/latest/bin:/home/jenkins/bin:/opt/jdk/jdk.latest/bin
++ PATH=/scratch/jenkins/addons/node/node-0.11.1-x86_64/bin:/opt/maven/latest/bin:/opt/jdk/jdk1.7.latest/bin:/opt/jdk/jdk1.7.latest/bin:/opt/jdk/latest/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/opt/maven/latest/bin:/opt/ant/latest/bin:/opt/android/android-sdk-linux/tools:/opt/gradle/latest/bin:/home/jenkins/bin:/opt/jdk/jdk.latest/bin
+ npm cache clean
+ '[' -d node_modules/phantomjs ']'
+ '[' -d node_modules/karma ']'
+ '[' -d node_modules/karma-junit-reporter ']'
+ '[' -d node_modules/karma-phantomjs-launcher ']'
+ test -d /home/jenkins/bin
+ test -L /home/jenkins/bin/karma
+ test -L /home/jenkins/bin/node
Parsing POMs
[bignibou-unit] $ /opt/jdk/jdk1.7.latest/bin/java -cp /scratch/jenkins/maven3-agent.jar:/opt/maven/latest/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /opt/maven/latest /scratch/jenkins/slave.jar /scratch/jenkins/maven3-interceptor.jar /scratch/jenkins/maven3-interceptor-commons.jar 59804
<===[JENKINS REMOTING CAPACITY]===>channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven: -B -f /scratch/jenkins/workspace/bignibou-unit/pom.xml test
Nov 22, 2013 5:02:12 PM org.apache.maven.cli.event.ExecutionEventLogger projectDiscoveryStarted
INFO: Scanning for projects...
Nov 22, 2013 5:02:15 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO:
Nov 22, 2013 5:02:15 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO: ------------------------------------------------------------------------
Nov 22, 2013 5:02:15 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO: Building bignibou 0.1.0.BUILD-SNAPSHOT
Nov 22, 2013 5:02:15 PM org.apache.maven.cli.event.ExecutionEventLogger projectStarted
INFO: ------------------------------------------------------------------------
Downloading: https://repository-balteo.forge.cloudbees.com/snapshot/org/springframework/security/spring-security-core/3.2.0.CI-SNAPSHOT/maven-metadata.xml
Downloading: https://repository-balteo.forge.cloudbees.com/snapshot/org/springframework/security/spring-security-config/3.2.0.CI-SNAPSHOT/maven-metadata.xml
Downloading: https://repository-balteo.forge.cloudbees.com/snapshot/org/springframework/security/spring-security-web/3.2.0.CI-SNAPSHOT/maven-metadata.xml
Downloading: https://repository-balteo.forge.cloudbees.com/snapshot/org/springframework/security/spring-security-taglibs/3.2.0.CI-SNAPSHOT/maven-metadata.xml
Downloading: https://repository-balteo.forge.cloudbees.com/snapshot/org/springframework/security/spring-security-acl/3.2.0.CI-SNAPSHOT/maven-metadata.xml
Nov 22, 2013 5:02:28 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:02:28 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- apt-maven-plugin:1.0.6:process (default) # bignibou ---
Nov 22, 2013 5:02:55 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:02:55 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- aspectj-maven-plugin:1.2:compile (default) # bignibou ---
[WARNING] advice defined in com.bignibou.aop.AdvertisementExistsAndBelongsToMemberCheckAspect has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in com.bignibou.aop.AdvertisementExistsCheckAspect has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
[WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
Nov 22, 2013 5:04:08 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:04:08 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- maven-resources-plugin:2.6:resources (default-resources) # bignibou ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 44 resources
Nov 22, 2013 5:04:10 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:04:10 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- maven-compiler-plugin:2.5.1:compile (default-compile) # bignibou ---
[INFO] Nothing to compile - all classes are up to date
Nov 22, 2013 5:04:15 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:04:15 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- aspectj-maven-plugin:1.2:test-compile (default) # bignibou ---
Nov 22, 2013 5:04:16 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:04:16 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- maven-resources-plugin:2.6:testResources (default-testResources) # bignibou ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
Nov 22, 2013 5:04:17 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:04:17 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # bignibou ---
[INFO] Nothing to compile - all classes are up to date
Nov 22, 2013 5:04:18 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO:
Nov 22, 2013 5:04:18 PM org.apache.maven.cli.event.ExecutionEventLogger mojoStarted
INFO: --- maven-karma-plugin:1.5:start (karma) # bignibou ---
karma start /scratch/jenkins/workspace/bignibou-unit/karma/config/karma.conf.js --browsers PhantomJS --single-run
Nov 22, 2013 5:04:19 PM org.apache.maven.cli.event.ExecutionEventLogger logResult
INFO: ------------------------------------------------------------------------
Nov 22, 2013 5:04:19 PM org.apache.maven.cli.event.ExecutionEventLogger logResult
INFO: BUILD FAILURE
Nov 22, 2013 5:04:19 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: ------------------------------------------------------------------------
Nov 22, 2013 5:04:19 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: Total time: 2:06.425s
Nov 22, 2013 5:04:19 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: Finished at: Fri Nov 22 17:04:19 EST 2013
Nov 22, 2013 5:04:19 PM org.apache.maven.cli.event.ExecutionEventLogger logStats
INFO: Final Memory: 27M/117M
Nov 22, 2013 5:04:19 PM org.apache.maven.cli.event.ExecutionEventLogger sessionEnded
INFO: ------------------------------------------------------------------------
[JENKINS] Archiving /scratch/jenkins/workspace/bignibou-unit/pom.xml to /home/balteo/hudson_home/jobs/bignibou-unit/modules/com.bignibou$bignibou/builds/2013-11-22_22-01-58/archive/com.bignibou/bignibou/0.1.0.BUILD-SNAPSHOT/bignibou-0.1.0.BUILD-SNAPSHOT.pom
Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal com.kelveden:maven-karma-plugin:1.5:start (karma) on project bignibou: There was an error executing Karma.
cause : There was an error executing Karma.
Stack trace :
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.kelveden:maven-karma-plugin:1.5:start (karma) on project bignibou: There was an error executing Karma.
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.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
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:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
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 hudson.maven.Maven3Builder.call(Maven3Builder.java:129)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:67)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:744)
Caused by: org.apache.maven.plugin.MojoExecutionException: There was an error executing Karma.
at com.kelveden.karma.StartMojo.createKarmaProcess(StartMojo.java:209)
at com.kelveden.karma.StartMojo.execute(StartMojo.java:133)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 30 more
Caused by: java.io.IOException: Cannot run program "karma" (in directory "/scratch/jenkins/workspace/bignibou-unit"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at com.kelveden.karma.StartMojo.createKarmaProcess(StartMojo.java:205)
... 33 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
... 34 more
channel stopped
[bignibou-unit] $ /bin/sh -xe /tmp/hudson6880094858310082268.sh
Finished: FAILURE
I tried the same thing based on the following blog post and was having the same issue.
http://jespertejlgaard.blogspot.com/2013/09/how-to-execute-your-maven-karma-plugin.html
I ended up discovering that the karma path for the symlink was incorrect.
It should be
test -L $HOME/bin/karma || ln -s /scratch/jenkins/addons/node/$node_name/lib/node_modules/karma/bin/karma $HOME/bin/karma
Also, since that symlink probably already exists, you'll probably want to remove the "test" part on the first execution so that the symlink gets created correctly (might need -sF), then put it back. I did this just in case.
Reading the log I suspect you are running two separate build steps?
If so, then you need to remember that environment variables are not retained between steps.
So your second maven step can't see karma / node etc.
Try combining the two steps.
If you are using the Jenkins Maven plugin, then don't, it causes more problems than it solves.

ClassNotFoundException with SIGAR API

I'm trying to work with the SIGAR API, and I added the external jar "sigar.jar" to my Build Path eclipse project.
It compiles with no problem, but when I try to run the main class, that only does :
Cpu cpu = new Cpu();
it gives me this error:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/sigar/Cpu
[java] at pt.client.User.main(User.java:90)
[java] Caused by: java.lang.ClassNotFoundException: org.hyperic.sigar.Cpu
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[java] ... 1 more
[java] Java Result: 1
What may be missing?
I think you missed to include .so file specific for your platform.
These files are located ../hyperic-sigar-folder/sigar-bin/lib.
For example, if you are running under Linux 32 Bit, you have to include the file libsigar-x86-linux.so into your class-path as well.

Resources