Question

I am trying to move a working spring WAR to OSGI environment (in glassfish 3.1 and blueprint, spring 3.0.5). The application loads properties file from disk, like this:

<bean id="myProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="${my_conf}/my.properties"/>
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
</bean>

I see in debugger that ${my_conf}/my.properties is translated to the existing path (c:\conf\my.properties)

I use the property jms.url defined in my.properties in the next bean declaration

<amq:broker useJmx="false" persistent="false" brokerName="embeddedbroker">
    <amq:transportConnectors>
        <amq:transportConnector uri="tcp://${jms.url}"/>
        <amq:transportConnector uri="vm://embeddedbroker" />
    </amq:transportConnectors>
</amq:broker>

And in deployment I get an exception "Could not resolve placeholder ${jms.url}"

Why it fails? Is there another way to load properties from file on disk?

thank you

Was it helpful?

Solution 2

It isn't a solution, but an explanation of my problem. The problem is related to this bug in spring 3 and osgi.

I had to open spring logs to debug level to understand it.

OTHER TIPS

Since its an OSGI environment, you will need spring-osgi-core jar added to your application. Take a look at this link to configure property-placeholder for OSGI framework.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top