Spring boot web context (AnnotationConfigEmbeddedWebApplicationContext)- suddenly being closed/shutdown - spring-mvc

I'm using spring-boot 1.1.3 running a web application (obviously, based on spring-web, security and more) with an embedded Tomcat.
I'm running my application on Linux (Ubuntu) machine with Java 1.7.
After couple of hours, I can see that the context is being closed without a reason. Just to make it clear, the process didn't crash and is still running, when I try to post/get a request, the client just hangs.
I'm using logback, configure with debug level as TRACE and I can not see who or why is close context is invoked.
Can someone please tell me how to detect the trigger for closing the context?

Actualy, the issue was not related directly to spring-boot but I wont change it's tag since other people might face the same scenario.
So, the unswer is the same for, How can I close a terminal without killing the command running in it?
just run your command with & at the end and than, execute disown.

Related

I am trying to make a Spring MVC application but the application refuses to start Tomcat Throws errors

Tomcat 7 Throws an error saying the application requires more time to start but even if i increase the timeout to 600 sec the same error comes up , how can i run the application .
I am loading all the jars from https://repo.spring.io/release/org/springframework/spring/
I am using jdk 1.6
Version 4.2.5 But still error .
Please help how can i run my application.
Error image
Solution : remove all project from Tomcat server, then restart tomcat again.
Method :
Window tab -> show view -> select server --> then right click server -> add and remove --> remove all configured --> finish --> restart server, may it help you.
Tomcat 7 normally starts within a few seconds. It sounds like you have one of these problems:
Something is going drastically wrong - check all logs in the /logs directory there may be clues in there.
Something in the static initialisation code of one of your classes is taking forever. Put breakpoints in any static initialization code and see if they are reached, and that control is returned to Tomcat in a timely fashion.
Something in the static initialisation code of another deployed application is taking forever. Undeploy all other apps (if there are any) and try again.
Also, try undeploying your application. Does Tomcat start normally now? This will sort out whether the problem is the Tomcat installation or your application.
My guess (and it is a guess) is that you are trying to open a mis-configured remote resource like a database, web service or JMS queue. Web services are often the culprit, as the JAXWS default is to have an infinite timeout. You need to do extra work to implement timeouts.

Java/Websphere NoSuchProviderException: IBMCertPath

I've recently inherited a task at my company that involves implementing an application that has currently been running off an employee's windows desktop, and migrating that code to Unix Server used for the office.
The server also runs IBM's websphere, which contains many of the companies larger web applications and uses java 1.6.
Organizational points aside (this is a huge company and much of the coding looks like a spaghetti western, with old legacy systems I wouldn't be suprised if people don't have any idea about), my plans was simply downgrade the code (which was simple as it was from 1.7 to 1.6), then move this application to a runnable jar, and call it via a shell script.
I, however, realize now why this application was never migrated to our production server, as I can't get the thing to run in the UNIX system.
First, I ran into an issue where (and I may be wrong about this) the SSL connections used as part of the application throws an error (same error as this question: Error accessing a Web Service with SSL) After some reading, it seems that any java application run on a server with Websphere (if the application is not in websphere) cannot be done, and thus you have to manually set some java Security Properties to do this (which i did right at the opening of my main method).
After doing that, I get past the initial error, but I am now getting this error
"com.ibm.jsse2.util.j: PKIX path validation failed: java.security.NoSuchProviderException: no such provider: IBMCertPath"
If this has already been asked, I'm sorry, but I couldn't seem to find it. Please link it here and i will close the question.
You are getting the error because something has specified to use the IBMCertPath provider, but java security doesn't know what that provider is.
You need to ensure that com.ibm.security.cert.IBMCertPath is in the provider list in your java.security file. See:
https://www-01.ibm.com/support/knowledgecenter/SSYKE2_6.0.0/com.ibm.java.security.component.60.doc/security-component/gen_info_sec_prov.html

How to detect whether a asp.net script is already running?

i want to create a script that would run forever. i mean i start the script today, and i should be able to see it running even in the next year.
this would not be possible because of the sever errors. it is obvious that the script will stop at least within 2 or 3 hours due to the server faults(im using a free web server).
so the method im going to use is to run two (or more) scripts simultaniously in two severs, and one scripts cheks if the other is runing & viceversa for every 30 seconds. and if found not running it executes the other one.
so the scripts will run as long as both of them are not stopped at once
1.my question is how do i check if the other asp.net script is running?
2.at least is there a way to check if another intance of the same asp.net script(in the same server) is already running?
i want to create a script that would run forever
ASP.NET is not the tool for this. A web application is a request/response system. It intercepts requests, performs a finite amount of processing, and returns a response. At that point it's done. Additionally, web servers are free to allocate and de-allocate resources for a number of reasons, so at any time your web application can be shut down.
What you're looking for is something more like a Windows Service or perhaps a Console Application (backed by a scheduler or something else to ensure that it's running). Web applications by design don't "run forever" so they're not the right tool for the job.
ASP is not free but it is also not too expensive, we can run a script on server that can continuously work on server, but doing such thing on server can cause server load error, and will affect other websites which are hosted on shared hosting. You can go for VPS hosting, But I think that your server administrator can suspended your account on running such kind of script on server.

ASP.NET 2.0 application never loads

I have an application that runs perfectly fine locally using the VS 2010 application server, however, when I deploy to our web app machine startup just spins and spins and never loads. We have other apps on this same machine that load just fine (this is a debug deployment of same app in product).
I have been spinning my wheels on this for days and I am at a loss as the problem could be.
Here is what I did
Create a new directory (same level as other apps)
Copied over our existing test (www.domain/test/) and it works fine
Build and publish new debug app (www.domain/test/) and it just spins trying to load first form.
I know the diretory is "working" as the 'test' application I put there works fine.
If it's killing the App pool, you might get something in the event log. Fiddler (www.fiddlertool.com) is great http debug tool which let you see if you're in a redirect loop. Also Firefox shows a more meaningful error, something about exceeding the max redirect count.
It does sound like something is looping, but not quick enough to cause a stack overflow, which is odd, because you'd expect it to fail every time.
Simon
Do you have the ability to remote desktop into the machine? If so try running process explorer and look at the process details for the worker process that is giving you issues. Definitely look at the TCP connections being created. If your processor is pegged at 100%, and memory usage is rising then you probably have an endless loop running.
It sounds like it's more related to IIS than ASP.NET. What about the identity that the website is running under? Is it possible that the user the site's running under a bad user, or maybe the password needs to be re-entered?
I did a quick Bing search
There are a lot of postings regarding the error message you described above. Most if not all point to code in your app that is crashing. I know I had a similar problem when I used an automated/threaded daemon utility in my web application. Make sure your code is not bringing down the server, sometimes the VS2010 web server is a little more foregiving than an actual IIS deployment.
If that doesn't work try running a Remote Debugging Session to try and catch any errors being thrown but not handled.
Lastly you could try to setup a new local IIS server to see if you have the same problems. Scott Gu has a nice article about using IIS Express to do this.

Is it possible to debug IIS without affecting all users of the service?

This may seem like a silly question, but we are having an issue debugging IIS in a shared test environment and I'm hoping that someone out there can give us an answer.
We have a Windows Server 2003 that is running IIS 6 and sharepoint 2007. We are debugging locally on the server with visual studio 2008.
When someone attaches the debugger and steps through the code, we find that all users are affected. In essence the web server stops handling all requests from all users.
Our question is whether this is a typical situation and is to be expected? Or is there some configuration that we can change that would allow the one user's session to be debugged but leave the other's unaffected.
Kev's on the right track. You need to make sure that the project you want to debug separate from the others is in its own application pool. This will isolate it to its own process and allow that process to be stopped/debugged without affecting the other applications which can remain in a different pool.
Setup
Start -> Run -> inetmgr
Right Click on Application Pools
Click New -> Application Pool
Name the new pool
Right Click on the application you want to isolate
Click Properties
Click on the Home Directory tab
In the application pool drop-down list select your new pool
Click OK
If there are any requests queued in the old process, they may take a few minutes to terminate before all requests are being diverted to the new process.
Debugging
To figure out which instance of w3wp.exe you need to attach the debugger to:
Start -> Run -> cmd
Type iisapp
You may be prompted to register CScript, if so click yes and run it again
The only gotcha you may still find is that if multiple applications are using the aspnet_state service you may run into blocking issues if you need to debug that process as well.
Links
MSDN
Developer.com
"When someone attaches the debugger
and steps through the code, we find
that all users are affected. In
essence the web server stops handling
all requests from all users."
This is normal, once you attach a debugger to a process such as inetinfo.exe or w3wp.exe and set a break point, every request/thread will be blocked until you allow the debugger to continue, until the next break-point.
I've never found a way around it. Is there some reason you can't debug on each developer's workstation?
Set up a parallel project on the server and try using that. You could use debug.mydomain.com and then just use that for testing. The only reason that I personally can think of to debug on your live servers is if there is a significant difference in the functioning of your app due to either hardware or software configuration.
Ideally you want to have a separate server/instance of your system in as similar an environment as possible so that you don't have to debug on your live machine. Also you might want to consider writing all errors to the event log or at least checking the log since asp.net usually get logged there. This way you can see where your errors are and use that to help you solve your problem in the development environment.
I believe in visual studio you can set the debugger to break only the process being debugged, and not all the processes. Depending on how your system is set up, YMMV with this.
It can't be changed AFAIK. But that's a normal practice to set up separate web-node or web-application for development/debugging purposes. If that's necessary to know exact values of some vars in certain situations you can always use debug logging.

Resources