10 Replies Latest reply on Nov 30, 2009 7:15 PM by Jose Miguel Loor

    Deploy multiple Seam-EARs to a single JBoss AS

    Mike Schulze Newbie

      Hi - I have a problem with deploying my Seam-Apps (2.0.2SP1) to my JBoss AS (4.2.2).

      I have two Seam-EAR-Projects and want to deploy them to a JBoss AS. If I only deploy one of them it works fine, but if I deploy both of them at the same time I get a ClassCastException if I start one of those applications.

      More details:

      EAR1 (AppA) consists of a WAR (WAR1) and an JAR
      EAR2 (AppB) consists of a WAR (WAR2) and the same JAR

      During the startup of an application an EJB (Manager) initializes a Seam-Component a runs a method from this component. In this method there is a call to a database to retrieve a certain entity (Cient):

      Object o = em.createQuery("SELECT c FROM Client c WHERE c.clientcode =:clientcode").setParameter("clientcode", clientcode).getSingleResult();
      result = (Client) o;

      The Exception occurs during the cast in the second line, although the retrieved object IS a client-object. (it works if only one EAR is deployed)

      The error only occurs in AppA - because it seems to be loaded earlier by the AS (i guess). AppB seems to work fine. If I rename AppA to AppC the exception occurs in AppB. :-( All involving classes (Bean, Seam-Component, POJO/Entity) are located within the JAR.

      I thought the is something wron with my classloader - but in the JMX-console i can see that ther two of them (org.jboss.mx.loading.HeirarchicalLoaderRepository3) one for every EAR.

      Does anybody have a clue where I could look or what my problem is?
      Is it possible to deploy multiple Seam Applications to an Application Server?

      Thx - Mike