3 Replies Latest reply on Mar 14, 2012 9:02 AM by tepih78

    External directory in classpath

    colective

      Hi,

       

      im facing that we have external directory lat say /opt/appconfig/config/ with bunch of property files which must be loaded from application

       

      one example is jacorb.properties which came bundled with other config files

       

      Problem is that this file must be in classpath and i dont know how to add such thing and jacorb complains:

       

      22:32:46,051 ERROR [stderr] (http--10.0.0.5-8080-1) #####################################################################

      22:32:46,052 ERROR [stderr] (http--10.0.0.5-8080-1) WARNING: no properties file found! This warning can be ignored

      22:32:46,053 ERROR [stderr] (http--10.0.0.5-8080-1) for applets. A file file called "jacorb.properties" or

      22:32:46,053 ERROR [stderr] (http--10.0.0.5-8080-1) ".jacorb_properties" should be present in the classpath,

      22:32:46,054 ERROR [stderr] (http--10.0.0.5-8080-1) the home directory (/root), the current directory (.) or

      22:32:46,055 ERROR [stderr] (http--10.0.0.5-8080-1) in Javas lib directory (/usr/java/jdk1.6.0_31/jre)

      22:32:46,055 ERROR [stderr] (http--10.0.0.5-8080-1) #####################################################################

      22:32:46,056 ERROR [stderr] (http--10.0.0.5-8080-1)

       

      and log file says..

       

      2012-03-12 16:33:07,982 [http--10.0.0.5-8080-1] ERROR - [C05353] UserStatusConnectorImpl.getIpUserStatus(): IDL:omg.org/CORBA/

      ORB/InvalidName:1.0

      org.omg.CORBA.ORBPackage.InvalidName: IDL:omg.org/CORBA/ORB/InvalidName:1.0

              at org.jacorb.orb.ORB.resolve_initial_references(Unknown Source)

       

       

       

      in Jboss 5 and 6 we could easily add in startup script CLASSPATH and it would work but with Jboss 7 im stuck

       

      i know that this migh be done with creating a module which point to folder but it looks to me kind a step back in application servers like Jboss 7

       

      is there some simpler way? like in other app servers?

       

      thanks

      t.

        • 1. Re: External directory in classpath
          prasad.deshpande

           

          22:32:46,051 ERROR [stderr] (http--10.0.0.5-8080-1) #####################################################################

          22:32:46,052 ERROR [stderr] (http--10.0.0.5-8080-1) WARNING: no properties file found! This warning can be ignored

          22:32:46,053 ERROR [stderr] (http--10.0.0.5-8080-1) for applets. A file file called "jacorb.properties" or

          22:32:46,053 ERROR [stderr] (http--10.0.0.5-8080-1) ".jacorb_properties" should be present in the classpath,

          22:32:46,054 ERROR [stderr] (http--10.0.0.5-8080-1) the home directory (/root), the current directory (.) or

          22:32:46,055 ERROR [stderr] (http--10.0.0.5-8080-1) in Javas lib directory (/usr/java/jdk1.6.0_31/jre)

          22:32:46,055 ERROR [stderr] (http--10.0.0.5-8080-1) #####################################################################

          22:32:46,056 ERROR [stderr] (http--10.0.0.5-8080-1)

           

          If it's also looking in current directory (.) you can simply put jacorb.properties in the directory from where you run run.sh or you can simply pass -Duser.dir=<path_to_directory_containing_properties> to VM as argument.. & that will become current woring directory (.) & then it shoud find that properties file.

          • 2. Re: External directory in classpath
            colective

            Hi,

             

            yes i know that, i can put in all default classpath like /home, . / java path, in jboss...

            configuration and custom properties are one separate directory which is in /opt/appconfig/ and we cannot spread files on multiple locations.. it must stay in this config dir..

             

            any other sugestion?

             

            thanks

            t.

            • 3. Re: External directory in classpath
              tepih78

              Tomo,

               

                    you can define custom module if that's an option... this is for AS 7

               

              for instance go to jboss modules directory

               

              create sub directory custom/myconfig/main for example

               

              there add your property files

               

              create module.xml file .. you will chose module name... for instnace custom.myconfig

              <module xmlns="urn:jboss:module:1.1" name="custom.myconfig">

                  <properties>

                      <property name="jboss.api" value="private"/>

                  </properties>

               

                  <resources>

                      <resource-root path="."/>

                      <!-- Insert resources here -->

                  </resources>

               

                  <dependencies>     

                  </dependencies>

              </module>

               

              In your jboss-deployment-structure.xml include this module to your app

               

               

              <jboss-deployment-structure>

                  <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                  <deployment>

                      <dependencies>

                          <module name="custom.myconfig/>

                      </dependencies>

                      <resources>

                      </resources>

                  </deployment>

               

                  <sub-deployment name="My_WAR.war">

                      <dependencies>

                          <module name="custom.myconfig" />

                      </dependencies>

                  </sub-deployment>

               

              Didn't had luck creating resource-root path="some path along my filesystem". Only . worked and then it loaded a property file from custom module directory.