what are the exception which will be uncaught in Exception.class and RuntimeException.class

I am working on Spring MVC application. I have configured @ControllerAdvice and caught Exception.class, RuntimeException.class

NullPointerException is being caught under Exception.class

For a particular url hit the server returned 500 error which is not being caught in Exception.class or RuntimeException.class in the global exception handler via @ControllerAdvice

Please let me know what are the exception which will be uncaught in Exception.class and RuntimeException.class
Software ProgrammerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
The Javadocs give you all this information...

https://docs.oracle.com/javase/7/docs/api/java/lang/Exception.html

If you look toward the top of the page, you will see that Exception is a subclass of Throwable. Throwable's are also objects that can be caught with a try/catch statement and also thrown by a "throw" statement.

Click on Throwable and then you will see that it actually has 2 subclasses, Exception as you now know but also Error. (Note, Error has a whole heirarchy of subclasses too)

So if you are getting a 500 error (and you are sure that your ControllerAdvice is correctly configured) then perhaps either a Throwable has been thrown, or an Error has been thrown. Now these are reasonably rare things to be thrown though, so you can try catching just Throwable, that should get everything, but I am going to guess that you still may get the 500 error because it isn't that the Throwable is getting through, it is just the the ControllerAdvice isn't actually being used in the particular execution path that is causing your 500 error.
0
Software ProgrammerAuthor Commented:
so how to handle it or what would be the solution ? i found out that controller methods which are routed via ajax function calls are getting propagated..However the controller methods which has errors on page load or doesn't comes under ajax calls is not getting handled. It always throws 500 error even though we are sending as BAD REQUEST - 400 in the @controller advice.
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
There's no real way that I could answer that without having seeing your code and how it all fits together, unfortunately.
0
Software ProgrammerAuthor Commented:
I have found out the problem and the uncaught exceptions are

handleHttpMediaTypeNotSupported
handleHttpMediaTypeNotSupported

Detailed guide can be found from
- https://blog.jayway.com/2013/02/03/improve-your-spring-rest-api-part-iii/
- http://www.baeldung.com/global-error-handler-in-a-spring-rest-api
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Software ProgrammerAuthor Commented:
Identified the root cause of the problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.