Lee sung Kyu created CAMEL-13362:
------------------------------------
Summary: Property value is not access.
Key: CAMEL-13362
URL: https://issues.apache.org/jira/browse/CAMEL-13362
Project: Camel
Issue Type: Task
Components: camel-core-xml
Affects Versions: 2.23.1
Reporter: Lee sung Kyu
Hi, guys.
I'm beginner for camel. I have some problem.
We are implementing file transfer system using camel.
I set property from external property file.
But application is not accessed to this property file. We cannot use
propertyplaceholder because the value will be changed at runtime.
We implemented it like below.
+camelContext.xml+
{code:java}
<bean id="myProperties" class="java.util.Properties"/>
<bean id="propertylist"
class="org.apache.camel.component.properties.PropertiesComponent">
<property name="cache" value="true"/>
<property name="location" value="classpath:camelap.properties"/>
<property name="overrideProperties" ref="myProperties"/>
</bean>
<camelContext id="camelContext-f611cb6c-d516-4346-9adc-5512d327a88d"
trace="false" xmlns="http://camel.apache.org/schema/spring">
<camel:route id="initial_info">
<camel:from id="_initial" uri="direct:sqlParam"/>
<camel:to id="_selectReference"
uri="sql:{{sql.referenceInfo}}?dataSource=dataSource"/>
<camel:process id="_process1" ref="tempBean"/>
<camel:log id="_aaaa" loggingLevel="WARN" message="tttttttt ::: {{test}} :::
${header.sourceDirectory}"/>
</camel:route>{code}
+camelap.properties+ : path : target/classes
{code:java}
file.uri=/home/WRK/KR/SND/DAT
test=OLD_VALUE
file.pattern=SLPNPM*,SPLNCC*,SLPNCM*,SLPNPC*
file.target.path1=/home/WRK/KR/SND/NRAT
file.target.path2=/home/WRK/KR/SND/KDAP
############################################
## SQL Statement ##
############################################
sql.referenceInfo=SELECT DISTINCT \
A.WFLOW_INST_ID ,\
TO_CHAR(A.EFCT_ST_DT,'YYYYMMDDHH24MISS') EFCT_ST_DT, \
B.NE_ID , \
B.NE_TYPE_ID , \
B.CDR_FILE_COLEC_DIR_NM , \
B.ORIGIN_FMT_ID , \
B.TRM_DIR_NM , \
D.CDR_FILE_NMNG_RULE_SBST, \
D.FILE_NM_LEN , \
B.FNS_FILE_CRET_YN , \
B.FNS_FILE_DIV_CD \
FROM TB_WFLOW_INFO A, \
TB_CDRSEND_BASE_INFO B, \
TB_FILE_FMT_INFO D \
WHERE A.WFLOW_INST_ID = 'P1_IPTVKR' \
AND B.NE_ID = 'KRLPPM10' \
AND now() BETWEEN A.EFCT_ST_DT AND A.EXP_DT \
AND now() BETWEEN B.EFCT_ST_DT AND B.EXP_DT \
AND A.WFLOW_INST_ID = B.WFLOW_INST_ID \
AND B.ORIGIN_FMT_ID = D.CDR_FILE_FMT_ID;
{code}
Error Log.
{code:java}
org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
initial_info at: >>> To[sql:{{sql.referenceInfo}}?dataSource=dataSource] <<< in
route: Route(initial_info)[[From[direct:sqlParam]] -> [To[sql:{{sql... because
of Property with key [sql.referenceInfo] not found in properties from text:
sql:{{sql.referenceInfo}}?dataSource=dataSource
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1826)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
~[camel-spring-2.23.1.jar:2.23.1]
at
org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:370)
~[camel-spring-2.23.1.jar:2.23.1]
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:417)
~[camel-spring-2.23.1.jar:2.23.1]
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:95)
~[camel-spring-2.23.1.jar:2.23.1]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402)
~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359)
~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896)
~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163)
~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at com.ktds.openmzn.OpenmznApplication.main(OpenmznApplication.java:25)
~[classes/:na]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route initial_info at: >>> To[sql:{{sql.referenceInfo}}?dataSource=dataSource]
<<< in route: Route(initial_info)[[From[direct:sqlParam]] -> [To[sql:{{sql...
because of Property with key [sql.referenceInfo] not found in properties from
text: sql:{{sql.referenceInfo}}?dataSource=dataSource
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1352)
~[camel-core-2.23.1.jar:2.23.1]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:212)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1140)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3735)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3440)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3248)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3244)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3267)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3244)
~[camel-core-2.23.1.jar:2.23.1]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3160)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
~[camel-spring-2.23.1.jar:2.23.1]
... 18 common frames omitted
Caused by: java.lang.IllegalArgumentException: Property with key
[sql.referenceInfo] not found in properties from text:
sql:{{sql.referenceInfo}}?dataSource=dataSource
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:271)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:157)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:116)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:100)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:63)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:235)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:178)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:2547)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.model.ProcessorDefinitionHelper.resolvePropertyPlaceholders(ProcessorDefinitionHelper.java:737)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:544)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:530)
~[camel-core-2.23.1.jar:2.23.1]
at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:240)
~[camel-core-2.23.1.jar:2.23.1]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1349)
~[camel-core-2.23.1.jar:2.23.1]
... 29 common frames omitted
{code}
Please check and comment.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)