2 Replies Latest reply on May 7, 2008 10:28 AM by stourwalk

    shared class for two webapps

      Hello!
      I am trying to share one class between two webapps. First is deployed as a war and second as an ear.
      My first thought was to create this class in a simple jar and put this in server/default/lib. However when I get a shared object of this class I'm getting cast exception, so I think the problem is that this class is loaded by two diferent classloader.
      Whats the best way to share classes in JBOSS?

      Thanks in advance

        • 1. Re: shared class for two webapps

          Solved.
          The way I used works fine. I had a packaging error and I have put the class inside one of the app content so this was the reason way It didnt work

          • 2. Re: shared class for two webapps

             

            "lcurros" wrote:
            Solved.
            The way I used works fine. I had a packaging error and I have put the class inside one of the app content so this was the reason way It didnt work


            Hi,

            could you be more specific about the problem that you had?

            We have a very similar situation where we have a single EAR file which contains APPEJB.jar - this .jar uses struts.jar which is referenced in a seperate project.

            Inside this .EAR file we also have the webcontent.war - this .war naturally also references struts.jar - (we've tried both by having struts.jar in the WEB-INF/libs and by referencing the same external project as APPEJB.jar) - when we try and pass a LabelValueBean from the EJB to the webApp we get a ClassCastException.

            I'm assuming this is because it's getting confused as to which class to use (even if they both reference the same .jar) - how should we package struts.jar in this case (or pass objects between the two sides).

            I've checked the JMX console for org.apache.struts.util.LabelValueBean and it only shows 1 instance being loaded (from the .war file if packaged in there or from the ear if packaged in the common 3rd project)

            We are trying to migrate a legacy application away from Websphere and onto jBoss and this is the last issues that we are struggling with. Any pointers would be gratefully received.


            Thanks
            Chris