setting up jenkins with jenkins.war - jenkins

I have installed latest jenkins.war from
https://updates.jenkins-ci.org/download/war/
after that I have triggered that WAR file as
java -jar jenkins.war in command prompt.
I have attached the screen shots of the same.
As I could understand from the logs that, port which jenkins trying to operate on is already in use.
would appreciate the any help on this!

By default, Jenkins will bind on port 8080 (listening address will be http://localhost:8080), you can change this port by editing the jenkins.xml file that is located in the directory where you installed Jenkins.
Change it for another value and relaunch. (or try to find who is already listening on this 8080 port, probably a web server)
By the way, instead of downloading the jenkins.war, it would be better to use the native windows installer, that will install/start jenkins as a service.

You can change the port without editing jenkins.xml. This can be useful when you are doing an initial setup where you don't have a jenkins.xml yet.
java -jar jenkins.war --httpPort=<your port>
You can also run Jenkins this way with an existing jenkins.xml. In my case I can access the Jenkins UI using both ports. When one of both ports is already used by the system like in your case, Jenkins won't start.

Related

Running tomcat in debug mode as a brew service?

I have got tonnes of articles to run tomcat in debug mode by starting it as a with the startup scripts. I am running tomcat as a brew service on Mac, and using the below command(s) to start/stop the service:
brew services start/stop/restart tomcat
I also tried adding the jpda startup script in startup.sh with the above method but it didn't work. Still exploring around to see if someone has the solution to this. Meanwhile, if someone can help?
Running Tomcat 9 via Homebrew.
You can determine where your tomcat installation is located with brew list tomcat.
Then create a setenv.sh in the libexec/bin folder of your installation. Make sure that the file owner/permissions are set as for the other files in this directory.
In the setenv.sh, you can specify the debugging options that you want to set by e.g. adding the following line at the bottom:
export CATALINA_OPTS="$CATALINA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=18000"
Then restart tomcat and you should be able to connect your debugger to tomcat applications.

Start jenkins in the background

I'm using .war file to run jenkins on my server. They say use
java -jar jenkins.war
(Source: https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins)
to start the server. This starts the server and shows log on screen and it is ready to use.
The only problem is when I "ctrl+c" it stops the server. I want that it should start in the background so that even though I exit from putty it should be running. I know if use native package ".deb" it will be installed as service but I want to do it using only ".war" file and not as native package ".deb". Is it even possible?
Just put the process in the background as suggested by #KeepCalmAndCarryOn.
nohup java -jar jenkins.war &
I hope this helps.

jenkins URL with computer name does not open page

I know this question is asked before but I could not find any right solution for that
I have install jenkins on my windows 7 as windows service, it works fine with default URL localhost:8080, but when I set //mycomputerName:8080 in configuration system- jenkins location and then save it and restarted jenkins and enter //mycomputerName:8080 in browser address jenking will not open. I have done the same installation on my laptop windows 7 without any problem, but on my desktop I have installed, uninstalled several times with the same problem.
I just want to give my solution
Go to Jenkins Home Directory ( I have mine in C:\Jenkins)
Edit jenkins.xml
Add this --prefix=/jenkins to the end of the argument as show below and restart the jenkins service ALL worked OK for me !
Example :
<arguments>-Xrs-Xmx256mDhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --prefix=/jenkins</arguments>
Open Url http://localhost:8080/jenkins this should bring up the home page of jenkins
As I said in my question above many people have asked this question and had the same problem but all answer have been something from jenkins documentation and actually not solution.
so finally I found the problem and write it here probably for some people with the same problem
first I uninstalled jenkins removed all files, folder and everything related to jenking also from windows registry and installed jenking but did not work.
reinstalled windows (upgrade) and installed jenking again but did not work.
next I clean reinstalled windows and installed jenkins and in this case jenkins works as I expected but I do not know what was wrong with the windows.
Add to Vamshi's answer. Instead of the config in the
C:\Users\XXXX\AppData\Local\Jenkins\.jenkins\config.xml (you won't find <argument> in this file)
add the --prefix=\jenkins to the <argument> in jenkins.xml
C:\Program Files\Jenkins and restart the service.

Jenkins service starts then stops on Windows 7

I downloaded the native windows Jenkins package and installed it. On installation, it starts as a service in and shows in Task Manager, and also on going to the url localhost:8080. But then it stops. Here is what I get in my jenkins.out.log:
Running from: C:\Program Files (x86)\Jenkins\jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Jenkins home directory: C:\Program Files (x86)\Jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Any ideas what could be causing this? I've checked throuh netstat that no other process is using the port 8080.
I found that the java.exe process was hung and keeping Jenkins from starting. I killed the java process and then jenkins service started up just fine.
Use process explorer.
It's possible to start jenkins via the command line using java -jar jenkins.war, however, because the process is started via the command line it will also end when that command window is closed.
A better way would be to start the service via jenkins.exe but you would have to remind doing that at every startup.
Ultimately we have settled with a batch script with the following content:
cd "C:\Program Files (x86)\Jenkins"
start javaw -jar jenkins.war >> outputFile.txt
adding start before calling javaw makes sure that the command window is not attached to the process started, making it possible to safely close down the command line.
Using >> outputFile.txt writes the command window feedback in a text file, making debugging a whole lot easier when Jenkins ever breaks down!
Save it in a batch script, schedule it with windows Task Scheduler to run at startup et voilà: properly set up Jenkins service.
Only make sure it doesn't stop at log-off.
I switched back to version 1.535 and now it works.
After my win vm system rebooted, the jenkins 1.625.2 service would just keep stopping.
It solved it by:
Kill java processes. Found some old java running dll's.
Uninstall old version of jdk1.6 that was there.
Cleaning java temp. files dir.
Then I was able to restart the service w/o problem.
if java.exe not visible in process
1.netstat -a -o -n find out the PID of your port
2.tasklist /FI “PID eq PID″
3.taskkill /F /PID 2600 kill the process

jenkins does not get war properly exploded - giving tomcat start page

I downloaded latest jenkins.war (1.530) and just exploded it locally. When I go to localhost:8080 I get only apache tomcat start page instead of dashboard.
Am I missing something?
Running on OSX 10.8.2 with java Oracle 1.7.0_17
You're missing the context name in the URL, try:
localhost:8080/jenkins
exploded it locally
where exactly ? within tomcats' webapps folder ? If yes, then you have to start tomcat first.
and then visit the url http://localhost:<port>/<extractionFolderName> for e.g. http://localhost:8080/jenkins
I also use Jenkins and I prefer to use the standalone version of it, that's more manageable, and then one can run jenkins on different port, without worrying about tomcat's webapps, context and memory consumption.
http://jenkins-ci.org/content/thank-you-downloading-os-x-installer - here you can find the OS X installer.

Resources