[jira] [Commented] (CAMEL-7488) PropertiesComponent gets initialized by util:constant

2014-06-12 Thread Willem Jiang (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14030216#comment-14030216
 ] 

Willem Jiang commented on CAMEL-7488:
-

Can you check the class file fo constant object?
I don't think ProerptiesComponent has the dependency of constant object.

 PropertiesComponent gets initialized by util:constant
 -

 Key: CAMEL-7488
 URL: https://issues.apache.org/jira/browse/CAMEL-7488
 Project: Camel
  Issue Type: Bug
  Components: camel-core, camel-spring
Affects Versions: 2.13.0, 2.13.1
Reporter: Sven Nold
Assignee: Willem Jiang
 Attachments: camel-test.zip


 Using BridgePropertyPlaceholderConfigurer  Spring util constant namespace  
 to reference a static field, the Properties Component gets initialized with 
 this constant.
 {code:xml|title=camelContext.xml }
 util:constant static-field=anypackage.CONSTANT_1/
 bean id=bridgePropertyPlaceHolder 
 class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
 property name=locations
   list
 valueclasspath:test.properties/value
   /list
 /property
 /bean
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}
 Will produce following Stacktrace (constant contained 'This will be loaded 
 as location; but I am simply a constant'):
 {noformat}
 Caused by: java.io.FileNotFoundException: Properties file This will be 
 loaded as location; but I am simply a constant not found in classpath
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.loadPropertiesFromClasspath(DefaultPropertiesResolver.java:96)
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.resolveProperties(DefaultPropertiesResolver.java:55)
   at 
 org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.resolveProperties(BridgePropertyPlaceholderConfigurer.java:118)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:131)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:117)
   at 
 org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1223)
   at 
 org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:571)
 {noformat}
 My current workaround was to specify propertyPlaceholder with empty location 
 in  camelContext ...
 {code:xml|title=camelContext.xml }
 !-- same as above --
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 !-- location and id are mandatory --
 camel:propertyPlaceholder id=stupidMandatoryId location=/
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (CAMEL-7488) PropertiesComponent gets initialized by util:constant

2014-06-11 Thread Willem Jiang (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14027520#comment-14027520
 ] 

Willem Jiang commented on CAMEL-7488:
-

Hi Sven,
I managed to reproduce the issue and find out PropertyPlaceholderConfigurer 
know nothing about the util:constant as a property.
If have to use it in [a different 
way|http://stackoverflow.com/questions/7309956/how-to-reference-constant-in-attribute-in-spring].

I did some work to enable the configuration of ignoreResourceNotFound, so you 
don't need to addition camel:propertyPlaceholder to the camel context there, 
the bridgePropertyPlaceHolder could be.
{code}
bean id=bridgePropertyPlaceHolder 
class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
  property name=ignoreResourceNotFound value=true/
  property name=locations
list
  valueclasspath:test.properties/value
/list
  /property
   /bean
{code}

 PropertiesComponent gets initialized by util:constant
 -

 Key: CAMEL-7488
 URL: https://issues.apache.org/jira/browse/CAMEL-7488
 Project: Camel
  Issue Type: Bug
  Components: camel-core, camel-spring
Affects Versions: 2.13.0, 2.13.1
Reporter: Sven Nold

 Using BridgePropertyPlaceholderConfigurer  Spring util constant namespace  
 to reference a static field, the Properties Component gets initialized with 
 this constant.
 {code:xml|title=camelContext.xml }
 util:constant static-field=anypackage.CONSTANT_1/
 bean id=bridgePropertyPlaceHolder 
 class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
 property name=locations
   list
 valueclasspath:test.properties/value
   /list
 /property
 /bean
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}
 Will produce following Stacktrace (constant contained 'This will be loaded 
 as location; but I am simply a constant'):
 {noformat}
 Caused by: java.io.FileNotFoundException: Properties file This will be 
 loaded as location; but I am simply a constant not found in classpath
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.loadPropertiesFromClasspath(DefaultPropertiesResolver.java:96)
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.resolveProperties(DefaultPropertiesResolver.java:55)
   at 
 org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.resolveProperties(BridgePropertyPlaceholderConfigurer.java:118)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:131)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:117)
   at 
 org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1223)
   at 
 org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:571)
 {noformat}
 My current workaround was to specify propertyPlaceholder with empty location 
 in  camelContext ...
 {code:xml|title=camelContext.xml }
 !-- same as above --
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 !-- location and id are mandatory --
 camel:propertyPlaceholder id=stupidMandatoryId location=/
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (CAMEL-7488) PropertiesComponent gets initialized by util:constant

2014-06-11 Thread Sven Nold (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14027532#comment-14027532
 ] 

Sven Nold commented on CAMEL-7488:
--

Hi Willem,

I already had that setting enabled, but even with 2.13-SNAPSHOT no luck.
If you enable tracing you can see lines like:


[pache.camel.spring.Main.main()] CamelContextFactoryBeanINFO  Bridging 
Camel and Spring property placeholder configurer with id: 
bridgePropertyPlaceHolder
[pache.camel.spring.Main.main()] SpringCamelContext DEBUG Using 
ComponentResolver: org.apache.camel.impl.DefaultComponentResolver@70ff4bfb to 
resolve component with name: properties
[pache.camel.spring.Main.main()] DefaultListableBeanFactory TRACE No bean 
named 'properties' found in 
org.springframework.beans.factory.support.DefaultListableBeanFactory@4b37f3f9: 
defining beans 
[ag.isb.camel.Constants.CONSTANT_1,bridgePropertyPlaceHolder,template,consumerTemplate,camel-1:beanPostProcessor,camel-1];
 root of factory hierarchy
[pache.camel.spring.Main.main()] DefaultComponentResolver   DEBUG Found 
component: properties in registry: null
[pache.camel.spring.Main.main()] ObjectHelper   TRACE Loading 
class: org.apache.camel.component.properties.PropertiesComponent using 
classloader: java.net.URLClassLoader@154f6189
[pache.camel.spring.Main.main()] DefaultComponentResolver   DEBUG Found 
component: properties via type: 
org.apache.camel.component.properties.PropertiesComponent via: 
META-INF/services/org/apache/camel/component/properties
[pache.camel.spring.Main.main()] DefaultListableBeanFactory DEBUG Creating 
instance of bean 'org.apache.camel.component.properties.PropertiesComponent'
[pache.camel.spring.Main.main()] DefaultListableBeanFactory DEBUG Returning 
cached instance of singleton bean 'ag.isb.camel.Constants.CONSTANT_1'
[pache.camel.spring.Main.main()] DefaultCamelBeanPostProcessor  TRACE Camel 
bean processing after initialization for bean: ag.isb.camel.Constants.CONSTANT_1
[pache.camel.spring.Main.main()] DefaultListableBeanFactory DEBUG 
Autowiring by type from bean name 
'org.apache.camel.component.properties.PropertiesComponent' via constructor to 
bean named 'ag.isb.camel.Constants.CONSTANT_1'
[pache.camel.spring.Main.main()] DefaultListableBeanFactory DEBUG Returning 
cached instance of singleton bean 'ag.isb.camel.Constants.CONSTANT_1'
[pache.camel.spring.Main.main()] DefaultCamelBeanPostProcessor  TRACE Camel 
bean processing after initialization for bean: ag.isb.camel.Constants.CONSTANT_1
[pache.camel.spring.Main.main()] DefaultListableBeanFactory DEBUG 
*Autowiring by type from bean name 
'org.apache.camel.component.properties.PropertiesComponent' via constructor to 
bean named 'ag.isb.camel.Constants.CONSTANT_1'*
[pache.camel.spring.Main.main()] DefaultCamelBeanPostProcessor  TRACE Camel 
bean processing before initialization for bean: 
org.apache.camel.component.properties.PropertiesComponent



 PropertiesComponent gets initialized by util:constant
 -

 Key: CAMEL-7488
 URL: https://issues.apache.org/jira/browse/CAMEL-7488
 Project: Camel
  Issue Type: Bug
  Components: camel-core, camel-spring
Affects Versions: 2.13.0, 2.13.1
Reporter: Sven Nold
Assignee: Willem Jiang
 Attachments: camel-test.zip


 Using BridgePropertyPlaceholderConfigurer  Spring util constant namespace  
 to reference a static field, the Properties Component gets initialized with 
 this constant.
 {code:xml|title=camelContext.xml }
 util:constant static-field=anypackage.CONSTANT_1/
 bean id=bridgePropertyPlaceHolder 
 class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
 property name=locations
   list
 valueclasspath:test.properties/value
   /list
 /property
 /bean
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}
 Will produce following Stacktrace (constant contained 'This will be loaded 
 as location; but I am simply a constant'):
 {noformat}
 Caused by: java.io.FileNotFoundException: Properties file This will be 
 loaded as location; but I am simply a constant not found in classpath
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.loadPropertiesFromClasspath(DefaultPropertiesResolver.java:96)
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.resolveProperties(DefaultPropertiesResolver.java:55)
   at 
 

[jira] [Commented] (CAMEL-7488) PropertiesComponent gets initialized by util:constant

2014-06-11 Thread Willem Jiang (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14027551#comment-14027551
 ] 

Willem Jiang commented on CAMEL-7488:
-

I just set the constant Property into the BridgePropertyPlaceholderConfigurer 
just like this
{code}
util:constant id=test 
static-field=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurerTest.CONSTANT/
  

bean id=bridgePropertyPlaceHolder 
class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
  property name=properties
 props
   !-- reference the constant value in a property--
   prop key=testProperty#{test}/prop
 /props
  /property
  property name=ignoreResourceNotFound value=true/
  property name=locations
list
  valueclasspath:someplaceToOverride/value
/list
  /property
   /bean
{code}

I think you can also wire the Properties that way.


 PropertiesComponent gets initialized by util:constant
 -

 Key: CAMEL-7488
 URL: https://issues.apache.org/jira/browse/CAMEL-7488
 Project: Camel
  Issue Type: Bug
  Components: camel-core, camel-spring
Affects Versions: 2.13.0, 2.13.1
Reporter: Sven Nold
Assignee: Willem Jiang
 Attachments: camel-test.zip


 Using BridgePropertyPlaceholderConfigurer  Spring util constant namespace  
 to reference a static field, the Properties Component gets initialized with 
 this constant.
 {code:xml|title=camelContext.xml }
 util:constant static-field=anypackage.CONSTANT_1/
 bean id=bridgePropertyPlaceHolder 
 class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
 property name=locations
   list
 valueclasspath:test.properties/value
   /list
 /property
 /bean
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}
 Will produce following Stacktrace (constant contained 'This will be loaded 
 as location; but I am simply a constant'):
 {noformat}
 Caused by: java.io.FileNotFoundException: Properties file This will be 
 loaded as location; but I am simply a constant not found in classpath
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.loadPropertiesFromClasspath(DefaultPropertiesResolver.java:96)
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.resolveProperties(DefaultPropertiesResolver.java:55)
   at 
 org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.resolveProperties(BridgePropertyPlaceholderConfigurer.java:118)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:131)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:117)
   at 
 org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1223)
   at 
 org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:571)
 {noformat}
 My current workaround was to specify propertyPlaceholder with empty location 
 in  camelContext ...
 {code:xml|title=camelContext.xml }
 !-- same as above --
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 !-- location and id are mandatory --
 camel:propertyPlaceholder id=stupidMandatoryId location=/
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (CAMEL-7488) PropertiesComponent gets initialized by util:constant

2014-06-11 Thread Sven Nold (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14027555#comment-14027555
 ] 

Sven Nold commented on CAMEL-7488:
--

Sorry but the main problem/issue is that PropertiesComponent autowires that 
constants.
I cannot get rid off that (util:)constant(s) because they're referenced else 
where, which I cannot change.

Is there any way to remove this auto magic of using these constants as part of 
the PropertiesComponent (constructor) initialization. I couldn't find any 
@Autowired annotation.

 PropertiesComponent gets initialized by util:constant
 -

 Key: CAMEL-7488
 URL: https://issues.apache.org/jira/browse/CAMEL-7488
 Project: Camel
  Issue Type: Bug
  Components: camel-core, camel-spring
Affects Versions: 2.13.0, 2.13.1
Reporter: Sven Nold
Assignee: Willem Jiang
 Attachments: camel-test.zip


 Using BridgePropertyPlaceholderConfigurer  Spring util constant namespace  
 to reference a static field, the Properties Component gets initialized with 
 this constant.
 {code:xml|title=camelContext.xml }
 util:constant static-field=anypackage.CONSTANT_1/
 bean id=bridgePropertyPlaceHolder 
 class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
 property name=locations
   list
 valueclasspath:test.properties/value
   /list
 /property
 /bean
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}
 Will produce following Stacktrace (constant contained 'This will be loaded 
 as location; but I am simply a constant'):
 {noformat}
 Caused by: java.io.FileNotFoundException: Properties file This will be 
 loaded as location; but I am simply a constant not found in classpath
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.loadPropertiesFromClasspath(DefaultPropertiesResolver.java:96)
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.resolveProperties(DefaultPropertiesResolver.java:55)
   at 
 org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.resolveProperties(BridgePropertyPlaceholderConfigurer.java:118)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:131)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:117)
   at 
 org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1223)
   at 
 org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:571)
 {noformat}
 My current workaround was to specify propertyPlaceholder with empty location 
 in  camelContext ...
 {code:xml|title=camelContext.xml }
 !-- same as above --
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 !-- location and id are mandatory --
 camel:propertyPlaceholder id=stupidMandatoryId location=/
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (CAMEL-7488) PropertiesComponent gets initialized by util:constant

2014-06-08 Thread Willem Jiang (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-7488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14021550#comment-14021550
 ] 

Willem Jiang commented on CAMEL-7488:
-

Camel PropertyComponent will use the  
PropertiesResolver(bridgePropertyPlaceHolder) to lookup the properties, so you 
can get the exception by default, as bridgePropertyPlaceHolder cannot find the 
resource file. 

You can define the propertyPlaceholder to override the default feature like 
this.
{code}
 camel:propertyPlaceholder id=propertiesOverride 
ignoreMissingLocation=true/
{code}

 PropertiesComponent gets initialized by util:constant
 -

 Key: CAMEL-7488
 URL: https://issues.apache.org/jira/browse/CAMEL-7488
 Project: Camel
  Issue Type: Bug
  Components: camel-core, camel-spring
Affects Versions: 2.13.0, 2.13.1
Reporter: Sven Nold

 Using BridgePropertyPlaceholderConfigurer  Spring util constant namespace  
 to reference a static field, the Properties Component gets initialized with 
 this constant.
 {code:xml|title=camelContext.xml }
 util:constant static-field=anypackage.CONSTANT_1/
 bean id=bridgePropertyPlaceHolder 
 class=org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer
 property name=locations
   list
 valueclasspath:test.properties/value
   /list
 /property
 /bean
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}
 Will produce following Stacktrace (constant contained 'This will be loaded 
 as location; but I am simply a constant'):
 {noformat}
 Caused by: java.io.FileNotFoundException: Properties file This will be 
 loaded as location; but I am simply a constant not found in classpath
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.loadPropertiesFromClasspath(DefaultPropertiesResolver.java:96)
   at 
 org.apache.camel.component.properties.DefaultPropertiesResolver.resolveProperties(DefaultPropertiesResolver.java:55)
   at 
 org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.resolveProperties(BridgePropertyPlaceholderConfigurer.java:118)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:131)
   at 
 org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:117)
   at 
 org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1223)
   at 
 org.apache.camel.model.ProcessorDefinition.resolvePropertyPlaceholders(ProcessorDefinition.java:571)
 {noformat}
 My current workaround was to specify propertyPlaceholder with empty location 
 in  camelContext ...
 {code:xml|title=camelContext.xml }
 !-- same as above --
 camel:camelContext xmlns=http://camel.apache.org/schema/spring;
 !-- location and id are mandatory --
 camel:propertyPlaceholder id=stupidMandatoryId location=/
 camel:route
   camel:from uri=direct://ignore /
   camel:setBody
 camel:simple{{testProperty}}/camel:simple
   /camel:setBody
   camel:to uri=mock://ignore /
 /camel:route
 /camel:camelContext   
 {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)