|
|
|
Dan I have refined a sample in camel trunk that uses the aop autoproxy stuff and I can not reproduce the bug you have reported.
The sample is the camel-example-jms-spring. Can you give any hints how to reproduce the bug? Have you tried with a Camel 1.4 version? Please find a first release candidate of apache-camel-1.4.0 here: Or if using maven try the 1.4-SNAPSHOT version instead.
Thanks very much, Claus, for looking at this. I'm sorry I didn't find time to submit an example. I was using Camel 1.3.0. I'll try with 1.4. I haven't been able to find camel-example-jms-spring; could you point me to it?
Its in svn trunk.
However I can attach it to this jira as a .zip file later if you rather would like this, instead of having to checkout the code from svn. I did check out https://svn.apache.org/repos/asf/activemq/camel/trunk
[INFO] ------------------------------------------------------------------------ I got as far as downloading the JAXWS package manually and trying to follow its installation process, but so far I'm stuck there. I am assuming maven doesn't install that package automatically because it thinks of it as built into the JDK, but Sun doesn't install it automatically because it is javax (and hence an add-on)? I did review the Camel 1.4.0 source code to see if the problem appears to have been fixed, and it does not appear to have been. I assume the test you added was examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server-aop.xml. I find myself wondering whether the <aop:aspectj-autoproxy/> declaration in that file applies to the <camel:camelContext id="camel"> ? I am sure I had them in one file to start with. But then I changed to two files to cater for two kind of servers (with and without AOP) in the example.
Do you do anything special to proxy the camel bean? I am sure we can extract and interface and let Camel use this but I would like to have a unit test that demonstrates the bug before starting the refactoring. Here is the Spring configuration file in which the problem occurs. Note that the portion of the XML that actually declares the <camel:camelContext> (and thus triggers the problem) is commented out with a reference to this issue.
Hi Dean
Thanks for your spring file. I can see that the aspectj autoproxy declaration is in line 660 in your file. I dont suppose you do some fancy magic in this file that is relevant for this bug? And in your file the Camel XSD reference is Camel 1.2. What version are you exactly using of Camel? Dean I have tried a single file and can not reproduce the bug.
However I noticed this answer that has been there all the time ClassPathXmlApplicationContext INFO Bean 'camel' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) That means that the CamelBeanPostProcessor that is being created during post processing is not auto proxied. This is from the spring 2.5.3 source, in its AbstractApplicationContext public Object postProcessAfterInitialization(Object bean, String beanName) { if (!(bean instanceof BeanPostProcessor) && this.beanFactory.getBeanPostProcessorCount() < this.beanPostProcessorTargetCount) { if (logger.isInfoEnabled()) { logger.info("Bean '" + beanName + "' is not eligible for getting processed by all " + "BeanPostProcessors (for example: not eligible for auto-proxying)"); } } return bean; } But I am running the example with Spring 2.5.4. What version of Spring are you using? I tried the example-spring-jms with Camel 1.3.0 and it also works out-of-the-box
D:\project\camel\examples\camel-example-spring-jms>mvn clean compile exec:java -PCamelServer494 [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'exec'. [INFO] ------------------------------------------------------------------------ [INFO] Building Camel :: Example :: Spring :: JMS [INFO] task-segment: [clean, compile, exec:java] [INFO] ------------------------------------------------------------------------ [INFO] [clean:clean] [INFO] Deleting directory D:\project\camel\examples\camel-example-spring-jms\target [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Compiling 6 source files to D:\project\camel\examples\camel-example-spring-jms\target\classes [INFO] Preparing exec:java [INFO] No goals needed for project - skipping [INFO] [exec:java] [pache.camel.spring.Main.main()] Main INFO Apache Camel 1.3.0 starting [pache.camel.spring.Main.main()] ClassPathXmlApplicationContext INFO Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@19fe451: display name [org.springframework.context.support.ClassPathXmlApplicationContext@19fe451]; startup date [Tue Jun 10 06:38:16 CEST 2008]; root o f context hierarchy [pache.camel.spring.Main.main()] XmlBeanDefinitionReader INFO Loading XML bean definitions from class path resource [META-INF/spring/camel-494.xml] [pache.camel.spring.Main.main()] ClassPathXmlApplicationContext INFO Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@19fe451]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1757337 [pache.camel.spring.Main.main()] ClassPathXmlApplicationContext INFO Bean 'org.apache.camel.example.server.ServerRoutes' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) [pache.camel.spring.Main.main()] ClassPathXmlApplicationContext INFO Bean 'Claus' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) [pache.camel.spring.Main.main()] ClassPathXmlApplicationContext INFO Bean 'Claus' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) [pache.camel.spring.Main.main()] DefaultListableBeanFactory INFO Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1757337: defining beans [multiplier,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframewor k.context.annotation.internalAutowiredAnnotationProcessor,Claus:beanPostProcessor,Claus,AuditTracker,AuditStore,jms,org.apache.activemq.xbean.XBeanBrokerService#0,org.springframework.aop.config.internalAutoProxyCreator]; root of factory hierarchy [pache.camel.spring.Main.main()] BrokerService INFO Using Persistence Adapter: MemoryPersistenceAdapter [pache.camel.spring.Main.main()] BrokerService INFO ActiveMQ 5.1.0 JMS Message Broker (localhost) is starting [pache.camel.spring.Main.main()] BrokerService INFO For help or more information please see: http://activemq.apache.org/ [pache.camel.spring.Main.main()] TransportServerThreadSupport INFO Listening for connections at: tcp://claus-acer:61616 [pache.camel.spring.Main.main()] TransportConnector INFO Connector tcp Started [pache.camel.spring.Main.main()] BrokerService INFO ActiveMQ JMS Message Broker (localhost, ID:claus-acer-2460-1213072701953-0:0) started [pache.camel.spring.Main.main()] TransportConnector INFO Connector vm://localhost Started Thanks for all of your hard work on this, Claus! I am enclosing the "spring-magic.xml" file that you asked about.
Claus, I think I should take the next step on this end. If you are able to help me get unstuck and take it,
that would be great. But in any case, I need to reproduce my problem on a small test case. Since I was unable to compile the project in maven (as I reported above), I decided to try to use maven to generate an IntelliJ IDEA project. That failed too: Downloading: http://people.apache.org/repo/m2-incubating-repository/org/apache/camel/maven-html-to-pdf/1.4-SNAPSHOT/maven-html-to-pdf-1.4-SNAPSHOT.jar Try downloading the file manually from the project website. Then, install it using the command: Alternatively, if you host your own repository you can deploy the file there: org.apache.camel:maven-html-to-pdf:maven-plugin:1.4-SNAPSHOT from the specified remote repositories: org.apache.camel:maven-html-to-pdf:maven-plugin:1.4-SNAPSHOT from the specified remote repositories: If you are able to help with either a native Maven compile or a Maven -> Idea conversion, that would be great. Otherwise, I'll try porting your test case to ant to see it it works or breaks for me. Dean.
If you follow the instructions from: http://activemq.apache.org/camel/building.html If you are still having problems then you could build only what you need: cd camel-core cd .. cd .. And you should be able to generate the idea project files for the example
cd examples Dean you can also try the camel 1.4.0 release candidate
Please find a first release candidate of apache-camel-1.4.0 here: It doesn't include all the latest AOP changes to the example but you could try with Camel 1.4.0 on your existing project. mvn package of the camel-example-spring-jms example.
Need to find all the jars needed on the CP yourself. Dean any update on this? We are homing into a Camel 1.4 release and want to either fix it asap or reschedule it for 1.5 or later.
Yikes – thanks for the heads up! I like the ASAP option
Hi Dean
Any updates? I am sorry but I can not reproduce the problem with Camel 1.4 and Spring 2.5.4. No updates yet. I'm trying very hard to get back to this, but we have done a new beta release of our own software that has required "all hands".
If Camel 1.4 has to ship with no further work in this area, I understand. At the same time, I'm holding out hope that I can return to this issue this week. Thank you, Claus, for your diligent and well-chosen work to help isolate this issue. One other thought on this: Any class that is intended as a Spring bean really should make its functionality available through an interface.
Proxying class interfaces in Spring is possible in many cases, but is certainly not the norm or the recommended approach. Although I agree, Claus, that the best first approach was to create a unit test that would fail, would you consider creating an interface for SpringCamelContext just as a matter of good general Spring practice, and just verifying that the existing unit tests still work? Sorry, my choice of language was confusing. I should say "proxying class APIs in Spring is possible...but not the norm".
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Dean, Can you whirl together a small sample / preferred unit test that demonstrates this bug? Would aid much during the fixing of the bug.