karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Djee (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KARAF-2355) Encoding issue for Redis key using xml blueprint
Date Tue, 04 Jun 2013 08:54:23 GMT
Djee created KARAF-2355:
---------------------------

             Summary: Encoding issue for Redis key using xml blueprint
                 Key: KARAF-2355
                 URL: https://issues.apache.org/jira/browse/KARAF-2355
             Project: Karaf
          Issue Type: Bug
    Affects Versions: 2.3.1
         Environment: Karaf 2.3.1
Camel 2.11.0
JDK 1.7
            Reporter: Djee


When trying to use the spring-camel-redis feature with the first xml blueprint, I met the
issue of a wrong encoding for the keys. For example, the key "test" will be registered in
Redis as \xac\xed\x00\x05t\x00\x04test.

----

<?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>

----

 After some researches, it looks like it comes from the lack of a StringRedisSerializer in
a RedisTemplate. But, when I tried to create one in the second blueprint :

----

<?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://ip.of.server?command=SET&amp;redisTemplate=#RedisTemplate"/></route>
		</camelContext> 
</blueprint>

----

I got the following error :

----

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@1512df87
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

----

Here is the list of bundles installed and with only this blueprint in the deploy directory
:

----

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)
[ 172] [Active     ] [            ] [       ] [   50] camel-ftp (2.11.0)

----

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message