git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Camel Blueprint property not found in SSLContextParameters


Hello,

I am trying to migrate to Camel 2.21.0.  I have two separate OSGi Blueprint bundles, lets call them A, and B.
Bundle A's blueprint XML creates and exports a org.apache.camel.util.jsse.SSLContextParameters as an OSGi service :

<cm:property-placeholder persistent-id=“myconfig" update-strategy="reload" placeholder-prefix="#{" placeholder-suffix="}" >
		<cm:default-properties>
			<cm:property name="keystore.password" value="keystore"/>
			<cm:property name="keystore.file" value="${user.home}/keystore.jks"/>
			<cm:property name="keystore.type" value="JKS"/>
			<cm:property name="keystore.provider" value="SUN"/>
		
			<cm:property name="trustore.file" value="${user.home}/truststore.jks"/>
			<cm:property name="truststore.password" value="truststore"/>
			<cm:property name="truststore.type" value="JKS"/>
			<cm:property name="truststore.provider" value="SUN"/>
		</cm:default-properties>
</cm:property-placeholder>

<camel:sslContextParameters id="sslParams">
		<camel:keyManagers keyPassword="{{keystore.password}}">
			<camel:keyStore resource="{{keystore.file}}" 
			  password="{{keystore.password}}" 
			  type="{{keystore.type}}" 
			  provider="{{lkeystore.provider}}" />
		</camel:keyManagers>
		<camel:trustManagers>
			<camel:keyStore 
			  resource="{{trustore.file}}" 
			  password="{{truststore.password}}" 
			  type="{{truststore.type}}" 
			  provider="{{truststore.provider}}" />
		</camel:trustManagers>
</camel:sslContextParameters>

<service ref="sslParams" interface="org.apache.camel.util.jsse.SSLContextParameters">  		
</service>

Notice the sslParams is defined using property placeholders for which default values are provided in the same Bundle A.
Now in Bundle B, I import the sslParams:

	<reference id="sslParams" interface="org.apache.camel.util.jsse.SSLContextParameters" ext:proxy-method="classes" activation="lazy"/>

When I deploy my application (Karaf), I get exception during  Bundle 2 initialization:

Caused by: java.lang.IllegalArgumentException: Property with key [keystore.password] not found in properties from text: {{keystore.password}}
	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:270) ~[?:?]
	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:156) ~[?:?]
	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:115) ~[?:?]
	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:99) ~[?:?]
	at org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:62) ~[?:?]
	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:235) ~[?:?]
	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:178) ~[?:?]
	at org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:2550) ~[?:?]
	at org.apache.camel.util.jsse.JsseParameters.parsePropertyValue(JsseParameters.java:74) ~[?:?]
	... 42 more


Of course, Bundle B does not know about these configuration properties, since they are defined in Bundle A.  The bean should have been resolved, created and exported by Bundle A before it is imported by Bundle B, but it looks as if it is bundle B the one doing the property lookup.   This was working fine in Camel 2.17.4.  Any idea?

Best regards,
Alex soto





( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-camel-users/msg03153.html on line 133
Call Stack
#TimeMemoryFunctionLocation
10.0024368696{main}( ).../msg03153.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-camel-users/msg03153.html on line 133
Call Stack
#TimeMemoryFunctionLocation
10.0024368696{main}( ).../msg03153.html:0