Thursday, April 19, 2012

Runtime Error:class loading constraint violated

Webapp reports the following error every time it tries to poll the sql server:

Uncaught exception thrown in one of the service methods of the servlet: dispatcher. Exception thrown : org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.VerifyError: class loading constraint violated (class: com/microsoft/sqlserver/jdbc/SQLServerResultSet method: updateNClob(ILcom/microsoft/sqlserver/jdbc/NClob;)V) at pc: 0

And it worked in the local environment, but not on the test server.

SOLUTION: Go to test server WAS Integration Solutions Console, Applications->Enterprise Applications, and then click on your application
Within Detail Properties, press, Class loading and update detection and there switch the Class loader order from Classes loaded with parent class loader first to Classes loaded with application class loader first.
If you had it already set, then your issue is different then mine.

Core explanation of the this error is:
java.lang.VerifyError can be the result when you have compiled against a different library than you are using at runtime.

For example, this happened to me when trying to run a program that was compiled against Xerces 1, but Xerces 2 was found on the classpath. The required classes (in org.apache.* namespace) were found at runtime, so ClassNotFoundException was not the result. There had been changes to the classes and methods, so that the method signatures found at runtime did not match what was there at compile-time.
Normally, the compiler will flag problems where method signatures do not match. The JVM will verify the bytecode again when the class is loaded, and throws VerifyError when the bytecode is trying to do something that should not be allowed -- e.g. calling a method that returns String and then stores that return value in a field that holds a List.


Pasted from

Hope this help anyone else, as I havent really managed to find that anyone had similar problem.