camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edstrom Johan (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAMEL-3625) Testing in Intellij IDEA
Date Fri, 04 Feb 2011 22:14:30 GMT
Testing in Intellij IDEA
------------------------

                 Key: CAMEL-3625
                 URL: https://issues.apache.org/jira/browse/CAMEL-3625
             Project: Camel
          Issue Type: Improvement
            Reporter: Edstrom Johan
            Priority: Minor


When running camel-components tests in Intellij IDEA you frequently run into

{code}
java.lang.NoClassDefFoundError: org/apache/camel/core/xml/CamelJMXAgentDefinition
	at org.apache.camel.spring.CamelBeanPostProcessor.canPostProcessBean(CamelBeanPostProcessor.java:209)
	at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:89)
	at org.apache.camel.test.junit4.CamelTestSupport.postProcessTest(CamelTestSupport.java:190)
	at org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:133)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:24)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
{code}

The following would handle the issue 

{code}
Index: components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
===================================================================
--- components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
(revision 1065694)
+++ components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
(revision )
@@ -192,6 +192,17 @@
      * @return true to process it
      */
     protected boolean canPostProcessBean(Object bean, String beanName) {
+
+         //Let us check if we can load this class...
+        ClassLoader classLoader = getCamelContext().getClassResolver().getClass().getClassLoader();
+
+        try {
+            Class aClass = classLoader.loadClass("org.apache.camel.core.xml.CamelJMXAgentDefinition");
+            //Keep going.
+        } catch (ClassNotFoundException e) {
+           return false;
+        }
+
         // the JMXAgent is a bit strange and causes Spring issues if we let it being
         // post processed by this one. It does not need it anyway so we are good to go.
         if (bean instanceof CamelJMXAgentDefinition) {
{code}




-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message