3 Replies Latest reply on Oct 23, 2006 4:35 PM by jdr

    jsp:usebean and loader constraints violated

    jdr

      hi,

      I got a data transfer object that gets passed from an ejb to a jsp.
      If I do not put the class of my data transfer object in my war file,
      I get an error compiling the jsp because it doesn't find the class.
      If I do mut the class in my war file, i get the dreaded "loader constraints violated when linking..."
      exception in the servlet that got the dto from
      the ejb. (i guess it gets the class from both the war and the ear?)

      help!

      john

        • 1. Re: jsp:usebean and loader constraints violated
          jaikiran

          When you remove the class from the war, where else do you place it? I mean, where else inside the ear is the class placed? Are you placing it in some jar inside the ear?

          A probable solution will be - you can create a jar(lets name it common-util.jar) containing that class(and other such common classes) and place it inside the ear file and remove those classes from the war. Then in the application.xml file(present in META-INF folder of ear), you will have to add the following entry:

          <module>
           <java>common-util.jar</java>
          </module>


          • 2. Re: jsp:usebean and loader constraints violated
            jdr

             

            When you remove the class from the war, where else do you place it? I mean, where else inside the ear is the class placed? Are you placing it in some jar inside the ear?

            Yes, it's there in a jar with all my ejb classes.
            <module>
             <java>common-util.jar</java>
            </module>

            Alas, the loader constraints violated when linking error (in the servlet that is in the war) persists. I think this jar is loaded both by the war and ear classloader and its classes are considered different because of that.

            The pain is that the servlet seams to see the jar from the ear file but the jsp compiler doesn't.

            (jboss 4.0.4GA)

            john

            • 3. Re: jsp:usebean and loader constraints violated
              jdr

              well the exact error in the jsp compilation was: The value for the useBean class attribute xxx is invalid.
              this did not mean the class was not found, but missed a default constructor GRRR
              Sorry for wasting your time.

              john