Geoserver - automatically detect its stop and restart - restart

I use Geoserver on Windows server and it sometimes stops for some reason. How can I automatically detect its stop and restart?

I recommend https://mmonit.com/monit/ for this to monitor tomcat and restart it if needed. It is also best to make tomcat fail on OOM errors rather than trying to limp on.

Related

Controlling Wildfly undeploy

We have an issue with undeploying an enterprise archive from Wildfly in a controlled matter. So the issue is that we automatically undeploy and deploy a new enterprise archive to Wildfly (Wildfly is also restarted). However, the issue is that we need to make sure that system goes down in a controlled matter so that state is not lost of corrupted.
This is normally done with a shutdown-hook, but that does not work well with Wildfly. When undeploy executes the shutdown-hook is executed, but Wildfly will not respect it. It will not give enough time to system to do clean up and threads to terminate.
So is there anyway to pause the undeploy or force Wildfly wait longer for the system to terminate before killing it?

Difference between starting an application and starting a managed server in weblogic server?

I wanted to know what is the difference between starting an application and starting a managed server in weblogic server?
I have 5 different applications targeted to one managed server, whenever I make any change to any one application I have to restart the managed server entirely to make the changes to reflect. Why is it not that when I simply start and stop the application alone from Deployments it reflects, why do I need to start the managed server every time?
Restarting the managed server will restart the entire JVM including all installed EAR files. Stopping an application simply puts the application in Admin mode so the application class files are not unloaded.
This following document discusses various methods for redeploying applications in WebLogic based on the scope of the deployment:
https://docs.oracle.com/cd/E24329_01/web.1211/e24443/redeploy.htm#DEPGD258

Eclipse IDE remote rebug and remote edit a legacy webapp

I am in a bind here, what's happening is I have a legacy webapp which uses an in-memory database. The app requires 64GB of RAM just to launch and it takes at least 30 minutes to start.
I have to make updates/fixes to this application. Obviously it is impossible to launch it on my PC so everything has to be done on the server. I have considered setting up an Eclipse IDE on the Linux server where this app runs, but that introduces a set of new issues. I really would like to continue using my PC's Eclipse IDE and make edits to the app.
I am able to use the remote debugging capabilities of Eclipse IDE and launch this app from the linux server no problem. However this is not enough. After I make an edit, I need to be able to save/compile the file, and load this change into the server relatively quickly. I can't wait 30 minutes every time I make some updates to the app.
Can anyone recommend ideas on what to do in this scenario? Ideally I would love to be able to launch the app in DEBUG mode inside the Linux Eclipse IDE on the server and connect to this instance using remote debugging from my local/Windows IDE. I would like to make changes in my Windows Eclipse IDE and then quickly copy the files over to the linux server, pick them up in the Linux Eclipse IDE, compile them in the Eclipse IDE instance running in debug mode, and effectively "hot swapping" the changes, thereby avoiding the need to wait 30 minutes for the app to start back up... However when I try to do this, there is a caveat... I can't seem to be able to launch the webapp in Linux Eclipse IDE in both DEBUG mode and also remote-debug-connect to it, the error I am getting in Eclipse is:
"Cannot load this JVM TI agent twice"
I get what is going on: the local debugger is launching tomcat with the -agentlib:jdwp parameter and on top of it, I am trying to force it to also start up with the same arguments and so it complains, but is there some way to trick it into allowing me to remote connect into this debug session from my Windows server?
I managed to solve this issue by updating Tomcat's context.xml to support reloadable mode:
<Context reloadable="true">
And in the app to set it to reloadable in WEB-INF/web.xml:
<web-app reloadable="true">
Now I am able to make edits in my local windows Eclipse IDE, Save them, and they automatically get updated on the server side.

Why wont the Zed Attack Proxy (ZAP) start

I have ZAP installed on a build server (Windows 2008 R2) and on my Windows 7 desktop, and Zap only occasionally starts. I click on the program and my cursor shows it is waiting for a second or 2 and then nothing. Attempting to run from the command line will also not show any signs of running.
Then just out of the blue the program may launch.
Is it possible it just takes forever to start. I left my computer running and the next day when I came to work there was the UI.
I get the same results if I try to run the program in the headless state. with the -daemon flag. it never starts, it never shows up in the task manager, as an application or a process
thanks Noel
Turns out there were 2 issues. The first was that the tool was taking 4-5 minutes to start (I timed it several times at around 4m 30s). I did not have the patience to wait, so I would try to start it again. Attempting to start the application when one had started, but no UI was showing invariable caused the application to hang.
Secondly if you start it as a headless application there is no way to stop it. So if you have it headless and then try to start the application it will cause it to hang. THe easiest way to tell if it is running is to follow the log information being written out as suggested by Psiion above in his link.
To kill the process, look in the task manager for the java process and kill it.
Just in case anyone stumbles across this post, my problem was I didn't have Java installed. I had removed it a few months ago due to security considerations.
You can stop your browsesr using Java easily by using the Java control panel http://www.java.com/en/download/help/disable_browser.xml
I was facing a similar issue, the ZAP tool was working fine on my local machine but was displaying erratic behavior on the Virtual Machine. I tried all the previously mentioned suggestions but none of them could mitigate the issue. Upon checking the log files i found out that the HSQLDB files were being locked even after closing the tool or even if the tool did not start. I eventually figured out that the difference between the 2 environments was just the operating system. My local had Windows 10 pro while the VM had Windows 10 enterprise. So in case if any one else is facing similar, kindly check the operating system.

Unable to reconnect to Derby from Tomcat server started via Eclipse

I'm running on Win 7 using Eclipse 4.2 starting a web app on a Tomcat 7 server and using Derby database. I have tried many approaches but run consistently into a common problem:
Everything works just fine the first time I start up and run.
When I redeploy my application after a change, all database connections hang (any kind of restart).
If I stop Eclipse and restart Eclipse, that clears up the problem and the next run works fine again.
Having done some investigation, it appears that the problem is that the Derby port (1527) is not released from one execution of the server to the next. That seems very strange to me since Derby is started by the Tomcat instance which is a separate javaw process.
I've tried:
Configuring the Derby connection as a Tomcat resource
Establishing the connection within my code (rather than via Tomcat resource)
Both the embedded and the network driver
Starting / stopping the network driver from a servlet on startup and shutdown of the Tomcat server
Shutting down the embedded driver via servlet on shutdown of Tomcat
Again, every approach works fine to connect the first time.
One other symptom that doesn't appear to be related (except for as a possible indicator of whether or not shutdown completes correctly) is that the db.lck file for my database never gets deleted. However, whether or not it exists has no bearing on whether or not I can reconnect (only stopping/starting eclipse has an impact).
Any insight would be appreciated.
Thanks!
After some further investigation I'm going to call this a duplicate of: Cannot create JDBC driver of class ' ' for connect URL 'null' : I do not understand this exception. It's not quite the same thing, but that solution (creating META-INF/context.xml) allows it to proceed to failing calls rather than hangs, which is a significant improvement and suggests it's largely related.
I did finally figure this out. It turns out I had the derby jars in the Tomcat lib folder (for Tomcat) and in the deployment assembly for my application in Eclipse (rather than just in the build path). So Tomcat was using the built-in libs, while my app was using the embedded libs, and this resulted in conflicts. Leaving the libs as part of Tomcat and removing them from my war file solved the problem completely.