Thursday, November 13, 2008

Loader constraints violations

During development, on application redeploy, I was seeing an error like this:

Java5:
15:27:34,647 WARN  [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=heart-biz.jar
java.lang.LinkageError: loader constraints violated when linking com/kink/heart/biz/admin/i/LiveShowData class

Java6 (it seems they tried to improve the error a bit):
15:15:46,205 WARN  [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=heart-biz.jar
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "com.kink.heart.biz.content.ContentMgrBean.getLiveShow(Ljava/lang/Long;)Lcom/kink/heart/biz/admin/i/LiveShowData;" the class loader (instance of org/jboss/mx/loading/UnifiedClassLoader3) of the current class, com/kink/heart/biz/content/ContentMgrBean, and the class loader (instance of org/jboss/mx/loading/UnifiedClassLoader3) for interface com/kink/heart/biz/content/i/ContentMgr have different Class objects for the type com/kink/heart/biz/admin/i/LiveShowData used in the signature

Well, after finding this JBoss FAQ page, I followed the directions on it. They were really helpful!

Once I looked up the offending class (LiveShowData), it became instantly clear what the problem was:

### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@8f036f{ url=file:/Users/jonstevens/checkout/jboss-heart/server/default/tmp/deploy/tmp54117z-ads.ear ,addedOrder=40}

### Instance1 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@d19a10{ url=file:/Users/jonstevens/checkout/jboss-heart/server/default/tmp/deploy/tmp54118heart.ear ,addedOrder=41}

Sync up the two jar's which contain my EJB3 interfaces and suddenly everything is working again.

3 comments:

Andrew C. Oliver said...

You love content on a wiki started originally by me. This means I win the wiki argument we had years ago :-)

Jon Scott Stevens said...

You win! Thanks Andrew!

If only ServiceController just included a link to that page in the exception message. =)

Andrew C. Oliver said...

except they replaced my wonderful wiki with sensible names with one that names things DOC-12342134 :-(

Yeah really. JBoss error messages suck. How are things? dumb question, you get to work in porn :-)