Jenkins uDeploy failure - jenkins

After creating a tar of the build from jenkins, I am trying to move the tar to the main server using uDeploy. But i get the following error even after using the proper application name, environment and process name. I am unable to debug any further.
Please find the uDeploy settings and the log in the images.
uDeploy Jenkins setup:
error in console:

This is a known issue, have you done this workaround
Open jenkins.war and navigate to META-INF
Delete JENKINS.SF and JENKINS.RSA
Open MANIFEST.MF and delete all of the lines that start with SHA1-Digest
Place the new Log4j with version greater or equal to 1.2.12 (e.g. Log4J 1.2.17) jar in WEB-INF/lib
Update MANIFEST.MF to point to the new version

Related

How to update log4j-1.2.12.jar file in jenkins

I have this log4j-1.2.12.jar file in my jenkins server
Path to it: /data/jenkins/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar I got this Apache Log4j Unsupported Version Detection message from security team, how to resolve this I tried downloading the latest version but it is something like this log4j-api-2.19.0.jar
No, it's not "in Jenkins", more accurately, log4j is not a part of Jenkins. Jenkins consumes its jars from the exploded war in ${JENKINS_HOME}/war/WEB-INF/lib. It is not located there.
If a plugin consumes log4j, that would be found within the exploded plugin directory at ${JENKINS_HOME}/plugins/<plugin_name>/WEB-INF/lib. The status of log4j as it related to most plugins was tracked under JENKINS-67353.
What you are referencing is the maven local repository, .m2/repository. This structure is created when running a maven build on the controller; the dependency jars specified in (one of) your build's pom.xml.
The guidance in the comments is correct; find the appropriate pom.xml and update it, then rebuild.
You can verify these claims by deleting the entire .m2 directory (or moving / zip;delete if you are paranoid) and restarting Jenkins. You'll discover Jenkins is running fine and the directory remains empty. Run your maven jobs and it will repopulate, including log4j-1.2.12.jar, assuming it's still specified in your pom.xml. Fix your maven pom.xml, delete the directory, rerun your jobs and it should not reappear.
Perhaps you have already updated your pom.xml but never cleared out your local maven repository, then it will not repopulate (you could check the timestamp of the directory to know when it was first/last downloaded).
You can also delete referenced portions of the repository by specifying mvn dependency:purge-local-repository and adding -DreResolve=false to avoid re-resolving. Of course, if you've already updated the pom.xml, it would remain since it's not referenced in the pom.xml` (yes, it would be nice if there was an option to purge all or most of a repository or all version of a given jar, but ...).

How to define POM location in Jenkins that is installed on a remote PC

I have jenkins installed on a remote machine. How can I point my POM location in Jenkins. If I give the POM.xml location as C:\Automation\pom.xml I am getting the error no such file exists.
Started by user anonymous
Building in workspace C:\Users\Administrator\.jenkins\workspace\RegressionTestJob
Parsing POMs
ERROR: No such file C:\Automation\pom.xml
Perhaps you need to specify the correct POM file path in the project configuration?
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
Did not find any matching files.
Finished: FAILURE
Your pom should be in your workspace, like how you would build your project in an IDE e.g. eclipse and when you build your project Jenkins will find the pom on its own in the workspace and build the project
Incase you still wish to specify the location you can use the -f option
mvn -f PomFile.xml
Hope it helps :)

Unable to deploy war file on to Tomcat8 in jenkins

I'm doing a project as part of DevOps certification.
I need to build a pipeline which contains around 6 steps.
In the 5th step, I need to generate a .war file (which is successful).
In the last step, i need to deploy the war file which contains artifacts on to tomcat using Jenkins.
The project keeps failing. Is that something because of incorrect configuration. Here are the attached screenshots of build, post-build actions, and the console output of project.
Build and post-build actions
console-output of the project
Where am I doing it wrong.
There's issue either while reading your dependencies from pom.xml file or there are some missing dependencies. The stack trace gives build failure in gameoflife-web module.
Try building the same module in Eclipse IDE and you'll find the same error there and you can solve this by adding proper dependencies.
This issue is not of Jenkins when the build is not successful, it will always fail.

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.

TeamCity: How To enable FTP in ANT?

I have to copy files after build on a TeamCity-Agent via FTP. The orndinary buildjob works itself works fine. The triggering of a custom script finish successfull, too.
The step "copy files via ftp" fails with the following error:
[15:34:31]: copyFiles
[15:34:31]: [copyFiles] ftp
[15:34:31]: [ftp] Could not create type ftp due to java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClientConfig
I searched the web for a while and found many times the same answer: "You have to put commons-net.jar and jakarta-oro.jar in your ANT-plugin directory." So I downloaded these two files and copied it into C:\TeamCity\buildAgent\lib, but the error still exists.
Now the question:
Where do I have to copy these files to make FTP work? Or am I on the wrong track?
You've put the jar into the wrong place, it must be in the classpath of Ant, not in the classpath of the build agent.
You should find ant.zip file (TeamCity\WEB-INF\plugins\ant-tool\agent\ant.zip) and put the required jar (commons-net-1.4.1.jar, for example) inside ant\lib directory of the ant.zip file.
After the zip is re-packaged, TeamCity will update build agents with the new Ant version and commons-net dependency will be automatically available for Ant via its own classpath.
Note that you will have to repeat this step every time you update TeamCity to a new version.
Another option is to install Ant on build agent machines manually and configure TeamCity to use custom Ant installation (with all the required custom dependencies in the Ant's lib directory), however it's inconvenient if you have many build agents, but you will not have to repeat this step when updating TeamCity server.
Ant-net-task tool is bundled with TeamCity. This tool has jar files necessary for FTP, sshexec, scp and mail.
To use it Additional Ant command line parameters: -lib "%teamcity.tool.ant-net-tasks%" should be added.

Resources