WebSphere 7 + WebSphere Deployer Plugin - jenkins

I just have a quick question. By following set up guide it is all good until the artifact update. I copied all required .jar files and imported )cacerts_. I can test the connection web sphere (I am using WS 7). All is working fine. But when plugin reach a step to check application installed on WS I am getting the following error:
Any ideas?
-------------------------------------------
Connecting to IBM WebSphere Application Server...
The following artifacts will be deployed in this order...
-------------------------------------------
XXX_123.ear
-------------------------------------------
Error deploying to IBM WebSphere Application Server: org.jenkinsci.plugins.websphere.services.deployment.DeploymentServiceException: Could not determine if artifact 'XXX' is installed: javax.management.ObjectName cannot be cast to javax.management.ObjectName
at org.jenkinsci.plugins.websphere.services.deployment.WebSphereDeploymentService.isArtifactInstalled(WebSphereDeploymentService.java:357)
at org.jenkinsci.plugins.websphere_deployer.WebSphereDeployerPlugin.stopArtifact(WebSphereDeployerPlugin.java:243)
at org.jenkinsci.plugins.websphere_deployer.WebSphereDeployerPlugin.perform(WebSphereDeployerPlugin.java:198)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:757)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at
hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:706)
at hudson.model.Run.execute(Run.java:1703)
at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Build step 'Deploy To IBM WebSphere Application Server' changed build result to FAILURE
Finished: FAILURE

I just had the same issue. As this looks like a classloader issue, I dig aroung for classloading specification in jenkins.
I ended up updating the PluginFirstClassLoader property in the plugin and my deployment now complete succesfully.
To do this change, edit the file :
$USER_HOME/.jenkins/plugins/websphere-deployer/META-INF/MANIFEST.MF
Then replace the following property :
PluginFirstClassLoader: true
By
PluginFirstClassLoader: false
My current setup :
jenkins : 2.1-1.1
websphere-deployer : 1.3.4

If you got IBM jars needed by plugin from WAS 7 they are compiled for a jvm 6: Jenkins uses java 7 (at least my version), so I guess incompatible java bytecode rises.
I copied IBM jars from a WAS 8 installation and all went ok.
Hope this helps.

Related

Jenkins upgrade from 1.6xx to 2.xx (1.642.3 -> 2.32.2)

I upgraded Jenkins to 2.32.3 version (in place upgrade) after taking necessary backups (THIN) or $JENKINS_HOME and Jenkins is now UP and running.
Under Manage Jenkins > Manage Plugins, I see the following RED error:
Manage Jenkins
Correct
There are dependency errors loading some plugins:
Environment Injector Plugin v2.1.3
envinject-api v1.2 is missing. To fix, install v1.2 or later.
While trying to install Environment Inject Plugin 2.1.3, the logs (during download/install) shows the same error:
Installing Plugins/Upgrades
Preparation
Checking update center connectivity
Success
Environment Injector Plugin
Failure -
java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1895)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1652)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Failed to install envinject plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:873)
at hudson.PluginManager.dynamicLoad(PluginManager.java:813)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1891)
... 5 more
Caused by: java.io.IOException: Environment Injector Plugin v2.1.3 failed to load.
- envinject-api v1.2 is missing. To fix, install v1.2 or later.
at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:621)
at hudson.PluginManager.dynamicLoad(PluginManager.java:863)
... 7 more
Where can I get this envinject-api 1.2 plugin? Should I go grab the Github project (clone it) and build the Maven project and put the hpi file under $JENKINS_HOME/plugins folder?
Under Available plugins tab, I don't see an option to select a given version (only 2.1.3 is available). I don't see envinject-api 1.2 plugin listed there either that I can select. My understanding it, selecting Environment Inject 2.1.3 should auto grab all of its dependent plugins for free per it's MANIFEST file.
$ cat $JENKINS_HOME/plugins/envinject/META-INF/MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: nenashev
Build-Jdk: 1.8.0_121
Extension-Name: envinject
Specification-Title: The Jenkins Plugins Parent POM Project
Implementation-Title: envinject
Implementation-Version: 2.1.3
Plugin-Class: org.jenkinsci.plugins.envinject.EnvInjectPlugin
Group-Id: org.jenkins-ci.plugins
Short-Name: envinject
Long-Name: Environment Injector Plugin
Url: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
Compatible-Since-Version: 2.0
Plugin-Version: 2.1.3
Hudson-Version: 1.625.3
Jenkins-Version: 1.625.3
Plugin-Dependencies: envinject-api:1.2,ivy:1.21;resolution:=optional,m
atrix-project:1.7,script-security:1.22
Plugin-Developers: Gregory Boissinot:gbois:gregory.boissinot#gmail.com
,Oleg Nenashev:oleg_nenashev:o.v.nenashev#gmail.com,Manuel Recena:rec
ena:recena#gmail.com
For some reason Jenkins plugins (didn't download the dependent plugins per the Manifest file).
As envinject-api plugin was not listed in the AVAILABLE plugin tab (under Manage Jenkins > Manage Plugins section), I had to manually download the .hpi / .jpi file directly from the following download plugins URL and then I placed the file in $JENKINS_HOME/plugins folder.
https://updates.jenkins-ci.org/download/plugins/
wget https://updates.jenkins-ci.org/download/plugins/envinject-api/1.2/envinject-api.hpi
Restarted Jenkins sudo service jenkins restart (or any other way you have setup) and this issue went away from both Jenkins GUI and from tail -f /var/log/jenkins/jenkins.log
PS: Don't just randomly select a latest version of any plugin or it's dependent plugin. It may not work and break more other plugins as it depends upon your current Jenkins version.
Found this link for Juseppe, not sure how relevant is this but seems interesting: https://github.com/yandex-qatools/juseppe

Jenkins deploying artifact to WebLogic

Trying to deploy an artifact using Jenkins WebLogic Deployer Plugin.
Getting following error:
Error: Could not find or load main class weblogic.Deployer
According to the documentation I should be using wlthint3client.jar (WebLogic version 12.1.3) but this client jar doesn't contain above class (Deployer), tried using the wlfullclient.jar which is said to be deprecated but if that throws another exception:
Hi, I want to install a war file generated from Jenkins to WebLogic, both on different machines, but when the installation runs an error is generated:
java.lang.NoClassDefFoundError: weblogic/deploy/api/spi/DeploymentOptions
at weblogic.deploy.api.tools.deployer.Jsr88Operation.init(Jsr88Operation.java:70)
Any ideas what could be the issue?
Regards!
I am having the same problem. I solved it actually adding all of these three libraries to the Additional Classpath:
wlthint3client.jar:weblogic.jar:wlfullclient.jar

Maven and Eclipse integration

I have a few questions about Maven and Eclipse which I do not know much about them. I'm new to all these tools. Let me describe what I've done:
1 - installed apache-maven-3.3.9 on my window and placed at "C:\Program Files (x86)\apache-maven-3.3.9".
2 - Added MAVEN_HOME (and M2_HOME) environment variables.
3 - Added the "C:\Program Files (x86)\apache-maven-3.3.9\bin" to the Path environment variable.
4 - Set a proxy for Maven download by creating a xml file under ${user.home".m2]settings.xml. The content of the settings.xml is:
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>www.github.com</host>
<port>8080</port>
<nonProxyHosts>www.google.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
5 - Tested and see if the Maven was properly installed:
C:\>mvn --version
C:\
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5 2015-11-10T11:41:47-05:00)
Maven home: C:\Program Files (x86)\apache-maven-3.3.9
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_101\jrr
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2008 r2", version: "6.1", arch: "x86", family: "dos"
6 - Tried to generate archetype and got a bunch of errors. Only one error is shown below. Basically, Maven tries to download the plugin but fails. I doubt the errors are caused by internet connection, but I don't know where else I need to look in order to fix this issue. The reason I said I doubted it was the internet connection issue is because I configure my POM file with the external jars on the web and all were downloaded correctly.
C:\>mvn archetype:generate
C:\
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or on
e of its dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven
-install-plugin/2.4/maven-install-plugin-2.4.pom
Terminate batch job (Y/N)? y
C:\>
So... that is the maven plugins downloading problem.
And here is the Eclipse problem:
1 - Installed Eclipse Neon.
2 - Tried to add the Maven plugins and it say that all maven plugins already installed. I did the Maven plugins before with the previously installed Neon. Then I deleted the Neon Eclipse because it fails to create a simple Maven-archetype project. Then I re-installed the Neon Eclipse. But before I re-installed Eclipse I already deleted all previously-installed Eclipse folders but I do not know where the Eclipse keeps all of Maven info. When the newly-installed Eclipse tries to download the Maven plugins, it recognized that all of the Maven plugins were already installed. I have no ideas where Eclipse keeps all those info about Maven plugins?
3 - Tried again to create an simple Maven-archetype project, then I got this error message:
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1
Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out
Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out
So.. basically, it is the same error message that Maven has.
Questions:
1 - What are the things I need to do get Maven plugins download via command line?
2 - Similarly, what are the things I need to do to get Eclipse to create a simple maven-archetype project?
I did checked out all of questions and answers about the issues of Maven not being able to download the plugins. I did try everything in last several days but no prevail. I understand that the answers/solutions are good but they do not work for me. Maybe I need to other things that I don't know where else I need to look for?
3 - Let say that after all these efforts fail, can I manually download the Maven plugins and configure them via my POM.xml? I checked the apache Maven website and it seems that the answer is "yes" but it does not provide the "how". I know it is NOT the best solution for maven plugins download but if I couldn't fix the download issue, the I will have to resort to the manual download and then configure the POM file.
Would you please show me how to configure the POM.xml file with the Maven Plugins?
Sorry about the long questions, but I'm new to these tools and I'm just trying to get a simple Java project built by Maven via Eclipse.
The proxy in the settings file is for case where the machine you run is behind a proxy (lets say a corporate proxy). You have put github.com as the proxy host which is not right.
If you have the maven installation bundled with eclipse that provides you integration with the IDE itself during the maven lifecycle process. You are however free to add a maven installation of your own by adding a existing maven installation from eclipse as well (you want to use a specific installation of maven with its settings).
If you are behind a corporate proxy , you will have to get the proxy through which the machine connects to the internet. You can then add that detail into the proxy settings in maven. In the case that your corporate proxy uses a dynamic proxy (e.g. a .pac file opposed to static host) you will need to look at options like CNTLM or wagon to work around and get it running.

Maven can't resolve sonar-maven-plugin version 5.1.2

We have Sonar and Jenkins located on the same machine, and Sonar analysis is run as Jenkins job post step. Jenkins jobs are built with Maven 3.0.5.
Everything was fine until we updated Sonar from 4.5.x to 5.1.2 yesterday.
After update sonar step failed with exception:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project TestApplication: Can not execute Sonar
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.sonar:sonar-maven3-plugin:5.1.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.sonar:sonar-maven3-plugin:jar:5.1.2
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.sonar:sonar-maven3-plugin:jar:5.1.2
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to find org.codehaus.sonar:sonar-maven3-plugin:pom:5.1.2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
We figured out that there is actually 5.1 version of org.codehaus.sonar:sonar-maven3-plugin, but no 5.1.2 in maven repo.
Fix:
We managed to fix it with forcing org.codehaus.mojo:sonar-maven-plugin version to 2.6 through in our pom file, as advised on official Analyzing with Sonar doc
But since we have dozens of projects, there should be better solution rather than changing every single project's pom files
Ok, simple solution found:
In the maven repository (.m2) it was cached that latest version of org.codehaus.mojo:sonar-maven-plugin is 2.0, even though the latest one is 2.6. (in file .m2/repository/org/codehaus/mojo/sonar-maven-plugin/maven-metadata-central.xml)
The old version differs a lot from the new one in the way it works (see Which sonar-maven-plugin version to use?)
We removed .m2/repository/org/codehaus/mojo/sonar-maven-plugin directory, so that newer version is downloaded.

Jenkins udeploy plugin log4j issues

Has anyone successfully updated the log4j jar file for jenkins to get the udeploy plugin working by following the instructions provided on their site http://wiki.urbancode.com/uDeploy/Repositories, seen below?
Note: Jenkins often uses an older log4j file then our plugin needs. You may need to replace it. See below for instructions:
1. Unpackage the jenkins.war
2. Open /web-inf/lib in the unpacked .war's directory to determine the name of Jenkin's log4j.jar
3. Navigate to your uDeploy server's %serverLocation%/lib directory and copy our log4j.jar to Jenkin's /web-inf/lib/ directory, overwriting the existing log4j with uDeploy's (rename it to match Jenkin's)
On standalone instances of Jenkins (not the Tomcat app), Jenkins keeps a hash of all of it's files and will throw an error when starting Jenkins due to a mismatched hash after modifying the log4j file. The only solution is to remove the values in the file that tracks the hashes."
I unpackaged the war file, deleted the log4j jar (1.2.9) found under WEB-INF/lib/, added the newest log4j jar (1.2.17), renamed it to 1.2.9, then removed the SHA1-Digest: line (the hash) for log4j 1.2.9 found in the manifest under META-INF/ all which seems to agree with the above instructions. Deploying the war (service jenkins start) results in the following error, complaining that the SHA1 signature isn't there in the manifest:
Starting Jenkins Exception in thread "main" java.lang.SecurityException: invalid SHA1 signature file digest for WEB-INF/lib/log4j-1.2.9.jar
at sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:457)
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:250)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:193)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:262)
at java.util.jar.JarVerifier.update(JarVerifier.java:216)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:341)
at java.util.jar.JarFile.getInputStream(JarFile.java:406)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:752)
at sun.misc.Resource.cachedInputStream(Resource.java:77)
at sun.misc.Resource.getByteBuffer(Resource.java:160)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:436)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:476)
[FAILED]
What am I missing? I thought I followed the directions correctly, and evidently enough people have had this problem given that uDeploy added a special note to their wiki page about it. Any help/suggestions/ideas would be highly appreciated.
Jenkins is version 1.525.
If anyone is still interested in solution, I didn't remove digests. Just deleted log4j-1.2.9.jar and added log4j-1.2.17.jar (without renaming), that's all I did. An it worked brilliantly. Jenkins version 1.542.
Why did you rename it to 1.2.9? It will probably work as named as 1.2.17. It's a signed jar, and renaming it may be why it broke.
If jenkins is running on tomcat on linux, you are probably faster just logging into the box to the webapps directory and altering the expanding war there rather than repacking the jenkins war.
Follow the following steps to change the log4j version and solve the stated uDeploy problem :-
Stop Jenkins
Go to the installation directory of Jenkins
Navigate to .jenkins\war\WEB-INF\lib [On a windows system]
Delete log4j-1.2.9.jar and add log4j-1.2.17.jar (without renaming)
Restart Jenkins
It is not necessary to follow all the steps given as a solution by IBM :-
https://developer.ibm.com/urbancode/plugin/jenkins-ibmucd/
At this point, just use the new version of the Jenkins plugin. The incompatibility was removed.

Resources