2 Replies Latest reply on Mar 12, 2004 1:23 AM by eric dunn

    HOWTO - Having an EAR only use the jars packaged with it

    eric dunn Newbie

      Hi,
      I am getting an issue where two ear files have packaged in them some common jars for the servlets to use.

      When I (re)deploy them both I get classcastexceptions becuase they are looking at the other ear's jars.

      Is there a way I can get the EAR to take priority the jars contained in the ear and not in other ears? Like some jboss xml setting?

      Thanks,
      Eric

        • 1. Re: HOWTO - Having an EAR only use the jars packaged with it
          jae Master

          if the shared jars are the same between the two ears, then you should extract them out and deploy them seperately.

          if they are not the same (different versions perhaps), you can scope both of the ears using a loader repository.

          • 2. Re: HOWTO - Having an EAR only use the jars packaged with it
            eric dunn Newbie

            I added the jboss-app.xml file to the meta-inf and now when I enter the URL for my jsp page I get a :

            22:35:21,468 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for ser
            vlet jsp threw exception
            org.apache.jasper.JasperException: Unable to compile class for JSP
            at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext
            .java:478)

            ....

            java.lang.ClassCastException
            at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
            at org.apache.taglibs.standard.tlv.JstlBaseTLV.validate(JstlBaseTLV.java
            :177)
            at org.apache.taglibs.standard.tlv.JstlCoreTLV.validate(JstlCoreTLV.java
            :137)

            I looked at a the DTD for the xml file and a couple web sites and it looks like my syntax is right. See below:

            <?xml version="1.0" encoding="ISO-8859-1"?>
            <!DOCTYPE jboss-app PUBLIC '-//JBoss//DTD J2EE Application 1.3V2//EN' 'http://www.jboss.org/j2ee/dtd/jboss-app_3_2.dtd'>
            <jboss-app>
            <loader-repository>www.somecompany.com:loader=LicenseGenerator.ear</loader-repository>
            </jboss-app>

            I tried to take out the loader-repository element and I do not get the error anymore so it is likely something to do with it. Anybody have any ideas?

            Thanks,
            Eric