Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

May 21, 2014

NoClassDefFoundError: jersey/repackaged/com/google/common/collect/Maps

Hi,

I am working with spring 4.0.4 and jersey 2.7 and Gradle 1.11 suddelny out of nowhere i build and deployed to my tomcat 7 (latest release) and got the above error.
Worked to figure out what went wrong about an hour.
Than i saw that they released a new 2.8 lately, decided to try it - it worked +


Problem solved for me after upgrading from jersey 2.7 to 2.8
and adding this to my gradle dependencies
"org.glassfish.jersey.bundles.repackaged:jersey-guava:2.8"



Hopefully it will help you too,

Dor

Mar 19, 2014

Debug in eclipse with remote web application on tomcat

First ,

Solution is for ubuntu 13.10 but it's the same for all linux as well as windows.
(On windows you just need to change the export)

export JPDA_ADDRESS=8888

Next, run the catalina.sh

./catalina.sh jpda run



That's it.


From eclipse, go to Run->Debug configuration -> select the Remote Java Application -> Add new
don't change anything except the port with the above port.
Select the web project in my case.

And debug.

Dor


Apr 17, 2013

SimpleMappingExceptionResolver ignore exception

Lately i wanted to ignore ClientAbortException that raised by tomcat (catalina), instead of having a lot of stacktrace relates to this exception to have some line of my own, custom line in the log like "Client abort exception." and that's it.


There are many ways to do it, one way is using the @ExceptionHandler annotation from spring within the controller. But i have found that this solution obliged me to do so in all the relevant handlers.

Better way i think, extending the SimpleMappingExceptionResolver , overrding resolveException method,
When the exception arrive, check if the simple class name of the class inside it contains "ClientAbortException".

Why this way ?
This way you keep your code decoupled from tomcat catalina , better practice i think.


hoped i helped.

Dor