I am using Weblogic 10.3.5.0 and have a war being deployed in this instance of Weblogic that uses the library Joda Time 2.1. Due to the fact that Weblogic internally uses the joda time library 1.2.1, I am receiving ClassCastExceptions because the Weblogic class loader is taking preference and certain Joda classes being picked up are old versions that are clashing with newer classes.
I've done some research, and this issue can be resolved by specifying this descriptor in my weblogic.xml: *<prefer-web-inf-classes>true</prefer-web-inf-classes>*.
However this causes additional problems as other jars that I am using in my application should NOT take preference over Weblogic specific libraries. I am receiving other exceptions due to this solution so it can't be used.
I could also user the *<prefer-application-packages>* descriptor in an application.xml so I will ONLY prefer the Joda jndi path and no others. However, I am deploying a war, not an ear so I cant use this descriptor. I could just create an ear instead but since I am not currently using any EJBs in my application, I'd rather not create a more complex deployment if its not needed.
So, my question really is if the two options above are not available to me, what is an alternative way of resolving this ClassCastException from Joda 1.2.1? What would happen if I replaced the 1.2.1 library Weblogic is using with 2.1? Would that cause any issues in Weblogic? What is Weblogic using Joda Time for anyway? Are there any other workarounds for this than what was described above?
Does anyone have any answers to my question below. With the research I've done, it seems a workaround is available for the old joda library used by Weblogic but only if you use an ear or only in certain cases with a war where other class loader conflicts dont exist. Anyone's insight into another option would be helpful as I am currently not using an ear. If we could replace the old joda library with a newer one ourselves, that would be an easy fix. Please let me know what the official solution to this issue is.