7

Hi I creating war aplication with weblogic 11g and I have problem with joda time's method

new DateTime(int, int, int, int, int, int);

this thrown nosuchmethodException but when I use new DateTime(int, int, int, int, int, int, int);(one int more) it works fine update:

DateTime start = new DateTime(1990, 1, 1, 0, 0, 0); this doesnt works
DateTime start = new DateTime(1990, 1, 1, 0, 0, 0, 0); this works

Any idea where is problem ? thx

hudi
  • 15,555
  • 47
  • 142
  • 246
  • Can you show your stacktrace from the error? – Jonas Aug 25 '11 at 06:32
  • java.lang.NoSuchMethodError: org.joda.time.DateTime.(IIIIII)V this is all I have – hudi Aug 25 '11 at 06:54
  • According to your calls, the SIX-argument constructor works but the SEVEN-argument constructor does not. The first part of the question is inconsistent as it mentions a FIVE and SIX-argument constructor. Just FYI; I believe the last part is correct, but you should fix this anyway. – Ray Toal Aug 25 '11 at 07:31

1 Answers1

6

The constructors with 5 and 6 integer arguments were added in Joda-Time 2.0. The 7 integer argument constructor has been there a long time.

Check your version of Joda-Time.

You may be using an earlier one.

UPDATE In response to the comment about it working in JUnit but not when deployed in WebLogic, I can only stand by the version argument.

In WebLogic, examine your jar (use jar -tf). Look inside for old Joda-Time versions. Perhaps WebLogic put them there by default. Or if not in your jar, look in WebLogic's container class library. Check your classpath, or JRE extensions directory. Look everywhere you can, because, well, the version argument makes sense. How else would a NoSuchMethodError occur?

Ray Toal
  • 86,166
  • 18
  • 182
  • 232
  • yes I know and I am using version 2.0 joda-time joda-time 2.0 – hudi Aug 25 '11 at 06:55
  • Interesting. Can you edit your question to show the exact constructor invocation please? – Ray Toal Aug 25 '11 at 07:00
  • when I run JUnit test to test this method it works but when I deploy this on weblogic then it thrown exception – hudi Aug 25 '11 at 07:27
  • Maybe weblogic is using another version in classpath than you?! – flash Aug 25 '11 at 07:33
  • That's the only explanation I can think of, @flash. WebLogic like all containers allows a classpath for JARs outside the war. But in this case the war should take precedence I would hope, but who knows. I suspect the deployment descriptor for the war was incorrect, but the OP needs to look everywhere just in case. – Ray Toal Aug 25 '11 at 07:39
  • my aplications WEB-INF/lib/joda-time-2.0.jar I just found this library :( – hudi Aug 25 '11 at 08:26
  • 1
    but in weblogic path I found joda.time1.2.1.0. How I can exclude this jar from weblogic path except I deleted it or how to say to weblogic to use my jar :) ? PS: when I deleted this jar it works thx guys but I need more elegant solution. – hudi Aug 25 '11 at 08:29
  • I think it would be best to delete it from the WebLogic server classpath and _replace_ it with 2.0. Short of that, you might try looking for ways to set the order of classpath entries so that the Joda-Time in your war _takes precedence over_ the "default" jars in your server classpath. – Ray Toal Aug 25 '11 at 08:34
  • 1
    Check this answer: http://stackoverflow.com/a/14936333/787375. Adding this line to `weblogic.xml`, does the trick: `org.joda.*`. Worked for me! – jelies Feb 18 '13 at 15:16