3 Replies Latest reply: Aug 26, 2011 8:45 AM by Ales Justin RSS

JBoss 6.1:  Isolating ears from each other

Greg Jewell Newbie

Hello,

 

I have two ears deployed in the default server of JBoss 6.1.  One of the ears (call it service.ear) provides a service to retrieve data from an external source and to translate it to a different structure.  The other ear (call it client.ear) utilizes this service.  As a result, the client ear contains the class definition the service ear translates the data to.  Additionally, the jars that contains the translated data structure class is deployed as an EJB in both the client and service ears.

 

Naturally, this is causing problems.  I am getting the dreaded "expected class Data but got class Data" exception.  I've tried many configurations of jboss-classloading.xml and jboss-classloading-domain.xml, but the only thing that I can get to work is the "sledgehammer" jboss-classloading configuration:

 

<classloading xmlns="urn:jboss:classloading:1.0"

    domain="DefaultDomain"

    export-all="NON_EMPTY"

    import-all="true"

    parent-first="true">

</classloading>

 

As you can imagine, I really don't want this configuration.  Can someone provide to me sample files that I need to place in my various ear files that will prevent this error from occurring?  I've tried giving each ear their own domain, setting import-all to false, and parent-first to false, but none of those appear to resolve the issue.  I've also tried adding jboss-classloading-domain.xml, but I don't understand that well enough.

 

 

Thanks!

  • 1. Re: JBoss 6.1:  Isolating ears from each other
    Ales Justin Master

    <classloading xmlns="urn:jboss:classloading:1.0"

        domain="My_Shared_Domain"

        export-all="NON_EMPTY"

        import-all="true" />

    What about if you simply give both the same domain?

    Then this CL domain is shared between both, hence classes should be visible.

  • 2. Re: JBoss 6.1:  Isolating ears from each other
    Greg Jewell Newbie

    Thank you for the quick response, Ales.  Later in the evening, that idea occurred to me, and it does work.  Fortunately, I don't have to worry about different versions of software embedded into these ears, so this solution should be sufficient in this case.  In the future, if I do have to worry about different versions of software, do you know how I would be able to completely isolate the ears from each other?

     

    Thanks again!

  • 3. Re: JBoss 6.1:  Isolating ears from each other
    Ales Justin Master

    In the future, if I do have to worry about different versions of software, do you know how I would be able to completely isolate the ears from each other?

    .ears are fully isolated by default in AS6.

     

    To have both, some shared bits and some "isolated" (hidden from the other),

    you would have to put more effort into CL domain creation / filtering.