5 Replies Latest reply on Jun 26, 2009 10:37 AM by Stan Lewis

    Properties File

    Marco Jacobs Newbie

      I am trying to read the a properties file using the properties-placeholder.


      For some reason I am getting this error:


      Line 13 in XML document from URL bundle://158.0:0/META-INF/spring/bundle-context-osgi.xml is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'osgix:property-placeholder'.


      I am using the following in my bundle-context-osgi.xml:





      To set a property in my bundle-context.xml:





      Is this no longer supported? If it is how would you get this to work? Also, is there a way that I can use apache configuration to achieve the same thing? If so, how?

        • 1. Re: Properties File
          Gert Vanthienen Novice



          For FUSE ESB 4.1, we moved to Spring DM 1.2.0-m2.  One of the changes compared to the Spring DM 1.0.x series, is the use of the configadmin properties.


          You now have two separate tags, one for reading entries out of the ConfigAdmin service into a Map:

          <!-- Configuration Admin entry -->
          <osgix:cm-properties id="cmProps" persistent-id="com.xyz.myapp">
             <prop key="host">localhost</prop>


          And one for making the map available through the property placeholder syntax:

          <!-- placeholder configurer -->
          <ctx:property-placeholder properties-ref="cmProps"></ctx:property-placeholder>


          Replacing your <osgix:property-placeholder> with this combo should solve your problem.  For some background information, have a look at http://static.springframework.org/osgi/docs/1.2.0/reference/html/compendium.html#compendium:cm





          • 2. Re: Properties File
            Roberto Melo Cavalcante Newbie



            I just followed your instructions to adapt the configuration admin entry and it works ok for the placeholder, but it does not read the configuration file.

            The bundle is up, I update it after each build and it is reported as Started by osgi.

            Here goes my files so you can take a look.





            properties file: /etc/payments.cfg




            Now a little bit about my enviroment:

            Ubuntu 9.04 - Jaunty Jackalope


            java version "1.6.0_13"

            Java(TM) SE Runtime Environment (build 1.6.0_13-b03)

            Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)


            Eclipse Version: 3.4.2, Build id: M20090211-1700, Full


            Fuse version: apache-servicemix-


            When I switch to log console and do 'd' it appears:

            12:45:53,881 | DEBUG | xtenderThread-87 | PaymentsApi                      | ?                                   ? | connectionUrl = ubuntu:8080

            from osgi console, list:

            payments-api (0.0.1)


            Hope you can help.


            Thanks in advance

            • 3. Re: Properties File
              Roberto Melo Cavalcante Newbie

              I figured out what was the problem.


              I was placing the payments.cfg file inside /etc, instead it should be at /path_to_fuse_esb/my_fuse_esb_installation/etc.


              I just place the file there and refreshed my osgi bundle and it worked.


              Sorry for my silly mistake.


              Best regards, Roberto.

              • 4. Re: Properties File
                Simone Pringle Newbie

                Thank you for the explanation about how Fuse 4.1 is handling properties now.


                I can't be too sure, but I think that the archetype(s) may need to be updated?


                I created a Maven project (in Eclipse) using the servicemix-osgi-camel-archetype from repo.fusesource.maven2 and this is what it auto-generated (see below).


                Does the archetype need to be updated or am I missing something?






                    <property name="prefix" value="$"/>


                • 5. Re: Properties File
                  Stan Lewis Novice

                  Hi Simon, it sure does need to be updated, I've created ESB-764 to make sure it's tracked.