You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Aaron Riekenberg (JIRA)" <ji...@apache.org> on 2010/10/01 14:42:40 UTC
[jira] Created: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
@EndpointInject not working in bean created by blueprint
--------------------------------------------------------
Key: CAMEL-3186
URL: https://issues.apache.org/activemq/browse/CAMEL-3186
Project: Apache Camel
Issue Type: Bug
Components: camel-blueprint
Affects Versions: 2.4.0
Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
Reporter: Aaron Riekenberg
Attachments: camel-blueprint-test.tar.gz
I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
@EndpointInject(ref = "testEndpoint")
private ProducerTemplate testEndpoint;
The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
java.lang.NullPointerException
at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-3186:
-------------------------------
Fix Version/s: 2.6.0
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Assignee: Willem Jiang
> Fix For: 2.6.0
>
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62286#action_62286 ]
Claus Ibsen commented on CAMEL-3186:
------------------------------------
Get in touch with gnodet what feature OSGi provides for IoC stuff which you need to hook into.
You should leverage {{org.apache.camel.impl.CamelPostProcessorHelper}} from camel-core. Just as the spring stuff do in camel-spring.
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Assignee: Willem Jiang
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62729#action_62729 ]
Willem Jiang commented on CAMEL-3186:
-------------------------------------
@Guillaume
I didn't find a way to associate my BeanProcessor with the ExtendedBeanMetadata.
Can you show me some code snippet for it ?
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Assignee: Willem Jiang
> Fix For: 2.6.0
>
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Aaron Riekenberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aaron Riekenberg updated CAMEL-3186:
------------------------------------
Attachment: camel-blueprint-test.tar.gz
Test project.
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62275#action_62275 ]
Claus Ibsen commented on CAMEL-3186:
------------------------------------
See
http://fusesource.com/forums/thread.jspa?threadID=2278&tstart=0
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Willem Jiang reassigned CAMEL-3186:
-----------------------------------
Assignee: Willem Jiang
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Assignee: Willem Jiang
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62730#action_62730 ]
Guillaume Nodet commented on CAMEL-3186:
----------------------------------------
Once you have your processor, you need to register the blueprint metadata.
You can find an example in the decorateManagedProperties method at http://svn.apache.org/repos/asf/incubator/aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
Note the call to metadata.setProcessor(true);
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Assignee: Willem Jiang
> Fix For: 2.6.0
>
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3186) @EndpointInject not working in bean
created by blueprint
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62309#action_62309 ]
Guillaume Nodet commented on CAMEL-3186:
----------------------------------------
This is one of the few limitations of the blueprint stuff right now, but i think it should be fixed.
You need to uncomment line 99 of the blueprint CamelContextFactoryBean:
{code}
@XmlElement(name = "beanPostProcessor", type = CamelBeanPostProcessor.class, required = false),
{code}
So you need to create the appropriate CamelBeanPostProcessor class in the blueprint module.
To define a processor using Aries Blueprint, you need to have the class implement the org.apache.aries.blueprint.BeanProcessor interface and make sure the associated ExtendedBeanMetadata#isProcessor() returns true (this flag needs to be set in the namespace handler).
When that's done, you should be able to intercept bean creation / destruction events from the processor and do what's needed.
> @EndpointInject not working in bean created by blueprint
> --------------------------------------------------------
>
> Key: CAMEL-3186
> URL: https://issues.apache.org/activemq/browse/CAMEL-3186
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 2.4.0
> Environment: Ubuntu Linux 10.04, Sun JDK 1.6.0_21
> Reporter: Aaron Riekenberg
> Assignee: Willem Jiang
> Attachments: camel-blueprint-test.tar.gz
>
>
> I am attaching a small test project that uses blueprint to create a camel context and a bean named Producer. This project builds an OSGi bundle that I am deploying in FUSE ESB 4.3.0-fuse-01-00. The Producer bean has an @EndpointInject annotation on a ProducerTemplate:
> @EndpointInject(ref = "testEndpoint")
> private ProducerTemplate testEndpoint;
> The Producer bean's init method sets a timer that tries to call testEndpoint.sendBody() once per second. This throws a null pointer exception because the testEndpoint did not get injected:
> 07:35:31,826 | WARN | Producer | Producer | org.aaron.camel.Producer 51 | 118 - org.aaron.camel - 1.0.0.SNAPSHOT | send exception
> java.lang.NullPointerException
> at org.aaron.camel.Producer.timerPop(Producer.java:48)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer.access$000(Producer.java:11)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at org.aaron.camel.Producer$1.run(Producer.java:29)[118:org.aaron.camel:1.0.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:512)[:1.6.0_21]
> at java.util.TimerThread.run(Timer.java:462)[:1.6.0_21]
> This same test works perfectly if I use Spring DM to create the camel context and Producer bean.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.