10 Replies Latest reply on Oct 15, 2003 9:02 AM by rgc3679


    Jan Nielsen Newbie

      Hi. I have an .ear file containing and EJB jar and some other jar files that it depends on, among them mail.jar (JavaMail 1.3). It deploys fine, but when I redeploy the file and I invoke methods on my EJB, this exception is thrown:

      16:45:29,266 ERROR [Buy3Action] Error talking to order EJB.
      java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: null; CausedByException is:
      loader constraints violated when linking javax/mail/Address class; nested exception is:
      java.lang.LinkageError: loader constraints violated when linking javax/mail/Address class
      at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:360)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:212)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:738)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:99)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy233.sendMail(Unknown Source)

      I need to restart JBoss to fix the problem. Has anyone got a clue what is wrong?

        • 1. Re: java.lang.LinkageError
          Harald Gliebe Novice

          JavaMail 1.3 is already in server/default/lib. Can you redeploy your ear if you remove this jar from the ear?


          • 2. Re: java.lang.LinkageError
            ghamamgian Newbie

            We are actually having this problem as well but with ut own internal classes. When we redeploy our ear, the class loader vomits. When I look at the JMX Console, i notice that the ResourceAdapter from our ear is still listed in the jboss.managment.local section, even after we undeployed the ear.

            • 3. Re: java.lang.LinkageError
              Bernd Zeitler Expert

              Be sure you have listed all your components in your application.xml properly. And be sure you have listed all your dependent jars for j2ee components in the Class-Path entry of your manifest file.


              • 4. Re: java.lang.LinkageError
                Jan Nielsen Newbie

                I removed my mail.jar but then it just complains at another time. It doesn't seem to be consistens on the first re-deployment, it may happen anytime.

                I have made sure that all contained jar files are mentioned in app.xml, but it doesn't make a difference.

                The latest exception is:

                13:29:06,095 ERROR [BaseAction] Action error.
                java.lang.LinkageError: Class dk/xxx/projects/site/j2ee/ejb/session/invoice/XxxInvoiceHome violates loader constraints
                at dk.xxx.projects.site.j2ee.webapp.struts.invoice.action.InvoiceAction.doPerform(InvoiceAction.java:72)
                at dk.xxx.util.struts.base.BaseAction.perform(BaseAction.java:50)
                at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
                at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
                at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
                at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
                at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
                at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
                at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
                at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
                at org.mortbay.http.HttpServer.service(HttpServer.java:863)
                at org.jboss.jetty.Jetty.service(Jetty.java:460)
                at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
                at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
                at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
                at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
                at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
                at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

                • 5. Re: java.lang.LinkageError
                  Bernd Zeitler Expert

                  Did you list the dependent jars in the Class-Path of the manifest file (ejb jars) as mentioned above?
                  Deploy all the resources with your ear, use jboss-app.xml to configure an own class loader repository for your ear and java2ParentDelegaton=false .

                  This should work fine.


                  • 6. Re: java.lang.LinkageError
                    Jan Nielsen Newbie

                    I have absolutely no clue about what you're talking about so I guess I need to read some documentation for it. Would you please kindly point me to a source of documentation for this?

                    • 7. Re: java.lang.LinkageError
                      Bernd Zeitler Expert

                      Some very useful information:
                      JBoss classloading:

                      J2EE spec (chapter 8) Application Assembly And Deployment:

                      And of course the JBoss forum ;-)


                      • 8. Re: java.lang.LinkageError
                        rgc3679 Newbie

                        I wonder if normann ever got this working? I have the same problem,and have tried adding a manifest but it's still not working.

                        I'm using JBoss 3.0.4 on Linux.

                        My EAR has a server.jar, and a client.war. Both server.jar and client.war use mail.jar.

                        If I deploy the EAR and try to use the mail classes I get a linkage error.

                        If I remove the mail.jar from JBoss' default/lib and restart JBoss then my app works ok. Problem is, in order to redeploy my EAR I have to always restart JBoss.

                        Here's what my manifest.mf looks like:

                        Manifest-Version: 1.0
                        Created-By: Apache Ant 1.5.1
                        server.jar Class-Path: mail.jar
                        client.war Class-Path: mail.jar

                        The manifest is placed at same level as server.jar and client.war - in other words, it's not in a meta-inf dir because the deployer kept complaining about not finding meta-inf/application.xml.

                        Any ideas?



                        • 9. Re: java.lang.LinkageError
                          rgc3679 Newbie

                          This problem is solved.

                          My manifest had problems, once these were fixed the linkage problem went away.

                          Thanks to IntelliJ for having such a helpful tool!


                          • 10. Re: java.lang.LinkageError
                            rgc3679 Newbie

                            Here's the manifest that works for me:

                            Manifest-Version: 1.0
                            Class-Path: ../lib/mail.jar