You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Djeeaie ." <dj...@gmail.com> on 2013/05/27 13:33:32 UTC

Encoding issue for Redis key using xml blueprint

Hi,
While using a spring-redis uri in karaf, I had an issue with setting the
key using a xml blueprint. Here is the blue print :

<?xml version="1.0" encoding="UTF8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <camelContext xmlns="http://camel.apache.org/schema/blueprint"
id="monAutreContXML">
        <route>
<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
<setHeader headerName="CamelRedis.Key">
<constant>test</constant>
</setHeader>
<to uri="spring-redis://ip.of.server?command=SET"/>
<to uri="stream:out"/>
        </route>
    </camelContext>
</blueprint>

The route to stream:out works, ans the redis one too. But, when i type
"keys test" in redis, instead of test, I get nothing. I have to use "keys
*" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the
constant part with other test values seems to be \xac\xed\x00\x05t\x00.

It looks like it's a Java serialization issue, so I would like to know if
it's possible to fix this by using only a xml blueprint ?

Karaf : 2.3.1
Camel : 2.11
Redis : 2.6.13
Java : 1.7

Thanks in advance,
Djee

Re: Encoding issue for Redis key using xml blueprint

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Yeah, Please go ahead to create a jira and append your test case, I will take a close look when I get chance.
Thanks
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋

www.camelone.org : The open source integration conference: 

On 2013-6-3, at 下午8:03, Djeeaie . wrote:

> Hi,
> 
> just wanted your opinion if I should put this on jira rather than on this mailing list, so does it look rather like a bug for you or a conf issue ?
> Best regards,
> 
> Djee 
> 
> 
> On 29 May 2013 10:47, Djeeaie . <dj...@gmail.com> wrote:
> I'm not sure how to really check this. I have only one of my own bundle deployed while testing, and here's the result of the list command :
> 
> karaf@root> list
> START LEVEL 100 , List Threshold: 50
>    ID   State         Blueprint      Spring    Level  Name
> [  62] [Active     ] [            ] [       ] [   50] camel-core (2.11.0)
> [  63] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands (2.11.0)
> [  78] [Active     ] [            ] [       ] [   50] geronimo-jta_1.1_spec (1.1.1)
> [  79] [Active     ] [            ] [       ] [   50] camel-spring (2.11.0)
> [  80] [Active     ] [Created     ] [       ] [   50] camel-blueprint (2.11.0)
> [ 109] [Active     ] [            ] [       ] [   50] Commons Codec (1.6.0)
> [ 110] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: commons-beanutils (1.8.3.1)
> [ 111] [Active     ] [            ] [       ] [   50] Commons Collections (3.2.1)
> [ 112] [Active     ] [            ] [       ] [   50] Commons Configuration (1.8.0)
> [ 113] [Active     ] [            ] [       ] [   50] Commons Digester (2.1)
> [ 114] [Active     ] [            ] [       ] [   50] Commons JXPath (1.3)
> [ 115] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jdom (1.1.0.4)
> [ 116] [Active     ] [            ] [       ] [   50] Commons Lang (2.6)
> [ 117] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: ant (1.7.0.6)
> [ 118] [Active     ] [            ] [       ] [   50] Commons Daemon (1.0.5)
> [ 119] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: commons-httpclient (3.1.0.7)
> [ 120] [Active     ] [            ] [       ] [   50] Commons Math (2.2)
> [ 121] [Active     ] [            ] [       ] [   50] Commons Net (3.2.0)
> [ 122] [Active     ] [            ] [       ] [   50] Jackson JSON processor (1.9.12)
> [ 123] [Active     ] [            ] [       ] [   50] Data mapper for Jackson JSON processor (1.9.12)
> [ 124] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jetty (6.1.26.4)
> [ 125] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: hadoop-core (1.1.1.1)
> [ 126] [Active     ] [            ] [       ] [   50] camel-hdfs (2.11.0)
> [ 127] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Specs :: JCR API 2.0 (2.2.0)
> [ 128] [Active     ] [            ] [       ] [   50] Jackrabbit JCR Commons (2.5.2)
> [ 129] [Active     ] [            ] [       ] [   50] Jackrabbit WebDAV Library (2.5.2)
> [ 130] [Active     ] [            ] [       ] [   50] Commons JEXL (2.0.1)
> [ 131] [Active     ] [            ] [       ] [   50] Commons VFS Core (2.0)
> [ 132] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: xmlresolver (1.2.0.5)
> [ 133] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jsch (0.1.49.1)
> [ 142] [Active     ] [            ] [       ] [   50] Commons Pool (1.6.0)
> [ 143] [Active     ] [            ] [       ] [   50] Spring Data Redis Support (1.0.3.RELEASE)
> [ 144] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jedis (2.1.0.1)
> [ 145] [Active     ] [            ] [       ] [   50] camel-spring-redis (2.11.0)
> [ 147] [Active     ] [            ] [       ] [   50] camel-http (2.11.0)
> [ 158] [Active     ] [            ] [       ] [   50] camel-stream (2.11.0)
> [ 170] [Active     ] [Failure     ] [       ] [   80] camel-test.xml (0.0.0)
> 
> Best regards,
> Djee
> 
> 
> On 29 May 2013 10:17, Freeman Fang <fr...@gmail.com> wrote:
> Hi,
> 
> Please check and ensure there's no multiple spring-data-redis bundle get installed in your container.
> 
> -------------
> Freeman(Yue) Fang
> 
> Red Hat, Inc. 
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: @Freeman小屋
> 
> www.camelone.org : The open source integration conference: 
> 
> On 2013-5-29, at 下午3:05, Djeeaie . wrote:
> 
>> Hi,
>> 
>> Thanks for the help. Here is the result :
>> 
>> karaf@root> osgi:headers camel-test
>> 
>> Bundle 170
>> ----------
>> Manifest-Version = 2
>> 
>> Bundle-SymbolicName = camel-test.xml
>> Bundle-Version = 0.0.0
>> Bundle-ManifestVersion = 2
>> 
>> DynamicImport-Package =
>>         *
>> Import-Package =
>>         org.springframework.data.redis.connection.jedis,
>>         org.springframework.data.redis.core,
>>         org.springframework.data.redis.serializer
>> 
>> Best regards,
>> Djee
>> 
>> 
>> On 29 May 2013 03:14, Freeman Fang <fr...@gmail.com> wrote:
>> Hi,
>> 
>> This could be caused by your customer bundle miss some package or your customer bundle embed spring jars.
>> 
>> Please post the result of 
>> osgi:headers your_bundle_id
>> -------------
>> Freeman(Yue) Fang
>> 
>> Red Hat, Inc. 
>> FuseSource is now part of Red Hat
>> Web: http://fusesource.com | http://www.redhat.com/
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> http://blog.sina.com.cn/u/1473905042
>> weibo: @Freeman小屋
>> 
>> www.camelone.org : The open source integration conference: 
>> 
>> On 2013-5-28, at 下午8:19, Djeeaie . wrote:
>> 
>>> Hi,
>>> 
>>> here comes some new stuff. I digged into it and found out I needed a StringRedisSerializer in a  RedisTemplate. So i changed the xml file :
>>> 
>>> <?xml version="1.0" encoding="UTF8"?>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>> 
>>> 	<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
>>> 		<property name="hostName" value="ip.of.server" />
>>> 		<property name="port" value="6379"/>
>>> 	</bean>
>>> 	
>>> 	<bean id="stringRedisSerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
>>> 	<bean id="RedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
>>> 		<property name="connectionFactory" ref="redisConnectionFactory"/>
>>> 		<property name="keySerializer" ref = "stringRedisSerializer"/>
>>> 		<property name="hashKeySerializer" ref = "stringRedisSerializer"/>
>>> 		<property name="valueSerializer" ref = "stringRedisSerializer"/>
>>> 		<property name="hashValueSerializer" ref = "stringRedisSerializer"/>
>>> 	</bean>
>>> 		<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="monAutreContXML">
>>> 			<route>
>>> 			<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>>> 				<setHeader headerName="CamelRedis.Key">
>>> 					<constant>myKey</constant>
>>> 				</setHeader>
>>> 			<to uri="stream:out"/>
>>> 			<to uri="spring-redis://redhishost?command=SET&amp;redisTemplate=#RedisTemplate"/></route>
>>> 		</camelContext> 
>>> </blueprint>
>>> 
>>> But when I try to deploy it, I get the following error message in the karaf log :
>>> 
>>> 2013-05-28 14:24:58,779 | ERROR | rint Extender: 3 | BlueprintContainerImpl           | container.BlueprintContainerImpl  393 | 7 - org.apache.aries.blueprint.c
>>> ore - 1.1.0 | Unable to start blueprint container for bundle camel-test.xml
>>> org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: keySerializer, getter: class org.springfram
>>> ework.data.redis.core.RedisTemplate.getKeySerializer(), setter: [class org.springframework.data.redis.core.RedisTemplate.setKeySerializer(interface org.springfr
>>> amework.data.redis.serializer.RedisSerializer)]
>>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>>         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.
>>> core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>>         at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_21]
>>>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_21]
>>>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_21]
>>>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_21]
>>>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
>>> Caused by: java.lang.Exception: Unable to convert value org.springframework.data.redis.serializer.StringRedisSerializer@7e15f62e to type org.springframework.dat
>>> a.redis.serializer.RedisSerializer<java.lang.Object>
>>>         at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[7:org.apache.aries.blueprint.core:1.1
>>> .0]
>>>         at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         ... 26 more
>>> 
>>> I don't understand the error, as the class is implementing the interface. Am I missing something, or is it impossible to do it with just xml ?
>>> 
>>> Best regards,
>>> Djee
>>> 
>>> 
>>> On 27 May 2013 14:33, Djeeaie . <dj...@gmail.com> wrote:
>>> Hi,
>>> While using a spring-redis uri in karaf, I had an issue with setting the key using a xml blueprint. Here is the blue print :
>>> 
>>> <?xml version="1.0" encoding="UTF8"?>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>>     <camelContext xmlns="http://camel.apache.org/schema/blueprint" id="monAutreContXML">
>>>         <route>
>>> 		<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>>> 			<setHeader headerName="CamelRedis.Key">
>>> 				<constant>test</constant>
>>> 			</setHeader>
>>> 		<to uri="spring-redis://ip.of.server?command=SET"/>
>>> 		<to uri="stream:out"/>
>>>         </route>
>>>     </camelContext>
>>> </blueprint> 
>>> 
>>> The route to stream:out works, ans the redis one too. But, when i type "keys test" in redis, instead of test, I get nothing. I have to use "keys *" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the constant part with other test values seems to be \xac\xed\x00\x05t\x00.
>>> 
>>> It looks like it's a Java serialization issue, so I would like to know if it's possible to fix this by using only a xml blueprint ?
>>> 
>>> Karaf : 2.3.1
>>> Camel : 2.11
>>> Redis : 2.6.13
>>> Java : 1.7
>>> 
>>> Thanks in advance,
>>> Djee
>>> 
>>> 
>>> 
>>> -- 
>>> Benhamiche Sylvain
>> 
>> 
>> 
>> 
>> -- 
>> Benhamiche Sylvain
> 
> 
> 
> 
> -- 
> Benhamiche Sylvain
> 
> 
> 
> -- 
> Benhamiche Sylvain


Re: Encoding issue for Redis key using xml blueprint

Posted by "Djeeaie ." <dj...@gmail.com>.
Hi,

just wanted your opinion if I should put this on jira rather than on this
mailing list, so does it look rather like a bug for you or a conf issue ?
Best regards,

Djee


On 29 May 2013 10:47, Djeeaie . <dj...@gmail.com> wrote:

> I'm not sure how to really check this. I have only one of my own bundle
> deployed while testing, and here's the result of the list command :
>
> karaf@root> list
> START LEVEL 100 , List Threshold: 50
>    ID   State         Blueprint      Spring    Level  Name
> [  62] [Active     ] [            ] [       ] [   50] camel-core (2.11.0)
> [  63] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands
> (2.11.0)
> [  78] [Active     ] [            ] [       ] [   50]
> geronimo-jta_1.1_spec (1.1.1)
> [  79] [Active     ] [            ] [       ] [   50] camel-spring (2.11.0)
> [  80] [Active     ] [Created     ] [       ] [   50] camel-blueprint
> (2.11.0)
> [ 109] [Active     ] [            ] [       ] [   50] Commons Codec (1.6.0)
> [ 110] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: commons-beanutils (1.8.3.1)
> [ 111] [Active     ] [            ] [       ] [   50] Commons Collections
> (3.2.1)
> [ 112] [Active     ] [            ] [       ] [   50] Commons
> Configuration (1.8.0)
> [ 113] [Active     ] [            ] [       ] [   50] Commons Digester
> (2.1)
> [ 114] [Active     ] [            ] [       ] [   50] Commons JXPath (1.3)
> [ 115] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: jdom (1.1.0.4)
> [ 116] [Active     ] [            ] [       ] [   50] Commons Lang (2.6)
> [ 117] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: ant (1.7.0.6)
> [ 118] [Active     ] [            ] [       ] [   50] Commons Daemon
> (1.0.5)
> [ 119] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: commons-httpclient (3.1.0.7)
> [ 120] [Active     ] [            ] [       ] [   50] Commons Math (2.2)
> [ 121] [Active     ] [            ] [       ] [   50] Commons Net (3.2.0)
> [ 122] [Active     ] [            ] [       ] [   50] Jackson JSON
> processor (1.9.12)
> [ 123] [Active     ] [            ] [       ] [   50] Data mapper for
> Jackson JSON processor (1.9.12)
> [ 124] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: jetty (6.1.26.4)
> [ 125] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: hadoop-core (1.1.1.1)
> [ 126] [Active     ] [            ] [       ] [   50] camel-hdfs (2.11.0)
> [ 127] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Specs :: JCR API 2.0 (2.2.0)
> [ 128] [Active     ] [            ] [       ] [   50] Jackrabbit JCR
> Commons (2.5.2)
> [ 129] [Active     ] [            ] [       ] [   50] Jackrabbit WebDAV
> Library (2.5.2)
> [ 130] [Active     ] [            ] [       ] [   50] Commons JEXL (2.0.1)
> [ 131] [Active     ] [            ] [       ] [   50] Commons VFS Core
> (2.0)
> [ 132] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: xmlresolver (1.2.0.5)
> [ 133] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: jsch (0.1.49.1)
> [ 142] [Active     ] [            ] [       ] [   50] Commons Pool (1.6.0)
> [ 143] [Active     ] [            ] [       ] [   50] Spring Data Redis
> Support (1.0.3.RELEASE)
> [ 144] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
> Bundles :: jedis (2.1.0.1)
> [ 145] [Active     ] [            ] [       ] [   50] camel-spring-redis
> (2.11.0)
> [ 147] [Active     ] [            ] [       ] [   50] camel-http (2.11.0)
> [ 158] [Active     ] [            ] [       ] [   50] camel-stream (2.11.0)
> [ 170] [Active     ] [Failure     ] [       ] [   80] camel-test.xml
> (0.0.0)
>
> Best regards,
> Djee
>
>
> On 29 May 2013 10:17, Freeman Fang <fr...@gmail.com> wrote:
>
>> Hi,
>>
>> Please check and ensure there's no multiple spring-data-redis bundle get
>> installed in your container.
>>
>>      -------------
>> Freeman(Yue) Fang
>>
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Web: http://fusesource.com | http://www.redhat.com/
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> http://blog.sina.com.cn/u/1473905042
>> weibo: @Freeman小屋
>>
>> www.camelone.org : The open source integration conference:
>>
>> On 2013-5-29, at 下午3:05, Djeeaie . wrote:
>>
>> Hi,
>>
>> Thanks for the help. Here is the result :
>>
>> karaf@root> osgi:headers camel-test
>>
>> Bundle 170
>> ----------
>> Manifest-Version = 2
>>
>> Bundle-SymbolicName = camel-test.xml
>> Bundle-Version = 0.0.0
>> Bundle-ManifestVersion = 2
>>
>> DynamicImport-Package =
>>         *
>> Import-Package =
>>         org.springframework.data.redis.connection.jedis,
>>         org.springframework.data.redis.core,
>>         org.springframework.data.redis.serializer
>>
>> Best regards,
>> Djee
>>
>>
>> On 29 May 2013 03:14, Freeman Fang <fr...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> This could be caused by your customer bundle miss some package or your
>>> customer bundle embed spring jars.
>>>
>>> Please post the result of
>>> osgi:headers your_bundle_id
>>>      -------------
>>> Freeman(Yue) Fang
>>>
>>> Red Hat, Inc.
>>> FuseSource is now part of Red Hat
>>> Web: http://fusesource.com | http://www.redhat.com/
>>> Twitter: freemanfang
>>> Blog: http://freemanfang.blogspot.com
>>> http://blog.sina.com.cn/u/1473905042
>>> weibo: @Freeman小屋
>>>
>>> www.camelone.org : The open source integration conference:
>>>
>>> On 2013-5-28, at 下午8:19, Djeeaie . wrote:
>>>
>>> Hi,
>>>
>>> here comes some new stuff. I digged into it and found out I needed a
>>> StringRedisSerializer in a  RedisTemplate. So i changed the xml file :
>>>
>>> <?xml version="1.0" encoding="UTF8"?>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>>
>>> <bean id="redisConnectionFactory"
>>> class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
>>>  <property name="hostName" value="ip.of.server" />
>>> <property name="port" value="6379"/>
>>>  </bean>
>>>  <bean id="stringRedisSerializer"
>>> class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
>>>  <bean id="RedisTemplate"
>>> class="org.springframework.data.redis.core.StringRedisTemplate">
>>>  <property name="connectionFactory" ref="redisConnectionFactory"/>
>>> <property name="keySerializer" ref = "stringRedisSerializer"/>
>>>  <property name="hashKeySerializer" ref = "stringRedisSerializer"/>
>>> <property name="valueSerializer" ref = "stringRedisSerializer"/>
>>>  <property name="hashValueSerializer" ref = "stringRedisSerializer"/>
>>> </bean>
>>>  <camelContext xmlns="http://camel.apache.org/schema/blueprint"
>>> id="monAutreContXML">
>>>  <route>
>>> <from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>>>  <setHeader headerName="CamelRedis.Key">
>>> <constant>myKey</constant>
>>>  </setHeader>
>>> <to uri="stream:out"/>
>>>  <to uri="
>>> spring-redis://redhishost?command=SET&amp;redisTemplate=#RedisTemplate
>>> "/></route>
>>>  </camelContext>
>>> </blueprint>
>>>
>>> But when I try to deploy it, I get the following error message in the
>>> karaf log :
>>>
>>> 2013-05-28 14:24:58,779 | ERROR | rint Extender: 3 |
>>> BlueprintContainerImpl           | container.BlueprintContainerImpl  393 |
>>> 7 - org.apache.aries.blueprint.c
>>> ore - 1.1.0 | Unable to start blueprint container for bundle
>>> camel-test.xml
>>> org.osgi.service.blueprint.container.ComponentDefinitionException: Error
>>> setting property: PropertyDescriptor <name: keySerializer, getter: class
>>> org.springfram
>>> ework.data.redis.core.RedisTemplate.getKeySerializer(), setter: [class
>>> org.springframework.data.redis.core.RedisTemplate.setKeySerializer(interface
>>> org.springfr
>>> amework.data.redis.serializer.RedisSerializer)]
>>>         at
>>> org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>>         at
>>> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.
>>> core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>>         at
>>> org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_21]
>>>         at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_21]
>>>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
>>> Caused by: java.lang.Exception: Unable to convert value
>>> org.springframework.data.redis.serializer.StringRedisSerializer@7e15f62eto type org.springframework.dat
>>> a.redis.serializer.RedisSerializer<java.lang.Object>
>>>         at
>>> org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[7:org.apache.aries.blueprint.core:1.1
>>> .0]
>>>         at
>>> org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         at
>>> org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[7:org.apache.aries.blueprint.core:1.1.0]
>>>         ... 26 more
>>>
>>> I don't understand the error, as the class is implementing the
>>> interface. Am I missing something, or is it impossible to do it with just
>>> xml ?
>>>
>>> Best regards,
>>> Djee
>>>
>>>
>>> On 27 May 2013 14:33, Djeeaie . <dj...@gmail.com> wrote:
>>>
>>>> Hi,
>>>> While using a spring-redis uri in karaf, I had an issue with setting
>>>> the key using a xml blueprint. Here is the blue print :
>>>>
>>>> <?xml version="1.0" encoding="UTF8"?>
>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>>>     <camelContext xmlns="http://camel.apache.org/schema/blueprint"
>>>> id="monAutreContXML">
>>>>         <route>
>>>> <from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>>>>  <setHeader headerName="CamelRedis.Key">
>>>> <constant>test</constant>
>>>>  </setHeader>
>>>> <to uri="spring-redis://ip.of.server?command=SET"/>
>>>>  <to uri="stream:out"/>
>>>>         </route>
>>>>     </camelContext>
>>>> </blueprint>
>>>>
>>>> The route to stream:out works, ans the redis one too. But, when i type
>>>> "keys test" in redis, instead of test, I get nothing. I have to use "keys
>>>> *" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the
>>>> constant part with other test values seems to be \xac\xed\x00\x05t\x00.
>>>>
>>>> It looks like it's a Java serialization issue, so I would like to know
>>>> if it's possible to fix this by using only a xml blueprint ?
>>>>
>>>> Karaf : 2.3.1
>>>> Camel : 2.11
>>>> Redis : 2.6.13
>>>> Java : 1.7
>>>>
>>>> Thanks in advance,
>>>> Djee
>>>>
>>>
>>>
>>>
>>> --
>>> Benhamiche Sylvain
>>>
>>>
>>>
>>
>>
>> --
>> Benhamiche Sylvain
>>
>>
>>
>
>
> --
> Benhamiche Sylvain
>



-- 
Benhamiche Sylvain

Re: Encoding issue for Redis key using xml blueprint

Posted by "Djeeaie ." <dj...@gmail.com>.
I'm not sure how to really check this. I have only one of my own bundle
deployed while testing, and here's the result of the list command :

karaf@root> list
START LEVEL 100 , List Threshold: 50
   ID   State         Blueprint      Spring    Level  Name
[  62] [Active     ] [            ] [       ] [   50] camel-core (2.11.0)
[  63] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands
(2.11.0)
[  78] [Active     ] [            ] [       ] [   50] geronimo-jta_1.1_spec
(1.1.1)
[  79] [Active     ] [            ] [       ] [   50] camel-spring (2.11.0)
[  80] [Active     ] [Created     ] [       ] [   50] camel-blueprint
(2.11.0)
[ 109] [Active     ] [            ] [       ] [   50] Commons Codec (1.6.0)
[ 110] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: commons-beanutils (1.8.3.1)
[ 111] [Active     ] [            ] [       ] [   50] Commons Collections
(3.2.1)
[ 112] [Active     ] [            ] [       ] [   50] Commons Configuration
(1.8.0)
[ 113] [Active     ] [            ] [       ] [   50] Commons Digester (2.1)
[ 114] [Active     ] [            ] [       ] [   50] Commons JXPath (1.3)
[ 115] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: jdom (1.1.0.4)
[ 116] [Active     ] [            ] [       ] [   50] Commons Lang (2.6)
[ 117] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: ant (1.7.0.6)
[ 118] [Active     ] [            ] [       ] [   50] Commons Daemon (1.0.5)
[ 119] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: commons-httpclient (3.1.0.7)
[ 120] [Active     ] [            ] [       ] [   50] Commons Math (2.2)
[ 121] [Active     ] [            ] [       ] [   50] Commons Net (3.2.0)
[ 122] [Active     ] [            ] [       ] [   50] Jackson JSON
processor (1.9.12)
[ 123] [Active     ] [            ] [       ] [   50] Data mapper for
Jackson JSON processor (1.9.12)
[ 124] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: jetty (6.1.26.4)
[ 125] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: hadoop-core (1.1.1.1)
[ 126] [Active     ] [            ] [       ] [   50] camel-hdfs (2.11.0)
[ 127] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Specs :: JCR API 2.0 (2.2.0)
[ 128] [Active     ] [            ] [       ] [   50] Jackrabbit JCR
Commons (2.5.2)
[ 129] [Active     ] [            ] [       ] [   50] Jackrabbit WebDAV
Library (2.5.2)
[ 130] [Active     ] [            ] [       ] [   50] Commons JEXL (2.0.1)
[ 131] [Active     ] [            ] [       ] [   50] Commons VFS Core (2.0)
[ 132] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: xmlresolver (1.2.0.5)
[ 133] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: jsch (0.1.49.1)
[ 142] [Active     ] [            ] [       ] [   50] Commons Pool (1.6.0)
[ 143] [Active     ] [            ] [       ] [   50] Spring Data Redis
Support (1.0.3.RELEASE)
[ 144] [Active     ] [            ] [       ] [   50] Apache ServiceMix ::
Bundles :: jedis (2.1.0.1)
[ 145] [Active     ] [            ] [       ] [   50] camel-spring-redis
(2.11.0)
[ 147] [Active     ] [            ] [       ] [   50] camel-http (2.11.0)
[ 158] [Active     ] [            ] [       ] [   50] camel-stream (2.11.0)
[ 170] [Active     ] [Failure     ] [       ] [   80] camel-test.xml (0.0.0)

Best regards,
Djee


On 29 May 2013 10:17, Freeman Fang <fr...@gmail.com> wrote:

> Hi,
>
> Please check and ensure there's no multiple spring-data-redis bundle get
> installed in your container.
>
> -------------
> Freeman(Yue) Fang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: @Freeman小屋
>
> www.camelone.org : The open source integration conference:
>
> On 2013-5-29, at 下午3:05, Djeeaie . wrote:
>
> Hi,
>
> Thanks for the help. Here is the result :
>
> karaf@root> osgi:headers camel-test
>
> Bundle 170
> ----------
> Manifest-Version = 2
>
> Bundle-SymbolicName = camel-test.xml
> Bundle-Version = 0.0.0
> Bundle-ManifestVersion = 2
>
> DynamicImport-Package =
>         *
> Import-Package =
>         org.springframework.data.redis.connection.jedis,
>         org.springframework.data.redis.core,
>         org.springframework.data.redis.serializer
>
> Best regards,
> Djee
>
>
> On 29 May 2013 03:14, Freeman Fang <fr...@gmail.com> wrote:
>
>> Hi,
>>
>> This could be caused by your customer bundle miss some package or your
>> customer bundle embed spring jars.
>>
>> Please post the result of
>> osgi:headers your_bundle_id
>>      -------------
>> Freeman(Yue) Fang
>>
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Web: http://fusesource.com | http://www.redhat.com/
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> http://blog.sina.com.cn/u/1473905042
>> weibo: @Freeman小屋
>>
>> www.camelone.org : The open source integration conference:
>>
>> On 2013-5-28, at 下午8:19, Djeeaie . wrote:
>>
>> Hi,
>>
>> here comes some new stuff. I digged into it and found out I needed a
>> StringRedisSerializer in a  RedisTemplate. So i changed the xml file :
>>
>> <?xml version="1.0" encoding="UTF8"?>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>
>> <bean id="redisConnectionFactory"
>> class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
>>  <property name="hostName" value="ip.of.server" />
>> <property name="port" value="6379"/>
>>  </bean>
>>  <bean id="stringRedisSerializer"
>> class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
>>  <bean id="RedisTemplate"
>> class="org.springframework.data.redis.core.StringRedisTemplate">
>>  <property name="connectionFactory" ref="redisConnectionFactory"/>
>> <property name="keySerializer" ref = "stringRedisSerializer"/>
>>  <property name="hashKeySerializer" ref = "stringRedisSerializer"/>
>> <property name="valueSerializer" ref = "stringRedisSerializer"/>
>>  <property name="hashValueSerializer" ref = "stringRedisSerializer"/>
>> </bean>
>>  <camelContext xmlns="http://camel.apache.org/schema/blueprint"
>> id="monAutreContXML">
>>  <route>
>> <from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>>  <setHeader headerName="CamelRedis.Key">
>> <constant>myKey</constant>
>>  </setHeader>
>> <to uri="stream:out"/>
>>  <to uri="
>> spring-redis://redhishost?command=SET&amp;redisTemplate=#RedisTemplate
>> "/></route>
>>  </camelContext>
>> </blueprint>
>>
>> But when I try to deploy it, I get the following error message in the
>> karaf log :
>>
>> 2013-05-28 14:24:58,779 | ERROR | rint Extender: 3 |
>> BlueprintContainerImpl           | container.BlueprintContainerImpl  393 |
>> 7 - org.apache.aries.blueprint.c
>> ore - 1.1.0 | Unable to start blueprint container for bundle
>> camel-test.xml
>> org.osgi.service.blueprint.container.ComponentDefinitionException: Error
>> setting property: PropertyDescriptor <name: keySerializer, getter: class
>> org.springfram
>> ework.data.redis.core.RedisTemplate.getKeySerializer(), setter: [class
>> org.springframework.data.redis.core.RedisTemplate.setKeySerializer(interface
>> org.springfr
>> amework.data.redis.serializer.RedisSerializer)]
>>         at
>> org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>         at
>> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>         at
>> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.
>> core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>         at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>         at
>> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>         at
>> org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>         at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>         at
>> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>         at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_21]
>>         at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_21]
>>         at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_21]
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_21]
>>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
>> Caused by: java.lang.Exception: Unable to convert value
>> org.springframework.data.redis.serializer.StringRedisSerializer@7e15f62eto type org.springframework.dat
>> a.redis.serializer.RedisSerializer<java.lang.Object>
>>         at
>> org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[7:org.apache.aries.blueprint.core:1.1
>> .0]
>>         at
>> org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at
>> org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[7:org.apache.aries.blueprint.core:1.1.0]
>>         ... 26 more
>>
>> I don't understand the error, as the class is implementing the interface.
>> Am I missing something, or is it impossible to do it with just xml ?
>>
>> Best regards,
>> Djee
>>
>>
>> On 27 May 2013 14:33, Djeeaie . <dj...@gmail.com> wrote:
>>
>>> Hi,
>>> While using a spring-redis uri in karaf, I had an issue with setting the
>>> key using a xml blueprint. Here is the blue print :
>>>
>>> <?xml version="1.0" encoding="UTF8"?>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>>     <camelContext xmlns="http://camel.apache.org/schema/blueprint"
>>> id="monAutreContXML">
>>>         <route>
>>> <from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>>>  <setHeader headerName="CamelRedis.Key">
>>> <constant>test</constant>
>>>  </setHeader>
>>> <to uri="spring-redis://ip.of.server?command=SET"/>
>>>  <to uri="stream:out"/>
>>>         </route>
>>>     </camelContext>
>>> </blueprint>
>>>
>>> The route to stream:out works, ans the redis one too. But, when i type
>>> "keys test" in redis, instead of test, I get nothing. I have to use "keys
>>> *" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the
>>> constant part with other test values seems to be \xac\xed\x00\x05t\x00.
>>>
>>> It looks like it's a Java serialization issue, so I would like to know
>>> if it's possible to fix this by using only a xml blueprint ?
>>>
>>> Karaf : 2.3.1
>>> Camel : 2.11
>>> Redis : 2.6.13
>>> Java : 1.7
>>>
>>> Thanks in advance,
>>> Djee
>>>
>>
>>
>>
>> --
>> Benhamiche Sylvain
>>
>>
>>
>
>
> --
> Benhamiche Sylvain
>
>
>


-- 
Benhamiche Sylvain

Re: Encoding issue for Redis key using xml blueprint

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Please check and ensure there's no multiple spring-data-redis bundle get installed in your container.
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋

www.camelone.org : The open source integration conference: 

On 2013-5-29, at 下午3:05, Djeeaie . wrote:

> Hi,
> 
> Thanks for the help. Here is the result :
> 
> karaf@root> osgi:headers camel-test
> 
> Bundle 170
> ----------
> Manifest-Version = 2
> 
> Bundle-SymbolicName = camel-test.xml
> Bundle-Version = 0.0.0
> Bundle-ManifestVersion = 2
> 
> DynamicImport-Package =
>         *
> Import-Package =
>         org.springframework.data.redis.connection.jedis,
>         org.springframework.data.redis.core,
>         org.springframework.data.redis.serializer
> 
> Best regards,
> Djee
> 
> 
> On 29 May 2013 03:14, Freeman Fang <fr...@gmail.com> wrote:
> Hi,
> 
> This could be caused by your customer bundle miss some package or your customer bundle embed spring jars.
> 
> Please post the result of 
> osgi:headers your_bundle_id
> -------------
> Freeman(Yue) Fang
> 
> Red Hat, Inc. 
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: @Freeman小屋
> 
> www.camelone.org : The open source integration conference: 
> 
> On 2013-5-28, at 下午8:19, Djeeaie . wrote:
> 
>> Hi,
>> 
>> here comes some new stuff. I digged into it and found out I needed a StringRedisSerializer in a  RedisTemplate. So i changed the xml file :
>> 
>> <?xml version="1.0" encoding="UTF8"?>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>> 
>> 	<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
>> 		<property name="hostName" value="ip.of.server" />
>> 		<property name="port" value="6379"/>
>> 	</bean>
>> 	
>> 	<bean id="stringRedisSerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
>> 	<bean id="RedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
>> 		<property name="connectionFactory" ref="redisConnectionFactory"/>
>> 		<property name="keySerializer" ref = "stringRedisSerializer"/>
>> 		<property name="hashKeySerializer" ref = "stringRedisSerializer"/>
>> 		<property name="valueSerializer" ref = "stringRedisSerializer"/>
>> 		<property name="hashValueSerializer" ref = "stringRedisSerializer"/>
>> 	</bean>
>> 		<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="monAutreContXML">
>> 			<route>
>> 			<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>> 				<setHeader headerName="CamelRedis.Key">
>> 					<constant>myKey</constant>
>> 				</setHeader>
>> 			<to uri="stream:out"/>
>> 			<to uri="spring-redis://redhishost?command=SET&amp;redisTemplate=#RedisTemplate"/></route>
>> 		</camelContext> 
>> </blueprint>
>> 
>> But when I try to deploy it, I get the following error message in the karaf log :
>> 
>> 2013-05-28 14:24:58,779 | ERROR | rint Extender: 3 | BlueprintContainerImpl           | container.BlueprintContainerImpl  393 | 7 - org.apache.aries.blueprint.c
>> ore - 1.1.0 | Unable to start blueprint container for bundle camel-test.xml
>> org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: keySerializer, getter: class org.springfram
>> ework.data.redis.core.RedisTemplate.getKeySerializer(), setter: [class org.springframework.data.redis.core.RedisTemplate.setKeySerializer(interface org.springfr
>> amework.data.redis.serializer.RedisSerializer)]
>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.
>> core:1.1.0]
>>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>         at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_21]
>>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_21]
>>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_21]
>>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_21]
>>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
>> Caused by: java.lang.Exception: Unable to convert value org.springframework.data.redis.serializer.StringRedisSerializer@7e15f62e to type org.springframework.dat
>> a.redis.serializer.RedisSerializer<java.lang.Object>
>>         at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[7:org.apache.aries.blueprint.core:1.1
>> .0]
>>         at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[7:org.apache.aries.blueprint.core:1.1.0]
>>         at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[7:org.apache.aries.blueprint.core:1.1.0]
>>         ... 26 more
>> 
>> I don't understand the error, as the class is implementing the interface. Am I missing something, or is it impossible to do it with just xml ?
>> 
>> Best regards,
>> Djee
>> 
>> 
>> On 27 May 2013 14:33, Djeeaie . <dj...@gmail.com> wrote:
>> Hi,
>> While using a spring-redis uri in karaf, I had an issue with setting the key using a xml blueprint. Here is the blue print :
>> 
>> <?xml version="1.0" encoding="UTF8"?>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>     <camelContext xmlns="http://camel.apache.org/schema/blueprint" id="monAutreContXML">
>>         <route>
>> 		<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>> 			<setHeader headerName="CamelRedis.Key">
>> 				<constant>test</constant>
>> 			</setHeader>
>> 		<to uri="spring-redis://ip.of.server?command=SET"/>
>> 		<to uri="stream:out"/>
>>         </route>
>>     </camelContext>
>> </blueprint> 
>> 
>> The route to stream:out works, ans the redis one too. But, when i type "keys test" in redis, instead of test, I get nothing. I have to use "keys *" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the constant part with other test values seems to be \xac\xed\x00\x05t\x00.
>> 
>> It looks like it's a Java serialization issue, so I would like to know if it's possible to fix this by using only a xml blueprint ?
>> 
>> Karaf : 2.3.1
>> Camel : 2.11
>> Redis : 2.6.13
>> Java : 1.7
>> 
>> Thanks in advance,
>> Djee
>> 
>> 
>> 
>> -- 
>> Benhamiche Sylvain
> 
> 
> 
> 
> -- 
> Benhamiche Sylvain


Re: Encoding issue for Redis key using xml blueprint

Posted by "Djeeaie ." <dj...@gmail.com>.
Hi,

Thanks for the help. Here is the result :

karaf@root> osgi:headers camel-test

Bundle 170
----------
Manifest-Version = 2

Bundle-SymbolicName = camel-test.xml
Bundle-Version = 0.0.0
Bundle-ManifestVersion = 2

DynamicImport-Package =
        *
Import-Package =
        org.springframework.data.redis.connection.jedis,
        org.springframework.data.redis.core,
        org.springframework.data.redis.serializer

Best regards,
Djee


On 29 May 2013 03:14, Freeman Fang <fr...@gmail.com> wrote:

> Hi,
>
> This could be caused by your customer bundle miss some package or your
> customer bundle embed spring jars.
>
> Please post the result of
> osgi:headers your_bundle_id
> -------------
> Freeman(Yue) Fang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: @Freeman小屋
>
> www.camelone.org : The open source integration conference:
>
> On 2013-5-28, at 下午8:19, Djeeaie . wrote:
>
> Hi,
>
> here comes some new stuff. I digged into it and found out I needed a
> StringRedisSerializer in a  RedisTemplate. So i changed the xml file :
>
> <?xml version="1.0" encoding="UTF8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>
> <bean id="redisConnectionFactory"
> class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
>  <property name="hostName" value="ip.of.server" />
> <property name="port" value="6379"/>
>  </bean>
>  <bean id="stringRedisSerializer"
> class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
>  <bean id="RedisTemplate"
> class="org.springframework.data.redis.core.StringRedisTemplate">
>  <property name="connectionFactory" ref="redisConnectionFactory"/>
> <property name="keySerializer" ref = "stringRedisSerializer"/>
>  <property name="hashKeySerializer" ref = "stringRedisSerializer"/>
> <property name="valueSerializer" ref = "stringRedisSerializer"/>
>  <property name="hashValueSerializer" ref = "stringRedisSerializer"/>
> </bean>
>  <camelContext xmlns="http://camel.apache.org/schema/blueprint"
> id="monAutreContXML">
>  <route>
> <from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>  <setHeader headerName="CamelRedis.Key">
> <constant>myKey</constant>
>  </setHeader>
> <to uri="stream:out"/>
>  <to uri="
> spring-redis://redhishost?command=SET&amp;redisTemplate=#RedisTemplate
> "/></route>
>  </camelContext>
> </blueprint>
>
> But when I try to deploy it, I get the following error message in the
> karaf log :
>
> 2013-05-28 14:24:58,779 | ERROR | rint Extender: 3 |
> BlueprintContainerImpl           | container.BlueprintContainerImpl  393 |
> 7 - org.apache.aries.blueprint.c
> ore - 1.1.0 | Unable to start blueprint container for bundle camel-test.xml
> org.osgi.service.blueprint.container.ComponentDefinitionException: Error
> setting property: PropertyDescriptor <name: keySerializer, getter: class
> org.springfram
> ework.data.redis.core.RedisTemplate.getKeySerializer(), setter: [class
> org.springframework.data.redis.core.RedisTemplate.setKeySerializer(interface
> org.springfr
> amework.data.redis.serializer.RedisSerializer)]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>         at
> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>         at
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.
> core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>         at
> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>         at
> org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>         at
> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_21]
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_21]
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_21]
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_21]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
> Caused by: java.lang.Exception: Unable to convert value
> org.springframework.data.redis.serializer.StringRedisSerializer@7e15f62eto type org.springframework.dat
> a.redis.serializer.RedisSerializer<java.lang.Object>
>         at
> org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[7:org.apache.aries.blueprint.core:1.1
> .0]
>         at
> org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[7:org.apache.aries.blueprint.core:1.1.0]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[7:org.apache.aries.blueprint.core:1.1.0]
>         ... 26 more
>
> I don't understand the error, as the class is implementing the interface.
> Am I missing something, or is it impossible to do it with just xml ?
>
> Best regards,
> Djee
>
>
> On 27 May 2013 14:33, Djeeaie . <dj...@gmail.com> wrote:
>
>> Hi,
>> While using a spring-redis uri in karaf, I had an issue with setting the
>> key using a xml blueprint. Here is the blue print :
>>
>> <?xml version="1.0" encoding="UTF8"?>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>>     <camelContext xmlns="http://camel.apache.org/schema/blueprint"
>> id="monAutreContXML">
>>         <route>
>> <from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>>  <setHeader headerName="CamelRedis.Key">
>> <constant>test</constant>
>>  </setHeader>
>> <to uri="spring-redis://ip.of.server?command=SET"/>
>>  <to uri="stream:out"/>
>>         </route>
>>     </camelContext>
>> </blueprint>
>>
>> The route to stream:out works, ans the redis one too. But, when i type
>> "keys test" in redis, instead of test, I get nothing. I have to use "keys
>> *" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the
>> constant part with other test values seems to be \xac\xed\x00\x05t\x00.
>>
>> It looks like it's a Java serialization issue, so I would like to know if
>> it's possible to fix this by using only a xml blueprint ?
>>
>> Karaf : 2.3.1
>> Camel : 2.11
>> Redis : 2.6.13
>> Java : 1.7
>>
>> Thanks in advance,
>> Djee
>>
>
>
>
> --
> Benhamiche Sylvain
>
>
>


-- 
Benhamiche Sylvain

Re: Encoding issue for Redis key using xml blueprint

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

This could be caused by your customer bundle miss some package or your customer bundle embed spring jars.

Please post the result of 
osgi:headers your_bundle_id
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋

www.camelone.org : The open source integration conference: 

On 2013-5-28, at 下午8:19, Djeeaie . wrote:

> Hi,
> 
> here comes some new stuff. I digged into it and found out I needed a StringRedisSerializer in a  RedisTemplate. So i changed the xml file :
> 
> <?xml version="1.0" encoding="UTF8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
> 
> 	<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
> 		<property name="hostName" value="ip.of.server" />
> 		<property name="port" value="6379"/>
> 	</bean>
> 	
> 	<bean id="stringRedisSerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
> 	<bean id="RedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
> 		<property name="connectionFactory" ref="redisConnectionFactory"/>
> 		<property name="keySerializer" ref = "stringRedisSerializer"/>
> 		<property name="hashKeySerializer" ref = "stringRedisSerializer"/>
> 		<property name="valueSerializer" ref = "stringRedisSerializer"/>
> 		<property name="hashValueSerializer" ref = "stringRedisSerializer"/>
> 	</bean>
> 		<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="monAutreContXML">
> 			<route>
> 			<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
> 				<setHeader headerName="CamelRedis.Key">
> 					<constant>myKey</constant>
> 				</setHeader>
> 			<to uri="stream:out"/>
> 			<to uri="spring-redis://redhishost?command=SET&amp;redisTemplate=#RedisTemplate"/></route>
> 		</camelContext> 
> </blueprint>
> 
> But when I try to deploy it, I get the following error message in the karaf log :
> 
> 2013-05-28 14:24:58,779 | ERROR | rint Extender: 3 | BlueprintContainerImpl           | container.BlueprintContainerImpl  393 | 7 - org.apache.aries.blueprint.c
> ore - 1.1.0 | Unable to start blueprint container for bundle camel-test.xml
> org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: keySerializer, getter: class org.springfram
> ework.data.redis.core.RedisTemplate.getKeySerializer(), setter: [class org.springframework.data.redis.core.RedisTemplate.setKeySerializer(interface org.springfr
> amework.data.redis.serializer.RedisSerializer)]
>         at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.
> core:1.1.0]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>         at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_21]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_21]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_21]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_21]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
> Caused by: java.lang.Exception: Unable to convert value org.springframework.data.redis.serializer.StringRedisSerializer@7e15f62e to type org.springframework.dat
> a.redis.serializer.RedisSerializer<java.lang.Object>
>         at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[7:org.apache.aries.blueprint.core:1.1
> .0]
>         at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[7:org.apache.aries.blueprint.core:1.1.0]
>         at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[7:org.apache.aries.blueprint.core:1.1.0]
>         ... 26 more
> 
> I don't understand the error, as the class is implementing the interface. Am I missing something, or is it impossible to do it with just xml ?
> 
> Best regards,
> Djee
> 
> 
> On 27 May 2013 14:33, Djeeaie . <dj...@gmail.com> wrote:
> Hi,
> While using a spring-redis uri in karaf, I had an issue with setting the key using a xml blueprint. Here is the blue print :
> 
> <?xml version="1.0" encoding="UTF8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>     <camelContext xmlns="http://camel.apache.org/schema/blueprint" id="monAutreContXML">
>         <route>
> 		<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
> 			<setHeader headerName="CamelRedis.Key">
> 				<constant>test</constant>
> 			</setHeader>
> 		<to uri="spring-redis://ip.of.server?command=SET"/>
> 		<to uri="stream:out"/>
>         </route>
>     </camelContext>
> </blueprint> 
> 
> The route to stream:out works, ans the redis one too. But, when i type "keys test" in redis, instead of test, I get nothing. I have to use "keys *" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the constant part with other test values seems to be \xac\xed\x00\x05t\x00.
> 
> It looks like it's a Java serialization issue, so I would like to know if it's possible to fix this by using only a xml blueprint ?
> 
> Karaf : 2.3.1
> Camel : 2.11
> Redis : 2.6.13
> Java : 1.7
> 
> Thanks in advance,
> Djee
> 
> 
> 
> -- 
> Benhamiche Sylvain


Re: Encoding issue for Redis key using xml blueprint

Posted by "Djeeaie ." <dj...@gmail.com>.
Hi,

here comes some new stuff. I digged into it and found out I needed a
StringRedisSerializer in a  RedisTemplate. So i changed the xml file :

<?xml version="1.0" encoding="UTF8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">

<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="hostName" value="ip.of.server" />
<property name="port" value="6379"/>
</bean>
 <bean id="stringRedisSerializer"
class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
<bean id="RedisTemplate"
class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory" ref="redisConnectionFactory"/>
<property name="keySerializer" ref = "stringRedisSerializer"/>
<property name="hashKeySerializer" ref = "stringRedisSerializer"/>
<property name="valueSerializer" ref = "stringRedisSerializer"/>
<property name="hashValueSerializer" ref = "stringRedisSerializer"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint"
id="monAutreContXML">
<route>
<from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
<setHeader headerName="CamelRedis.Key">
<constant>myKey</constant>
</setHeader>
<to uri="stream:out"/>
<to
uri="spring-redis://redhishost?command=SET&amp;redisTemplate=#RedisTemplate"/></route>
</camelContext>
</blueprint>

But when I try to deploy it, I get the following error message in the karaf
log :

2013-05-28 14:24:58,779 | ERROR | rint Extender: 3 | BlueprintContainerImpl
          | container.BlueprintContainerImpl  393 | 7 -
org.apache.aries.blueprint.c
ore - 1.1.0 | Unable to start blueprint container for bundle camel-test.xml
org.osgi.service.blueprint.container.ComponentDefinitionException: Error
setting property: PropertyDescriptor <name: keySerializer, getter: class
org.springfram
ework.data.redis.core.RedisTemplate.getKeySerializer(), setter: [class
org.springframework.data.redis.core.RedisTemplate.setKeySerializer(interface
org.springfr
amework.data.redis.serializer.RedisSerializer)]
        at
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
        at
java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
        at
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:668)[7:org.apache.aries.blueprint.
core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:370)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
        at
java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
        at
org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_21]
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
        at
java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_21]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_21]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_21]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_21]
        at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
Caused by: java.lang.Exception: Unable to convert value
org.springframework.data.redis.serializer.StringRedisSerializer@7e15f62e to
type org.springframework.dat
a.redis.serializer.RedisSerializer<java.lang.Object>
        at
org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:184)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[7:org.apache.aries.blueprint.core:1.1
.0]
        at
org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[7:org.apache.aries.blueprint.core:1.1.0]
        at
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[7:org.apache.aries.blueprint.core:1.1.0]
        ... 26 more

I don't understand the error, as the class is implementing the interface.
Am I missing something, or is it impossible to do it with just xml ?

Best regards,
Djee


On 27 May 2013 14:33, Djeeaie . <dj...@gmail.com> wrote:

> Hi,
> While using a spring-redis uri in karaf, I had an issue with setting the
> key using a xml blueprint. Here is the blue print :
>
> <?xml version="1.0" encoding="UTF8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
>     <camelContext xmlns="http://camel.apache.org/schema/blueprint"
> id="monAutreContXML">
>         <route>
> <from uri="stream:file?fileName=./inboxRedis/test&amp;scanStream=true"/>
>  <setHeader headerName="CamelRedis.Key">
> <constant>test</constant>
>  </setHeader>
> <to uri="spring-redis://ip.of.server?command=SET"/>
>  <to uri="stream:out"/>
>         </route>
>     </camelContext>
> </blueprint>
>
> The route to stream:out works, ans the redis one too. But, when i type
> "keys test" in redis, instead of test, I get nothing. I have to use "keys
> *" to get \xac\xed\x00\x05t\x00\x04test, and its content is null. the
> constant part with other test values seems to be \xac\xed\x00\x05t\x00.
>
> It looks like it's a Java serialization issue, so I would like to know if
> it's possible to fix this by using only a xml blueprint ?
>
> Karaf : 2.3.1
> Camel : 2.11
> Redis : 2.6.13
> Java : 1.7
>
> Thanks in advance,
> Djee
>



-- 
Benhamiche Sylvain