7 Replies Latest reply on Sep 8, 2008 3:37 PM by martinator

    Scoped Deployment settings cuase LinkageError

    martinator

      Hi everyone, I'm trying to run multiple scoped single application ear deployments (using servlets) on a single JBoss 3.2.4 server so I can run different release levels at the same time.

      Each app already has the class-loading loader-repository settings (excluding the java2ParentDelegation setting) in the jboss-app.xml file in the web-inf folder of the war file, but that does not make it work.

      I then set the Isolated and CallByValue attribues to true in conf/jboss-service.xml and the Java2ClassLoadingCompliance and UseJBossWebLoader attributes to false in tomcat50.sar/meta-inf/jboss-service.xml. That seems to work fine after the first jboss restart.

      The problem I'm getting is that after a new deployment is added or JBoss is restarted, the apps start up fine, but I get the followng error when I try to access the application URL:

      "java.lang.LinkageError: loader constraints violated when linking javax/servlet/ServletOutputStream class) executing org.apache.jk.common.SocketConnection@3ba002, terminating thread"

      Any ideas would be appreciated.

      Thank you.

        • 1. Re: Scoped Deployment settings cuase LinkageError
          jaikiran

          Do you include jar files containing javax.servlet.* classes in your application packaging? If yes, then remove them from your application package as they are already available in the %JBOSS_HOME%\server\< serverName>\lib folder.

          • 2. Re: Scoped Deployment settings cuase LinkageError
            martinator

            Hi Jaikiran, thanks for your reply/

            No, we do not deploy another copy of servlet.jar. We put all of our jars into the jboss lib folder to keep the size of our deployments down.

            Any other ideas?

            • 3. Re: Scoped Deployment settings cuase LinkageError
              martinator

              Hi again Jaikiran, I did notice that the problem class:

              javax/servlet/ServletOutputStream.class

              resides within servlet.jar which I need for my servlet classes and also within servlet-api.jar which is deployed within the jbossweb-tomcat50.sar folder.

              Do you think that would cause this problem?

              • 4. Re: Scoped Deployment settings cuase LinkageError
                jaikiran

                 

                "Martinator" wrote:
                Hi again Jaikiran, I did notice that the problem class:

                javax/servlet/ServletOutputStream.class

                resides within servlet.jar which I need for my servlet classes and also within servlet-api.jar which is deployed within the jbossweb-tomcat50.sar folder.

                Do you think that would cause this problem?


                Yes that's the problem. Remove the servlet.jar from your application packaging.

                Remember that you can include this jar in the build path for compiling your application. But when you package the application for deployment, dont include this jar file. JBoss already has these classes (as you saw in the servlet-api.jar), so you will not run into any runtime dependency issues even if you remove the servlet.jar from your packaging.


                • 5. Re: Scoped Deployment settings cuase LinkageError
                  martinator

                  Hi again Jaikiran, removing the servlet.jar from the jboss/server/default/lib folder resolved the issue.

                  Thank you so much for your help.

                  Cheers.

                  • 6. Re: Scoped Deployment settings cuase LinkageError
                    jaikiran

                     

                    "Martinator" wrote:
                    Hi again Jaikiran, removing the servlet.jar from the jboss/server/default/lib folder resolved the issue.


                    Good to know that the issue is fixed.

                    "Martinator" wrote:

                    We put all of our jars into the jboss lib folder to keep the size of our deployments down.


                    Just a note of caution - Its not recommended to mess with the jar files in the JBoss server lib folder(s). Ideally, you will package the necessary jar files with your application. The jars in the lib folder of JBoss are used by all the applications deployed on that server (including the ones which are shipped by default by JBoss). So replacing/adding jars in the lib folder of JBoss is always risky.



                    • 7. Re: Scoped Deployment settings cuase LinkageError
                      martinator

                      Thank you for the caution.

                      We distribute a lot of releases to a number of clients and want to avoid shipping 10+ meg or more with each distribution.

                      Is there another place to deploy our jar files permanently without interferring with JBoss?