title: Why do I get a NoSuchMethodError on JodaTime.withYear()?
body: <p>I have a maven web app project, where I use JodaTime. JodaTime is not directly referenced in my maven project, but is a part of a transitive dependency. In other words, my web app war, has another project of mine as a direct dependency, and that jar contains JodaTime.</p>
  
  <p>I am getting an error after executing these two lines. It compiles fine though.</p>
  
  <pre><code>DateTime firstDate = new DateTime();
  firstDate = firstDate.withYear(2016);
  </code></pre>
  
  <p>And here is my error:</p>
  
  <pre><code>java.lang.NoSuchMethodError: org.joda.time.DateTime.withYear(I)Lorg/joda/time/DateTime;
  </code></pre>
  
  <p>I know that these kinds of errors can happen if I compile and run with different versions of a library, like <a href="https://stackoverflow.com/a/35210/1203811">this answer says</a>, but the <code>withYear()</code> has been around since JodaTime 1.3, since 2006, and I can't see that I could ever have imported a version that old. I've even checked my final war-file, and the only JodaTime library present, is 2.9.2.</p>
  
  <p>The two lines runs fine if I create a main-method snippet, and run it from within the same project in eclipse. They only fail upon compilation into a war file, and running from my weblogic 10.3.2 server.</p>
  
  <p>Does anyone have any idea on how I can proceed to debug this one?</p>