5 Replies Latest reply on Jan 29, 2008 11:40 AM by lorenzbeyeler

    ArrayStoreException when accessing bean from war

    lorenzbeyeler

      Hello
      I'm trying to use a bean with the following signature:

      public ReturnDto<PartnerLight[]> searchPartner(...)


      When testing this bean with jUnit, it works perfectly, but when
      I'm trying to access this bean from a war deployed on the same server,
      I get an ArrayStoreException.

      I'm using JBoss 4.2.1 with Sun JDK 1.5.0_013.

      Any ideas?

      Thanks in advance
      Lorenz Beyeler

        • 1. Re: ArrayStoreException when accessing bean from war
          jaikiran

          As per the javadocs of ArrayStoreException:

          Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. For example, the following code generates an ArrayStoreException:

          Object x[] = new String[3];
          x[0] = new Integer(0);


          You say that it works with JUnit and not from a war deployed in the server. Is this war a different application? How are you applications packaged?

          • 2. Re: ArrayStoreException when accessing bean from war
            lorenzbeyeler

            The applications are packaged as follows:
            one .EAR (A) with 3 stateless session beans
            one .EAR (B) with 1 stateless session bean and a web-service server deployed in a .WAR.

            The webservice from (B) reads objects from two of the beans in (A). Requests without 'generics' in the interface work perfectly.

            And yes, accessing the beans in (B) from jUnit works even with 'generics'.

            And, by the way, the same configuration works flawlessly on AIX with
            Websphere 6.1 (SP 11?), so I think it's something JBoss-specific.

            Thanks,
            Lorenz

            • 3. Re: ArrayStoreException when accessing bean from war
              lorenzbeyeler

              I changed the packaging: all beans and the .WAR are now deployed in one .EAR - and it works.

              Regards, Lorenz

              • 4. Re: ArrayStoreException when accessing bean from war
                lorenzbeyeler

                Please disregard my previous post - it still doesn't work!

                The configuration now is:
                one .EAR with
                4 stateless session beans
                2 .WAR's (jax-ws webservice servers)

                I just wonder, is this something that should work on JBoss
                or is it (not yet) supported?

                Thanks for any ideas!
                Lorenz

                • 5. Re: ArrayStoreException when accessing bean from war
                  lorenzbeyeler

                  I have finally found the problem:
                  The jar-files (commons-lang.jar, some application DTO
                  and helper classes) were in the web-inf directory of
                  the war file. The classpath in the manifest.mf file was
                  not set.

                  After moving the jars to the .ear file and setting the
                  classpath, everying works as desired.

                  JBoss seems to be more demanding concerning the
                  classpath than Websphere.

                  Regards,
                  Lorenz Beyeler