0 Replies Latest reply on May 14, 2002 9:23 AM by Christian Faucher

    java.lang.LinkageError when Running WAR file

    Christian Faucher Newbie

      Hello fellows,

      I have a weird java.lang.Linkage exception when running a WebApp. I run JBoss 3.0 with Tomcat 4.0.1. The same WebApp runs fine on another AppServer, which runs Tomcat 3.2.3.

      I looked around on this forum, on Tomcat and on theserverside.com, but I found nothing specific about my problem.

      Here are some code snippets of my code.

      I have an interface:

      public interface MyInterface {
      public void myMethod(String param);
      }

      I have a class that implements MyInterface:

      public class MyClass implements MyInterface {
      ...
      }

      Both classes are stored in a first JAR file in
      WEB-INF/lib on my web app.


      I have a Struts ActionForm, where I do:

      public class MyActionForm ... {
      ...
      public void validate(...) {
      MyClass myInstance = new MyClass();
      myInstance.myMethod(param);
      }

      The ActionForm, and all Struts classes (other actions, forms, etc.) are in a second JAR file, also in WEB-INF/lib.


      When calling myMethod(param), I get the LinkageError. Here is the exact message, with the real stack trace of my code. Validator.class is my interface, and "MyClass" is a validator implementation for a specific type (a String in this case).


      java.lang.LinkageError: loader constraints violated when linking com/govictor/vsc/common/validation/Validator class
      at com.govictor.vsc.webapp.resource.AddModifyResourceForm.validate(AddModifyResourceForm.java:173)
      at com.govictor.vsc.webapp.company.AddModifyCompaniesForm.validate(AddModifyCompaniesForm.java:190)
      at org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java:2106)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
      at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
      at java.lang.Thread.run(Thread.java:484)

      I have the following jar files in WEB-INF/lib:
      - myjar1.jar (which contains MyClass and MyInterface).
      - myjar2.jar (which contains my Struts stuff)
      - strutsExt.jar
      - struts.jar
      - log4j.jar
      - gsutil.jar (home-made library).
      - GLUE-STD.jar (Web service stuff).

      Thank you in advance for your help!!!
      Christian Faucher