6 Replies Latest reply on Mar 7, 2008 7:18 AM by jaikiran pai

    [Help] Resources In Jars in Deployment EAR

    Michael Nguyen Newbie

      I am attempting to adapt my company's product for deployment on JBoss. We are currently capable of easy deployment with the WebSphere and Weblogic application servers and are looking to expand it's compatibility and ease of use.

      Our product uses several properties and XML schema files which are bundled within jar files that, such as config.jar and schemas.jar. These files are then added to the EAR as part of the deployment.

      When I attempt to start the server and deploy the EAR, I get errors stating that the XML schemas cannot be found. This leads me to believe that our CatalogManager.properties cannot be found, even thought it in the ear.

      The error starts out like:

      17:39:02,391 INFO [ProxyFactory] Bound EJB Home 'P12StorageDataAccess' to jndi 'P12_STORAGE_DATA_ACCESS'
      17:39:04,825 INFO [EJBDeployer] Deployed: file:/opt/jboss/server/default/tmp/deploy/tmp38619.ear-contents/ejb.jar
      17:39:05,479 INFO [ProxyFactory] Bound EJB Home 'FailedTolecResponseDataAccessSession' to jndi 'FAILED_TOLEC_RESPONSE_SESSION'
      17:39:06,658 INFO [EJBDeployer] Deployed: file:/opt/jboss/server/default/tmp/deploy/tmp38619.ear-contents/ejb2.jar
      17:39:06,762 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../tmp/deploy/tmp38619.ear-contents/cc-exp.war/
      17:39:12,558 ERROR [STDERR] Cannot find CatalogManager.properties
      17:39:18,601 WARN [XMLUtilsImpl] ** Warning, line 6, uri file:///var/testharness/dtdCache/
       org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://localhost/workbench/2005/10/31/webapp.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
      17:39:18,602 ERROR [XMLUtilsImpl] XMLUtils.createDocument(String) - Exception


        • 1. Re: [Help] Resources In Jars in Deployment EAR
          Michael Nguyen Newbie

           

          "Mazinger" wrote:
          I am attempting to adapt my company's product for deployment on JBoss. We are currently capable of easy deployment with the WebSphere and Weblogic application servers and are looking to expand it's compatibility and ease of use.

          Our product uses several properties and XML schema files which are bundled within jar files that, such as config.jar and schemas.jar. These files are then added to the EAR as part of the deployment.

          When I attempt to start the server and deploy the EAR, I get errors stating that the XML schemas cannot be found. This leads me to believe that our CatalogManager.properties cannot be found, even thought it in the ear.

          The error starts out like:

          17:39:02,391 INFO [ProxyFactory] Bound EJB Home 'P12StorageDataAccess' to jndi 'P12_STORAGE_DATA_ACCESS'
          17:39:04,825 INFO [EJBDeployer] Deployed: file:/opt/jboss/server/default/tmp/deploy/tmp38619.ear-contents/ejb.jar
          17:39:05,479 INFO [ProxyFactory] Bound EJB Home 'FailedTolecResponseDataAccessSession' to jndi 'FAILED_TOLEC_RESPONSE_SESSION'
          17:39:06,658 INFO [EJBDeployer] Deployed: file:/opt/jboss/server/default/tmp/deploy/tmp38619.ear-contents/ejb2.jar
          17:39:06,762 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../tmp/deploy/tmp38619.ear-contents/cc-exp.war/
          17:39:12,558 ERROR [STDERR] Cannot find CatalogManager.properties
          17:39:18,601 WARN [XMLUtilsImpl] ** Warning, line 6, uri file:///var/testharness/dtdCache/
           org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://localhost/workbench/2005/10/31/webapp.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
          17:39:18,602 ERROR [XMLUtilsImpl] XMLUtils.createDocument(String) - Exception


          I feel like I messed something up in my server config, but class loaders are a little outside my realm.

          • 2. Re: [Help] Resources In Jars in Deployment EAR
            jaikiran pai Master

            Which version of JBoss? And how does your code try to load the CatalogManager.properties file? And what are the contents of your application.xml file? Please also post the (probably huge) output of the following command:

            jar -tf myApp.ear


            where myApp.ear is the name of your ear file.

            • 3. Re: [Help] Resources In Jars in Deployment EAR
              Michael Nguyen Newbie

              This is JBoss 4.0.5

              The CatalogManager.properties is being loaded via an encapsulation of the Apache Commons Configuration API. Within the same jar file that contains the various properties files, we store a common-config.xml file that is read in through a .class.getResource("common-config.xml") call. This contains an XML listing of what properties to load.

              I am unfortunately unable to post the output of my EAR to this website, as the information about my software is propietary... In my quoted post, I changed the names of the files in order to mask the product. What were you looking for specifically? I don't think I could post the contents of our EAR without permission. Below is the application.xml for the EAR.

              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
              <application>
               <display-name>ecore-ear</display-name>
               <module>
               <ejb>eebs-ejb-jar-5.1.0.0.jar</ejb>
               </module>
               <module>
               <ejb>adf-ejb-jar-5.1.0.0.jar</ejb>
               </module>
               <module>
               <ejb>tolec-ejb-jar-5.1.0.0.jar</ejb>
               </module>
               <module>
               <ejb>ecore-ejb-jar-5.1.0.0.jar</ejb>
               </module>
               <module>
               <web>
               <web-uri>license.war</web-uri>
               <context-root>/license</context-root>
               </web>
               </module>
               <module>
               <web>
               <web-uri>diagnostic.war</web-uri>
               <context-root>/diagnostic</context-root>
               </web>
               </module>
               <module>
               <web>
               <web-uri>generic.war</web-uri>
               <context-root>/ecore</context-root>
               </web>
               </module>
               <module>
               <web>
               <web-uri>smartsign.war</web-uri>
               <context-root>/smartsign</context-root>
               </web>
               </module>
               <module>
               <web>
               <web-uri>smartsigndemo.war</web-uri>
               <context-root>/smartsigndemo</context-root>
               </web>
               </module>
               <module>
               <web>
               <web-uri>tolec.war</web-uri>
               <context-root>/tolec</context-root>
               </web>
               </module>
               <module>
               <web>
               <web-uri>commandcenter.war</web-uri>
               <context-root>/</context-root>
               </web>
               </module>
              <module id="custom-app-dealertrack">
              <web>
              <web-uri>dealertrack.war</web-uri>
              <context-root>/dealertrack</context-root>
              </web>
              </module>
               <security-role id="SecurityRole_1">
               <role-name>authority-administrator</role-name>
               </security-role>
               <security-role id="SecurityRole_2">
               <role-name>eebsInternalJMSAccess</role-name>
               </security-role>
               <security-role id="SecurityRole_3">
               <role-name>eebsTopicListener</role-name>
               </security-role>
              </application>


              • 4. Re: [Help] Resources In Jars in Deployment EAR
                jaikiran pai Master

                 

                This contains an XML listing of what properties to load.


                And in that xml how do you specify the path/filename of the properties file? I am trying to figure out whether the file is available in the classpath of the application.

                What were you looking for specifically?


                I wanted to make sure that the properties file is available in the classpath. Probably the file is placed in some location in the EAR which does not fall in the classpath. One of the things that you could try is to add the following to your application.xml file:
                <module>
                 <java>mycommon.jar</java>
                 </module>


                where mycommon.jar is the jar that contains the properties and the xml file and is placed at the root of the EAR.

                Do the server.log file (which contains more verbose logs) show any additional information?


                • 5. Re: [Help] Resources In Jars in Deployment EAR
                  Michael Nguyen Newbie

                  No, the server.log's last entry occurs before the error. I'm having some issues with that as well, but that information's showing up in DEBUG, not ERROR, so I'm not concerned, I'd like to get this issue out of the way first...

                  This is the common-config.xml located at the root of one of the JARs bundled in the EAR.

                  <?xml version="1.0" encoding="ISO-8859-1" ?>
                  
                  <configuration>
                   <override>
                   <system/>
                   <propertiesDirectory directoryPath="/usr/local/autodeploy/properties/wl8/"/>
                   <properties fileName="audittrail.properties"/>
                   <properties fileName="event.properties"/>
                   <properties fileName="request.properties"/>
                   <properties fileName="vault.properties"/>
                   <properties fileName="comm-methods.properties"/>
                   <properties fileName="tolec.properties"/>
                   <properties fileName="xml.properties"/>
                   <properties fileName="eCoreDatabase.properties"/>
                   <properties fileName="EOSystem.properties"/>
                   <properties fileName="data-access.properties"/>
                   <properties fileName="DocuGuard.properties"/>
                   <properties fileName="proxyToken.properties"/>
                   <properties fileName="encrypt-alg-map.properties"/>
                   <properties fileName="encryption.properties"/>
                   </override>
                  </configuration>


                  Basically it lists the files to look for in the classpath... The directory is considered an override, which reads in any of those files it finds in that directory on the filesystem, so we do not have to repackage and deploy the EAR each time we make a property change.

                  • 6. Re: [Help] Resources In Jars in Deployment EAR
                    jaikiran pai Master

                    If the common-config.xml is accessible in the classpath, then i guess even the property files which are at the same location should be accessible. Did you try adding the java module to the application.xml? Did it make any difference?