title: Getting java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [LBlndItmTmMthd
body: <p>I need a serious help in this issue. May be its very basic, but, I am not able to figure it out. I have a session EJB with one method which returns an enum array, i.e. <code>BlndItmTmMthd</code> array. When, I call the method in the client side, it gives me a <code>ClassCastException</code>.</p>
  
  <pre><code>java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [LBlndItmTmMthd
  </code></pre>
  
  <p>While debugging, I have found that the ejb method is correctly returning <code>BlndItmTmMthd</code> array by calling <code>BlndItmTmMthd.values()</code>. I am not able to find out the reason. Any idea will be helpful.</p>
  
  <p><strong>Added content from a comment below</strong><br>
  AgreementSession.java is the EJB interface which contains the following method declaration:</p>
  
  <pre><code>BlndItmTmMthd[] getAllBlendedItemTimingMethods(); 
  </code></pre>
  
  <p>AgreementSessionEJB.java is the EJB that implements it. </p>
  
  <pre><code>public BlndItmTmMthd[] getAllBlendedItemTimingMethods() { 
      BlndItmTmMthd[] blendedItemTmingMethods = BlndItmTmMthd.values(); 
      return blendedItemTmingMethods; 
  }
  </code></pre>
  
  <p>Now, at the client side, when I invoke the EJB method with the following code:</p>
  
  <pre><code>BlndItmTmMthd[] _timingMethods = 
               getLoanScheduleSetupSession().getAllBlendedItemTimingMethods(); 
  </code></pre>
  
  <p>I get that runtime exception.</p>