1 Reply Latest reply on Feb 11, 2010 6:47 PM by Dan Rush

    Same jar in a different ear's APP-INF/lib affects web app in another ear

    Dan Rush Newbie

      I have 2 web apps deployed in separate ear files running on jboss 4.2.3.GA.  Ear1 has a jar file in its app-inf/lib folder.  Ear2 has the same jar file in one of it's web app's(WAR) web-inf/lib folder.  Ear2's web app throws the below error during normal operation but doesn't throw the error when I remove the jar file from ear1 and restart jboss.  During jboss startup, ear1 deploys before ear2 deploys.  The jar file in question is the exact same one in both ears.  Why does my jms consumer think the object is not what was expected?  The source snippet(line 91) is below also.

       

      09:23:08,124 WARN  [SpyMessageConsumer] Message listener mil.jpmis.cbrnis.client.service.modeling.TaskStatusJMSConsumer@
      77ff61 threw a throwable.
      java.lang.ArrayStoreException: mil.jpmis.jem.mn.task.cbws.AgentData
              at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
              at org.jboss.mq.SpyObjectMessage.getObject(SpyObjectMessage.java:147)
              at mil.jpmis.cbrnis.client.service.modeling.TaskStatusJMSConsumer.onMessage(TaskStatusJMSConsumer.java:91)
              at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:697)
              at java.lang.Thread.run(Thread.java:619)

       

       

       

      public void onMessage(Message message) {

       

       

           if(message instanceof ObjectMessage ) {

              ObjectMessage objMsg = (ObjectMessage )message;

       

              try {

       

                 if(objMsg.getObject() instanceof IRunRequestStatus) {      <--------  line 91 of TaskStatusJMSConsumer

        • 1. Re: Same jar in a different ear's APP-INF/lib affects web app in another ear
          Dan Rush Newbie

          I fixed this classloader issue by adding a jboss-app.xml in ear1's META-INF folder that looks like this:

           

          <jboss-app>
             <loader-repository>
             IB:archive=ib.ear
                <loader-repository-config>
                    java2ParentDelegation=true
                </loader-repository-config>
             </loader-repository>
          </jboss-app>

           

          the loader-repository tag told jboss to only look in ib.ear file for jars.  the loader-repository-config tag must have said look in server/lib if not found in ib.ear.  I had to have both tags for it to work.