owain
2016-06-14 18:09:49 UTC
Apologies for the ugly original post.
I have set up a simple route to isolate the string serialization problem
that
I am experiencing, like others, the problem where the default jdk serializer
prepends "junk" at the start of the key and value, making it
difficult/impossible to perform integration testing.
There is a description of the serialization issue
http://stackoverflow.com/questions/32245916/redis-serialization-prefixed-with-extra-string.
Is it even possible to run this "spring-data" component within Blueprint?
I am using Blueprint and am struggling to get the following route working
from a Junit test.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/spring/camel-blueprint.xsd">
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="hostName" value="${redis.host}" />
<property name="port" value="${redis.port}"/>
</bean>
<bean
id="stringSerializer"
class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
<bean
id="i4pRedisTemplate"
class="org.springframework.data.redis.core.RedisTemplate">
<property name="defaultSerializer" ref="stringSerializer"/>
<property name="connectionFactory" ref="redisConnectionFactory"/>
</bean>
<routeContext id="camel-redis-route-context"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="camel-redis-route">
<from uri="direct:redis"/>
<log loggingLevel="INFO" message="Just about to call redis with
${in.headers}"/>
<to uri="spring-redis://x?redisTemplate=#i4pRedisTemplate"
id="callRedisWithHeaders"/>
</route>
</routeContext>
</blueprint>
When I run the unit test I get the following messages.
2016-06-14 15:43:27,223 [int Extender: 1] ERROR BlueprintContainerImpl
- Unable to start blueprint container for bundle IncrementCounterTest/1.0.0
org.osgi.service.blueprint.container.ComponentDefinitionException: Error
setting property: PropertyDescriptor <name: defaultSerializer, getter: class
org.springframework.data.redis.core.RedisTemplate.getDefaultSerializer(),
setter: [class
org.springframework.data.redis.core.RedisTemplate.setDefaultSerializer(interface
org.springframework.data.redis.serializer.RedisSerializer)]
at
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]
at
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:905)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]
at
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:886)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]
and further down the stack trace
java.lang.RuntimeException: Error setting property: PropertyDescriptor
<name: defaultSerializer, getter: class
org.springframework.data.redis.core.RedisTemplate.getDefaultSerializer(),
setter: [class
org.springframework.data.redis.core.RedisTemplate.setDefaultSerializer(interface
org.springframework.data.redis.serializer.RedisSerializer)]
at
org.apache.camel.test.blueprint.CamelBlueprintHelper.waitForBlueprintContainer(CamelBlueprintHelper.java:343)
at
org.apache.camel.test.blueprint.CamelBlueprintTestSupport.createBundleContext(CamelBlueprintTestSupport.java:154)
at
org.apache.camel.test.blueprint.CamelBlueprintTestSupport.setUp(CamelBlueprintTestSupport.java:220)
at
integration.technology.i4ip.counter.IncrementCounterTest.setUp(IncrementCounterTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
I suspect the Bean definitions and references are the problem. Or the # in
the uri?
I would love to see a working Blueprint example but I cannot seem to find
one which leads me to believe I am heading in the wrong direction with
Blueprint and Spring components.
Thanks for any help,
Owain.
--
View this message in context: http://camel.465427.n5.nabble.com/Repost-Unable-to-configure-component-spring-redis-RedisTemplate-with-Blueprint-XML-tp5784053.html
Sent from the Camel - Users mailing list archive at Nabble.com.
I have set up a simple route to isolate the string serialization problem
that
I am experiencing, like others, the problem where the default jdk serializer
prepends "junk" at the start of the key and value, making it
difficult/impossible to perform integration testing.
There is a description of the serialization issue
http://stackoverflow.com/questions/32245916/redis-serialization-prefixed-with-extra-string.
Is it even possible to run this "spring-data" component within Blueprint?
I am using Blueprint and am struggling to get the following route working
from a Junit test.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/spring/camel-blueprint.xsd">
<bean id="redisConnectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="hostName" value="${redis.host}" />
<property name="port" value="${redis.port}"/>
</bean>
<bean
id="stringSerializer"
class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
<bean
id="i4pRedisTemplate"
class="org.springframework.data.redis.core.RedisTemplate">
<property name="defaultSerializer" ref="stringSerializer"/>
<property name="connectionFactory" ref="redisConnectionFactory"/>
</bean>
<routeContext id="camel-redis-route-context"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="camel-redis-route">
<from uri="direct:redis"/>
<log loggingLevel="INFO" message="Just about to call redis with
${in.headers}"/>
<to uri="spring-redis://x?redisTemplate=#i4pRedisTemplate"
id="callRedisWithHeaders"/>
</route>
</routeContext>
</blueprint>
When I run the unit test I get the following messages.
2016-06-14 15:43:27,223 [int Extender: 1] ERROR BlueprintContainerImpl
- Unable to start blueprint container for bundle IncrementCounterTest/1.0.0
org.osgi.service.blueprint.container.ComponentDefinitionException: Error
setting property: PropertyDescriptor <name: defaultSerializer, getter: class
org.springframework.data.redis.core.RedisTemplate.getDefaultSerializer(),
setter: [class
org.springframework.data.redis.core.RedisTemplate.setDefaultSerializer(interface
org.springframework.data.redis.serializer.RedisSerializer)]
at
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]
at
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:905)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]
at
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:886)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]
and further down the stack trace
java.lang.RuntimeException: Error setting property: PropertyDescriptor
<name: defaultSerializer, getter: class
org.springframework.data.redis.core.RedisTemplate.getDefaultSerializer(),
setter: [class
org.springframework.data.redis.core.RedisTemplate.setDefaultSerializer(interface
org.springframework.data.redis.serializer.RedisSerializer)]
at
org.apache.camel.test.blueprint.CamelBlueprintHelper.waitForBlueprintContainer(CamelBlueprintHelper.java:343)
at
org.apache.camel.test.blueprint.CamelBlueprintTestSupport.createBundleContext(CamelBlueprintTestSupport.java:154)
at
org.apache.camel.test.blueprint.CamelBlueprintTestSupport.setUp(CamelBlueprintTestSupport.java:220)
at
integration.technology.i4ip.counter.IncrementCounterTest.setUp(IncrementCounterTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
I suspect the Bean definitions and references are the problem. Or the # in
the uri?
I would love to see a working Blueprint example but I cannot seem to find
one which leads me to believe I am heading in the wrong direction with
Blueprint and Spring components.
Thanks for any help,
Owain.
--
View this message in context: http://camel.465427.n5.nabble.com/Repost-Unable-to-configure-component-spring-redis-RedisTemplate-with-Blueprint-XML-tp5784053.html
Sent from the Camel - Users mailing list archive at Nabble.com.