6 Replies Latest reply: Sep 15, 2013 12:39 PM by Lars Hansen RSS

    java.lang.LinkageError: loader constraint violation: loader in Jasper Reports

    Lars Hansen

      Greetings everyone

      I'm using JDeveloper version 11.1.2.3.0 and iReport 5.1.0.

       

      I've created an application where users can upload their own jrxml files, these files gets compiled and stored in the FS. When users need to generate the PDF reports they can select one of the report types from those uploaded and generate the report.

      Everything was working fine at first, but after some tests i've got this error, only on the report filling part:

       

          javax.faces.el.EvaluationException: //C:/Users/Endrik/AppData/Roaming/JDeveloper/system11.1.2.3.39.62.76.1/o.j2ee/drs/ContractManagement/ViewControllerWebApp.war/untitled2.jsf @9,73 action="#{reportBean.userDefinedReport}": java.lang.LinkageError: loader constraint violation: loader (instance of net/sf/jasperreports/engine/util/JRClassLoader) previously initiated loading for a different type with name "org/codehaus/groovy/runtime/callsite/CallSite"

        at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)

        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)

        at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)

        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)

        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)

        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:973)

        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)

        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)

        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)

        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)

        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)

        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)

        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

        at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

        at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)

        at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)

        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)

        at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

        at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)

        at java.security.AccessController.doPrivileged(Native Method)

        at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)

        at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)

        at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)

        at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)

        at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

        at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)

        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)

        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)

        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)

        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)

        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)

        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)

        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)

        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

       

          Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of net/sf/jasperreports/engine/util/JRClassLoader) previously initiated loading for a different type with name "org/codehaus/groovy/runtime/callsite/CallSite"

        at java.lang.Class.getDeclaredMethods0(Native Method)

        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)

        at java.lang.Class.getDeclaredMethods(Class.java:1791)

        at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)

        at java.security.AccessController.doPrivileged(Native Method)

        at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81)

        at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79)

        at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)

        at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)

        at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250)

        at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:338)

        at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:288)

        at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2922)

        at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:176)

        at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)

        at report2_1379060128967_977360.$getStaticMetaClass(calculator_report2_1379060128967_977360)

        at report2_1379060128967_977360.<init>(calculator_report2_1379060128967_977360)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

        at java.lang.Class.newInstance0(Class.java:355)

        at java.lang.Class.newInstance(Class.java:308)

        at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.loadEvaluator(JRAbstractJavaCompiler.java:112)

        at net.sf.jasperreports.engine.design.JRAbstractCompiler.loadEvaluator(JRAbstractCompiler.java:333)

        at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:265)

        at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:457)

        at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:379)

        at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)

        at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)

        at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)

        at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)

        at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:55)

        at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)

        at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:849)

        at al.ikubinfo.contract.view.ReportBean.insert(ReportBean.java:715)

        at al.ikubinfo.contract.view.ReportBean.userDefinedReport(ReportBean.java:625)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at com.sun.el.parser.AstValue.invoke(Unknown Source)

        at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)

        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)

        at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)

        ... 44 more

         

      I've seen several posts about this error, saying that there might be more than one reference to the same jar, or two jars imported with the same dependencies/contents.

      So here is the list of jars i use in my app:

      - groovy-all-2.0.1

      - iText-2.1.7.js2

      - jasperreports-5.1.0

      - jasperreports-fonts-5.0.4

      - poi-3.7 poi-ooxml-3.7

      - commons-io-2.4

      (plus some other commons-* jars not related).

      These are the same i've used when the app was running, plus i've used Jasper before, and never got this error.

      Please help!

      Thanks in advance.

        • 1. Re: java.lang.LinkageError: loader constraint violation: loader in Jasper Reports
          Subramanian Meyyappan

          hi user,

           

          AFAIK error seems to be not releated to ADF. better post japserforum or sourceforge forums they will help you.

           

          I worked with ireport version3.0. but i used the following jar file

          iText, jasperreports, poi,commons-io, some other jars.

           

          i dont see anything like that.

           

          i have few queries with you

          I've created an application where users can upload their own jrxml files, these files gets compiled and stored in the FS.

          end user itself upload jrxml files. those compiles jasper file stored in FS means file server right?


          When users need to generate the PDF reports they can select one of the report types from those uploaded and generate the report.


          report type means .pdf,.xls,.text. something like that

          • 2. Re: java.lang.LinkageError: loader constraint violation: loader in Jasper Reports
            Lars Hansen

            Thank you for your suggestion but i've already tried creating a thread there and nobody did reply, so i was "forced" to try here.

            In reply of your questions:

            1 - Yes i mean in the file server

            2 - by report type actually i meant report template. On upload phase, the app inserts a new row in a table which keeps track of the user defined jrxml files (or to be more specific, it keeps track of the compiled .jasper files, since those are the only one saved in FS.)

            • 3. Re: java.lang.LinkageError: loader constraint violation: loader in Jasper Reports
              Timo Hahn

              The problem seems to be that you try to  access a groovy expression from your groovy-all-2.0.1.jar while the server already has loaded another groovy jar.  This one is the one which comes with adf.  The class loader can't handle both groovy jars and throes the error.

              Try to add the following to your weblogic.xml:

               

                 <container-descriptor>

                    <prefer-web-inf-classes>true</prefer-web-inf-classes>

                 </container-descriptor>

              This hopefully tells the last to first look in the web-inf/lib folder before using jars from its own class path.

               

              Timo

              • 4. Re: java.lang.LinkageError: loader constraint violation: loader in Jasper Reports
                Subramanian Meyyappan

                hi lars,

                 

                  i hope that timo gives exact answer what you are looking for. 'Timo the great'. i did't use the groovy.jar in my development so i'm not facing anyways. good luck man..

                • 5. Re: java.lang.LinkageError: loader constraint violation: loader in Jasper Reports
                  Lars Hansen

                  Greetings Timo.

                  I'm already aware of this behaviour by the server, and as i said, i've been working with jasper reports before. So i've already added that part to weblogic.xml (actually i've created that file my self since it isn't present to any of my applications).

                  I'll now try to create another branch (i use svn, and i was developing this feature in another branch, not the trunk app), and recreate it from the beginning (it's not to much of work ).

                  • 6. Re: java.lang.LinkageError: loader constraint violation: loader in Jasper Reports
                    Lars Hansen

                    Thnx all who replied.

                    I am giving you some information since i've resolved it, and i'm not deleting this post as someone else might find it useful.

                     

                    First,as i said in the original post, it worked fine at first. This is because i was using some blank reports without any data inside, and in the very first try to insert even a static text the above error was erased. It could than work even if you delete the text. This is caused from language property of the report itself  which is Groovy by default. The problem seems to be some kind of duplicate method called from the libraries of groovy and jasperreports imported in the class path.

                    Solution: i've changed the language from Groovy to Java, in the report properties. Then used this static method for the compilation:

                    JasperCompileManager.compileReport(design);

                    This will require to include jdt-compiler in the classpath, you can find it in the JasperReports lib.

                    I hope this post can help others.

                    Kind regards!