8 Replies Latest reply on Feb 4, 2016 1:14 AM by stanlysunil

    "Package does not exist" exception in ear deployment

    mrojasaquino1

      Hello.

       

      I'm migrating an application from JBoss 4.2.3 to JBoss 7.1.1. I've finally managed to build my ear the right way and my app is now almos working, except there is a class loading (i think) issue. My ear has the following structure:

       

      myapp.ear

      |

      +-META-INF

      | |

      | +-application.xml

      | |

      | +-MANIFEST.MH

      |

      +-lib

      | |

      | +-(several shared jars)

      |

      +-application1.war

      | |

      | +-WEB-INF

      | |

      | +-lib

      | | |

      | | +-(local libraries)

      | |

      | +-classes

      |

      + application1.war

        |

        +-lib

        | |

        | +-(local libraries)

        |

        +-classes

       

      So inside of each WAR there are several classes (mine) that use local JARs as well as deployment level JARs, but some of those deployment level jars seems to be not visible in some cases. Form example: I'm using DynamicReports (http://www.dynamicreports.org/) to generate some listings on the fly to be exported as CSV, PDF or XLS files, but I'm getting a "package net.sf.jasperreports.engine does not exist". If I put all of the JARs in the deploymnet lib directory into the WEB-INF/lib directory of one of those WARs the exception is gone and the reports get generated. I've look into several posts and googled about this issue (jboss-depĺoyment-structure.xml, Class-Path manifest property ...) but none seems to be working in this specific case. I want to avoid putting all in my WEB-INF/lib directory, as I need to share libraries between my two WARs, and it'll be easier for the dev environment to handle WARs and global JARs as in our previous environment (with JBoss 4.2.3)

       

      So thanks in advance for your pointers, and best regards.

        • 1. Re: "Package does not exist" exception in ear deployment
          sfcoy

          You basic structure looks correct and it should work.

           

          How are you building your application?

           

          Are you deploying from eclipse? Eclipse will sometimes put things where they do not belong.

          • 2. Re: "Package does not exist" exception in ear deployment
            mrojasaquino1

            Hi Stephen.

             

            I'm building my ear with ant. Additional info: the JARs in the ear/lib directory are packaged using ant too, as some of them are from our own classes and others are from repackaging several third party libraries.

             

            Regards.

            • 3. Re: "Package does not exist" exception in ear deployment
              sfcoy

              Please show:

               

              1. The output of jar -tf myapp.ear
              2. The complete stack trace
              • 4. Re: "Package does not exist" exception in ear deployment
                mrojasaquino1

                I'm attaching a file with the begining of the stack trace and the output of jar tf

                 

                Stack Trace:

                -----------------------------------------------------------

                16:54:56.557           stderr.write: net.sf.dynamicreports.report.exception.DRException: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: [28]

                16:54:56.564           stderr.write: //MyApp/utils/Report_1353452095884_552672.java:4: package net.sf.jasperreports.engine does not exist [28]

                16:54:56.565           stderr.write: import net.sf.jasperreports.engine.*; [28]

                16:54:56.565           stderr.write: ^ [28]

                16:54:56.565           stderr.write: //MyApp/utils/Report_1353452095884_552672.java:5: package net.sf.jasperreports.engine.fill does not exist [28]

                16:54:56.566           stderr.write: import net.sf.jasperreports.engine.fill.*; [28]

                16:54:56.566           stderr.write: ^ [28]

                16:54:56.566           stderr.write: //MyApp/utils/Report_1353452095884_552672.java:18: cannot find symbol [28]

                16:54:56.568           stderr.write: symbol: class JREvaluator [28]

                16:54:56.573           stderr.write: public class Report_1353452095884_552672 extends JREvaluator [28]

                16:54:56.574           stderr.write:                                                  ^ [28]

                16:54:56.575           stderr.write: symbol  : class JRFillParameter [28]

                16:54:56.575           stderr.write: location: class Report_1353452095884_552672 [28]

                16:54:56.575           stderr.write:     private JRFillParameter parameter_REPORT_LOCALE = null; [28]

                16:54:56.576           stderr.write:             ^ [28]

                16:54:56.576           stderr.write: //MyApp/utils/Report_1353452095884_552672.java:26: cannot find symbol [28]

                16:54:56.580           stderr.write: symbol  : class JRFillParameter [28]

                16:54:56.581           stderr.write: location: class Report_1353452095884_552672 [28]

                16:54:56.581           stderr.write:     private JRFillParameter parameter_CUSTOM_VALUES = null; [28]

                16:54:56.583           stderr.write:             ^ [28]

                16:54:56.592           stderr.write: //MyApp/utils/Report_1353452095884_552672.java:27: cannot find symbol [28]

                16:54:56.592           stderr.write: symbol  : class JRFillParameter [28]

                16:54:56.592           stderr.write: location: class Report_1353452095884_552672 [28]

                16:54:56.593           stderr.write:     private JRFillParameter parameter_JASPER_REPORT = null; [28]

                16:54:56.595           stderr.write:             ^ [28]

                16:54:56.597           stderr.write: //MyApp/utils/Report_1353452095884_552672.java:28: cannot find symbol [28]

                16:54:56.598           stderr.write: symbol  : class JRFillParameter [28]

                16:54:56.599           stderr.write: location: class Report_1353452095884_552672 [28]

                16:54:56.601           stderr.write:     private JRFillParameter parameter_REPORT_VIRTUALIZER = null; [28]

                16:54:56.601           stderr.write:             ^ [28]

                 

                   repeats the same several times ....

                 

                -----------------------------------------------------------

                 

                 

                 

                jar tf myapp.ear

                META-INF/

                META-INF/MANIFEST.MF

                META-INF/application.xml

                lib/

                MyApp.war

                MyAppMonitor.war

                lib/MainJar.jar

                lib/MyAppSLib.jar

                lib/ij.jar

                lib/myapp_c3p0.jar

                lib/myapp_commons.jar

                lib/myapp_jasper.jar

                lib/myapp_struts.jar

                lib/myapp_utils.jar

                lib/myapp_ws.jar

                lib/oracle.jar

                lib/postgresql.jar

                liverebel.xml

                 

                 

                I've modified the names of my wars and some jars due to company policies.

                 

                The JasperReports and DynamicReports classes are contained un myapp_jasper.jar. The classes that use those functionality are contained in MyApp.ear/WEB-INF/classes. Funny thing is that database access seems to be working ok as well as my bussiness logic classes contained in MainJar.jar when invoked from MyApp.ear/WEB-INF/classes too.

                 

                Regards.

                • 5. Re: "Package does not exist" exception in ear deployment
                  sfcoy

                  Have a look at jar tf myapp_jasper.jar and ensure that it is correctly repackaged.

                  • 6. Re: "Package does not exist" exception in ear deployment
                    mrojasaquino1

                    Well, it seems to include all the classes from JasperReports and DynamicReports, "jar tf" doesn't complain and several other reports (not involving DynamicReports) seem to be working.

                    • 7. Re: "Package does not exist" exception in ear deployment
                      mrojasaquino1

                      Well, it seems that someone else is having the same problem as I, as in the statistics this post seems to be getting several hits. The solution that worked for me was disabling the JDT compiler included in JBoss 7.1.1, as it clashes with the one included in our deployment, and as we're not using JSPs disablen JBoss' JDT is not an issue.

                       

                      To do this I've commented out the Jasper JDT part in the jboss/modules/org/jboss/as/web/main/module.xml:

                       

                      <resources>
                               <resource-root path="jboss-as-web-7.1.1.Final.jar"/>
                               <!--resource-root path="jasper-jdt-7.0.3.Final.jar"/-->
                               <resource-root path="jbossweb-7.0.13.Final.jar"/>
                               <!-- Insert resources here -->
                      </resources>

                       

                      Maybe there is a better solution, but in the mean time this is the one that worked for us.

                       

                      Regards.

                      • 8. Re: "Package does not exist" exception in ear deployment
                        stanlysunil

                        I have tried the suggested workaround provided. Jasper is working fine now. But I am getting other exception, Jsp compilation getting failed.

                         

                        java.lang.IllegalStateException: JBWEB004000: No Java compiler available

                        org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:242)

                        org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:601)

                        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)

                        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:309)

                        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:242)

                        javax.servlet.http.HttpServlet.service(HttpServlet.java:847)