I have a batch file which start Tomcat as follows (when running it on Windows it works fine)
...
start C:\Users\root\tomcat\tomcat2\bin\startup.bat
The batch file is called from Jenkins as follows
I have this error in the Jenkins Consol at the end of the build
D:\jenkins\workspace\Start 3T2>start C:\Users\root\tomcat\tomcat2\bin\startup.bat
Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Finished: SUCCESS
When I check the task manager I see that the server is started but in background. I need actually to start Tomcat it in the Console.
This is what I did :
I added -Dhudson.util.ProcessTree.disable=true in jenkins-slave.xml
used to start jenkins slave service.
I added set BUILD_ID=dontkillme in startup.bat to stop Jenkins from
stopping the process in the end.
I think Tomcat start correctly in the end but not in Console. I'm running Windows 2012 server/Tomcat7/Jenkins 1.578.
Any idea on how to start Tomcat in a Console ?
AFAIK, if you're trying to start Tomcat console on a given machine which has Jenkins configured as service, it will not work. To make it work, you will have to connect to the given machine using JNLP. In case it's a standalone system and you want to open a Tomcat console using Jenkins, you will have to set up a Slave on the same machine and that too using JNLP (Launch slave agents via Java Web Start) in the Launch method section in Jenkins > Manage Jenkins > Manage Nodes > Slave Node's Configure page.
You can connect to the slave using any of the methods shown below. You will see the below option as soon as you configure the slave node and click Save. I ran the highlighted command from the Win command prompt. In my set up, i had configured Master and Slave on the same machine. I have Win 7 Professional, 64-bit laptop.
Once you run the command, you will see a small window that will pop-up and will display 'Connected' message as shown below:
At least for me, i checked that hudson.util.ProcessTree.disable=true & BUILD_ID parameters were not required. The only thing that i needed was to make sure that the following property is unset: HUDSON_SERVER_COOKIE
P.S.: You might have to make sure to start JNLP on reboot. A start-up script will do that. Also, ensure that your project/job is tied to the given slave which is running using JNLP mechanism.
i was going crazy with this , as shutdown.sh worked from Window-Master-Jenkin-->Linux-Slave-Jenkins, but startup.sh was not happening on my linux-slave-jenkins though startup.sh execution showed success message, as there were no logs anywhere, it was difficult to troubleshoot, not sure how and why setting up "export HUDSON_SERVER_COOKIE= " just before running startup.sh worked. Anyway Thanks a lot.
Related
I have a web application running on 10.0.1.62:8080/xxx. I want to debug remotely via IntelliJ IDEA. I have set JAVA_OPTS = -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
on 10.0.1.62 machine(Tomcat7 on Ubuntu) and when I hit the remote debug button IDE is giving an info message :
Connected to the target VM, address: '10.0.1.62:8000', transport: 'socket'
Than I am hitting the 10.0.1.62:8080/xxx.
Although I get this success message brekpoints are not hit. What am I missing ?
Firstly, double check your settings by referencing this question and answer: Remote Debugging in IntelliJ Tomcat
From you question it sounds like you have already followed these steps. There are a few other config problems that have caused me issues with remote tomcat debugging in the past that I'll share and hope it helps.
Be sure you started the proper remote debugging process on IntelliJ.
Make sure you are connecting to the correct Tomcat instance, if there are multiple Tomcat servers running on your host. The debug port 8000 may already be in use. I'm use an arbitrary port of 15019 or some other port number not already in use. Make sure the ports used match between Tomcat and IntelliJ.
Depending on how you setup remote debugging on Tomcat, it may not shutdown properly leaving an old instance running. Adding the debug hooks at the top of catalina.sh will cause the shutdown.sh script to fail because your debug port is already bound to the Tomcat server. Instead place it within the start if statement:
elif [ "$1" = "start" ] ; then
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=15019,suspend=n,server=y"
After fixing this issue, you can shutdown Tomcat successfully with ./shutdown.sh and still start debugging with ./startup.sh
Make sure you have a clean deployment of your application on Tomcat. Your cleanup process may require variations, but here is the general idea:
Shutdown Tomcat, then verify it is no longer running.
Remove the deployed war file and corresponding exploded version from your tomcat webapps directory.
Remove the contents of the work and temp directories.
Deploy and verify your recently build war file.
Start Tomcat.
Creating a script to do this will save time.
If all else fails, add a debug log to double check the code with the breakpoint is being invoked in the first place.
I'm sure there are twenty other things that could go wrong. Feel free to add ideas.
I'm pretty new to setting up jenkins so please bear with me. I'm trying to remote execute a shell script that stops and starts up my stand alone Jetty deployment after Jenkins has finished building and deploying the files to this server.
http://imgur.com/PXGHqtl
(screenshot of the Post Build settings on Jenkins coz I'm not 10 rep yet...)
So the problem I'm having is that once the build reaches this stage and the Send Files over SSH plugin begins to execute the jetty.sh start script, I get a timeout error because the sh script seemingly doesn't return any completion acknowledgement (ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,003 ms]). This causes the build to fail despite the jetty service starting up correctly.
I have tried playing around with the Advanced settings by enabling the "Exec in pty" but this causes the started up jetty service to be shut down again as soon as this step completes.
Does anyone have suggestions as to what else I could try? Is my approach correct or completely wrong?
Why I am getting the timeout error
There's a built in timeout in the advanced section of the Send Files over SSH plugin. By default it is set to time out at 120 seconds on inactivity on the SSH connection. In this instance I am running the Send Files over SSH post task with "Exec in Pty" option disabled. When this option is checked, the plugin will connect to the deployment server over a virtual SSH Terminal session and afterwards, it doesn't exit the session by itself so it simply waits for the timeout.
Why the jetty service starts up but shuts down immediately
With the "Exec in Pty" option enabled, a proper SSH Terminal session is used to connect to my deployment server. This ties any outputs and processes to the actual terminal session. When the Send Files over SSH plugin completes the jetty startup script execution, it exits by itself but in doing so, kills any process launched by the script.
Solution
After much digging around i found a solution to launch my script using a command: 'nohup ./jetty.sh start > /dev/null 2>&1 &' in place of my usual ./jetty.sh start command. There is a downside to this though. The output is not redirected to the terminal session so I won't know if my jetty service started up properly. But for now I'm satisfied with the solution so far since it's only going to deploy to my development environments.
Sources
Terminating SSH session executed by bash script
Jenkins Text-finder unable to success my Build
Jetty server stops running after closing terminal window
I have a Jenkins server in windows 7 environment, and I run a batch file from jenkins. This batch file launches a jar that calls cmd.exe in order to connect to an instrument (spirent).
The above batch file fails when is started from jenkins, installed as a windows service, but works fine either if is started directly from cmd or from a jenkins started as
java -jar jenkins.war.....
If the windows service user running Jenkins is different than the user you are logged in as, you are likely running into a permissions issue. Possible solutions include changing the user running the service or modifying permissions necessary to allow the service user to perform the desired tasks.
I have a problem with starting Jetty via the startup command /etc/init.d/jetty. When I execute the command the following output is generated:
/etc/init.d/jetty start
Starting Jetty servlet engine.:
Jetty Rotate logs
Jetty servlet engine started, reachable on http://jagadguru:80/.: jetty.
It does start successfully when I type java -jar start.jar in my Jetty directory.
Can anyone help me with this?
This is likely a file permission issue. Even if you are running the start script with sudo, the script defines a jetty user (default is jetty). I had an issue similar to this where my permissions on /tmp prevented jetty from creating a file there. I adjusted the permissions on /tmp and all is well! The jetty user also needs permissions on the jetty folder of course.
Also, for checking if Jetty is finding java correctly, run sudo service jetty check
It's probably an issue due to wrong permissions on some work or log folder. I assume the start script tries to change the user and therefore doesn't has the same permissions as the one you use when running Jetty via "java -jar".
Another possibility is that you don't have JAVA_HOME set and the start script doesn't find your java bin.
Please attach some kind of log file as it is really hard to say more without more detailed information.
As answered here, the default configuration for Jetty in /etc/default/jetty only allows connections from localhost, you need to set JETTY_HOST to 0.0.0.0 to allow Jetty to accept connections from any host.
Add the following line to /etc/default/jetty:
JETTY_HOST 0.0.0.0
I am trying to run a Java webapp build instance but it stops in the middle of the build with this error:
java.net.BindException: Address already in use:8080
It's obviously trying to bind to the 8080 port but another process has already done so and wont share.
So, I checked to see what process is using the 8080 (netstat -anp | grep 8080). Apparently the jsvc.exec process is listening to my 8080 port. Upon checking (ps -fp) I find out that this is Tomcat (boostrap.jar).
So, to see if the build would at least complete, I killed the process. And yeah!! The Webapp build installed completely. But when I navigated my browser to localhost:8080 it says the service is not running - coz I killed Tomcat! I even tried localhost:8080/manager/list. Still said service not running.
So I restart Tomcat, checked localhost:8080 and Tomcat was back up. Checked localhost:8080/manager/list but did not see the Webapp instance I had just built.
What I am not getting here! My webapp wont build if I run tomcat (cant share 8080). And If i kill tomcat to complete the build, the webapp obviously cant run coz Tomcat is dead.
Please help me. Running Tomcat 5.5 in a LAMP environment on a remote server. NOTE: I am running a pre-built webapp build application (war) which I cant make changes to.
During a build? A build process usually doesn't require a port to be open. The issue is that two programs are attempting to use the same port. Without fixing the underlying issue, the immediate fix is to change the port Tomcat is running on. To change the port Tomcat runs on, edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 8081.
If this is your first time running Confluence or you have recently added applications or made changes to the system, investigate what's running on port 8080.
If Confluence was not shut down properly, you can restart the machine or kill the process:
On Windows:
Hit Ctrl-alt-delete and look at open programs. Look for {{java.exe}}.
From a command window, run {{netstat -an}}. Check which ports are in use. You can identify which application is running this way, then close it from the Task Manager.