How to analyze low-level OSGi problems during tycho test execution? - tycho

When executing JUnit test with tycho-surefire-plugin, tycho forks an equinox runtime.
In rare cases it may happen that some bundles in the OSGi test runtime cannot be resolved/started (e.g. package uses conflicts).
If you read the debug log (maven CLI option -X), you will find something like
!ENTRY org.eclipse.osgi 2 0 2012-10-08 16:41:31.635
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-10-08 16:41:31.635
An error has occurred. See the log file
C:\mytestproject.tests\target\work\configuration\1349705136008.log.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:03.181s
[INFO] Finished at: Mon Oct 08 16:17:16 CEST 2012
[INFO] Final Memory: 20M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.15.0:test (default-test) on project mytestproject.tests: An unexpected error occured (return c
ode 13). See log for details. -> [Help 1]
The eclipse console log does not provide enough information in case of package uses conflicts.
How can I analyze the bundles in the OSGi test runtime forked by tycho?

start tests in remote debug mode (simply specify -DdebugPort=8000 on the CLI) and start the OSGi console on a local port, e.g. 1234:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<systemProperties>
<osgi.console>1234</osgi.console>
</systemProperties>
</configuration>
</plugin>
Set a breakpoint in one of your test classes or in org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter if tests are not even started. Then,
telnet localhost 1234
and you can use the usual OSGi console commands like ss, diag, bundle etc. to analyze the problem "in vivo".

Alternatively you can run with -consolelog or set the eclipse.consoleLog property to true property. If you're running with Tycho, you can use <argLine>-Declipse.consoleLog=true</argLine>.

Related

Not able to execute scripts from Jenkins although working fine locally & via command line

I am Not able to run scripts from Jenkins. How ever working fine from Command line & Local. I am within office network. Getting Below Error. I don't understand why Jenkins is trying to download Maven plugin? I am new to Jenkins. Any suggestion will be appretiated.
[INFO] ------------------------< Test:Junit-Demo >-------------------------
[INFO] Building Junit-Demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.695 s
[INFO] Finished at: 2018-04-11T14:29:52-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.68.215] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding="UTF-8"
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Maven, triggered by Jenkins, downloads the maven-clean-plugin as part of its normal execution. This happened on your location machine in the first run and was then cached in ~/.m2/.
Your Jenkins build agent, however, cannot connect to the server from which maven downloads artifacts:
Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.68.215] failed: Connection timed out: connect
Make sure that there is no firewall involved blocking these connections or configure Jenkins to use a local artifact repository (like Nexus or Artifactory).
Missing some info to fully know what's wrong.
To use maven in Jenkins you have to install the jenkins maven plugin and call the binary in your Jenkins file.
Did you have to do any maven configuration for your local set up?
ie inside ~/.m2 is usually where you would set up your account for nexus credentials inside settings.xml.
You would have to do this same config on your jenkins machine, either in the Jenkins user account's ~/.m2 or inside the maven plugin folder.

Cloudbees Deploy failure due to NullPointerException in RunTargetImpl.getClickStackConfigMap

I've juste created an new app in cloudbees with clickStart "Jetty 9 Embedded App" and when Jenkins build the generated project(without any change) I get this error.
Can you help me to find the problem origin ?
thanks.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.919s
[INFO] Finished at: Fri Sep 27 06:49:44 EDT 2013
[INFO] Final Memory: 16M/40M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /scratch/jenkins/workspace/code-elevator-2/pom.xml to /home/flagadajones/hudson_home/jobs/code-elevator-2/modules/localdomain.localhost$jetty9-embedded-clickstart/builds/2013-09-27_10-48-58/archive/localdomain.localhost/jetty9-embedded-clickstart/0.1-SNAPSHOT/jetty9-embedded-clickstart-0.1-SNAPSHOT.pom
[JENKINS] Archiving /scratch/jenkins/workspace/code-elevator-2/target/jetty9-embedded-clickstart-0.1-SNAPSHOT.jar to /home/flagadajones/hudson_home/jobs/code-elevator-2/modules/localdomain.localhost$jetty9-embedded-clickstart/builds/2013-09-27_10-48-58/archive/localdomain.localhost/jetty9-embedded-clickstart/0.1-SNAPSHOT/jetty9-embedded-clickstart-0.1-SNAPSHOT.jar
[JENKINS] Archiving /scratch/jenkins/workspace/code-elevator-2/target/jetty9-embedded-clickstart-0.1-SNAPSHOT-jar-with-dependencies.jar to /home/flagadajones/hudson_home/jobs/code-elevator-2/modules/localdomain.localhost$jetty9-embedded-clickstart/builds/2013-09-27_10-48-58/archive/localdomain.localhost/jetty9-embedded-clickstart/0.1-SNAPSHOT/jetty9-embedded-clickstart-0.1-SNAPSHOT-jar-with-dependencies.jar
Waiting for Jenkins to finish collecting data
channel stopped
[cloudbees-deployer] Deploying as (jenkins) to the flagadajones account
[cloudbees-deployer] Deploying code-elevator-2
[cloudbees-deployer] Resolved from archived artifacts as /home/flagadajones/hudson_home/jobs/code-elevator-2/modules/localdomain.localhost$jetty9-embedded-clickstart/builds/2013-09-27_10-48-58/archive/localdomain.localhost/jetty9-embedded-clickstart/0.1-SNAPSHOT/jetty9-embedded-clickstart-0.1-SNAPSHOT-jar-with-dependencies.jar
com.cloudbees.plugins.deployer.exceptions.DeployException
at com.cloudbees.plugins.deployer.impl.run.RunEngineImpl.newDeployActor(RunEngineImpl.java:150)
at com.cloudbees.plugins.deployer.impl.run.RunEngineImpl.newDeployActor(RunEngineImpl.java:52)
at com.cloudbees.plugins.deployer.engines.Engine.process(Engine.java:173)
at com.cloudbees.plugins.deployer.engines.Engine.perform(Engine.java:112)
at com.cloudbees.plugins.deployer.DeployPublisher.perform(DeployPublisher.java:103)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:812)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:784)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:957)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:734)
at hudson.model.Run.execute(Run.java:1600)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:485)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:237)
Caused by: java.lang.NullPointerException
at com.cloudbees.plugins.deployer.impl.run.RunTargetImpl.getClickStackConfigMap(RunTargetImpl.java:256)
at com.cloudbees.plugins.deployer.impl.run.RunEngineImpl$DeployFileCallable.<init>(RunEngineImpl.java:297)
at com.cloudbees.plugins.deployer.impl.run.RunEngineImpl.newDeployActor(RunEngineImpl.java:141)
... 13 more
Build step 'Deploy applications' marked build as failure
Finished: FAILURE
The clickstart generates an invalid configuration for the deployer plugin. Remove the target from the deploy publisher and add it back again. The issue is that the Maven artifact selector is not selected and the clickstart has fed incorrect configuration for the target, which means that you can't just select the maven artifact selector, instead you need to remove the target and add it back again...
Nuts I know, I shall be chastising the clickstart maintainers on Monday rest assured ;-)

Multi-tenant in Broadleaf

I am new to Broadleaf. And i am trying to do multitenant in it.
I can't find any documentation in Broadleaf official site. I found one project in github about multitenancy in broadleaf.That's the link
https://github.com/BroadleafCommerce/DemoSite-MultiTenant-SingleSchema
As i build that project in maven through "mvn install", its getting build failure, below error comes as i build that project.
[INFO] Reactor Summary:
[INFO]
[INFO] ecommerce ......................................... SUCCESS [0.619s]
[INFO] core .............................................. SUCCESS [1:35.628s]
[INFO] admin ............................................. FAILURE [27.273s]
[INFO] site .............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:03.894s
[INFO] Finished at: Mon Jun 03 10:08:01 IST 2013
[INFO] Final Memory: 12M/60M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project admin: Could not resolve dependencies for project com.mycompany:admin:war:1.0: Could not find artifact com.broadleafcommerce:broadleaf-multitenant-singleschema:jar:1.0.0-SNAPSHOT in snapshots (http://192.168.1.10:8080/artifactory/libs-snapshot) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :admin
Maybe it states that it can't find the broadleaf-multitenant-singleschema jar that define in pom.xml.
<dependency>
<groupId>com.broadleafcommerce</groupId>
<artifactId>broadleaf-multitenant-singleschema</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
I tried to find that jar manually , but I can't found that jar.
I can't figure out what's the problem is.
Is it possible to do multitenant in broadleaf ?
Is that demo is about multitenant in broadleaf ?
Thanks in advance.
Ankit
glad to hear that you are trying out Broadleaf!
As you mentioned in your comment, the Broadleaf Multitenant Singleschema module is a commercial module, not a community module. Another point: Broadleaf itself (as in the core Broadleaf framework) is all open source. There is no separate commercial version of the core Broadleaf code base. However, some of the modules that we offer are commercial. Multitenant is one of them, along with things like change sets and other 3rd-party integrations (like Braintree or Sagepay).
If you would like some additional information about the multitenant module, feel free to shoot us an email at info AT broadleafcommerce.com.
Source: being a Broadleaf employee :)

Error While Test The Project On Maven

i am using maven i don't have more knowledge about maven when i am install my project then it will successfully build but when i am test my project with maven it will give me an error like
Unable to copy an artifact to the working directory
i gave all permission to my project directory detail error as below so how can i resolve my
problem and how to run my project
so please help me
E
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 24 seconds
[INFO] Finished at: Thu Jan 27 17:44:59 IST 2011
[INFO] Final Memory: 35M/84M
[INFO] ------------------------------------------------------------------------
[INFO] Unable to copy an artifact to
the working directory Embedded error:
/home/nayan/workspace/ONiT/mediaPlayer/target/classes
(Is a directory) [INFO]
This looks like some of the previous tests are still running at this point and blocking maven from writing in the target directory.
As this seems to be an reactor build, do the modules themself build correctly ? I.e. can you run mvn test in each module directory seperately ?

Sonar default, meet "container state was: CONSTRUCTED"

Environment: hudson/sonar/maven2 in ubuntu locally with default parameters
And I got the log from hudson below, I can't figure out where is the problem.
[INFO] Sonar host: http://localhost:9000
[INFO] Sonar version: 2.0.1
[INFO] [sonar-core:internal {execution: default-internal}]
[INFO] Database dialect class org.sonar.api.database.dialect.Derby
[INFO] ------------- Analyzing Game of Life business logic module
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: Can not analyze the project
Cannot stop. Current container state was: CONSTRUCTED
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
And I notice it also has problem when run it command line without hudson
mvn sonar:sonar
I got this problem with .Net plugins for Sonar.
They needed all projects to be analyzed with JDK 6 (even non-.Net projects).
This error was raised when I tried to analyze projects with JDK 5.
Here is the URL of the .Net plugins : http://docs.codehaus.org/display/SONAR/.Net+plugin
The solution I got was to fork the compiler to use a JDK5 compiler on my projects which needed to be analyzed in JDK5 and not JDK6.
See on the .Net plugins page :
Maven and Sonar dotnet plugins need Java6 (at compile time and runtime)
What the sentence does not say is that all projects in your Sonar instance must use Java6.
A JIRA has been created : http://jira.codehaus.org/browse/SONARPLUGINS-1086 .
Got the hints from http://old.nabble.com/Another-%22Current-container-state-was%3A-CONSTRUCTED%22-problem-td28172925.html#a28194257
It seems the problem is inconsistency in maven plugins in my nexus repository, when I change to mirrors.ibiblio.org and clean the .m2 directory, everything goes fine.
BUT I don't know which plugins causes this problem and the log information is so wired, will be nice if some people points which plugin cause this problem and explain the reason for this error information