Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

| Views: 2326
Joda-Time is a great library if you can't use Java 8 in your project. If you happen to be using version above with your web service and deploying to WebLogic 12c (12.1) you will likely get java.lang.NoSuchMethodError exceptions. This is how to fix it.

In my case I was getting an exception like this...
java.lang.NoSuchMethodError: org.joda.time.format.ISODateTimeFormat.localDateParser()Lorg/joda/time/format/DateTimeFormatter;

Strange I thought because I had joda-time-2.9.3.jar in my WEB-INF/lib directory.

It turns out that WebLogic comes with an old version of Joda-Time library, in my case it was the version which I found at the following location...
 WebLogic Library

The fix is easy, just force your web service to use the jar file that you bundle inside the WEB-INF/lib directory. To do this you need to set prefer-web-inf-classes to true in the weblogic.xml file. Below is an example.
<?xml version="1.0" encoding="UTF-8" ?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">

After making this change and redeploying everything should work as expected.


Have comments or feedback on what I wrote? Please share them below! Found this useful? Consider sending me a small tip.
comments powered by Disqus
Other posts you may like...