more camel-example-hibernate problems (v2.18.0)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

more camel-example-hibernate problems (v2.18.0)

pixelpshr
I have cloned the repo from github and deleted my local maven repository (to make sure that I haven't left any broken bits in there). I was able to perform the "mvn install" at the top level directory (camel-extra). I verified that the "camel-hibernate" component is in the local repository:

$ find ~/.m2 -name camel-hibernate\* -print
/Users/tdecarlo/.m2/repository/org/apache-extras/camel-extra/camel-hibernate
/Users/tdecarlo/.m2/repository/org/apache-extras/camel-extra/camel-hibernate/2.18.0-SNAPSHOT/camel-hibernate-2.18.0-SNAPSHOT.jar
/Users/tdecarlo/.m2/repository/org/apache-extras/camel-extra/camel-hibernate/2.18.0-SNAPSHOT/camel-hibernate-2.18.0-SNAPSHOT.pom

I can also successfully compile the camel-extra/examples/camel-example-hibernate project:

$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Camel Extra :: Component Examples :: A Camel Hibernate Demo 2.18.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ camel-example-hibernate ---
[INFO]
[INFO] --- maven-bundle-plugin:3.2.0:cleanVersions (versions) @ camel-example-hibernate ---
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ camel-example-hibernate ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ camel-example-hibernate ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ camel-example-hibernate ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.220 s
[INFO] Finished at: 2016-12-13T17:08:39-05:00
[INFO] Final Memory: 27M/428M
[INFO] ------------------------------------------------------------------------

However, when I try to run the code, I get "class not found" errors referencing the camel-hibernate classes:

$ mvn camel:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Camel Extra :: Component Examples :: A Camel Hibernate Demo 2.18.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> camel-maven-plugin:2.18.0:run (default-cli) > test-compile @ camel-example-hibernate >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ camel-example-hibernate ---
[INFO]
[INFO] --- maven-bundle-plugin:3.2.0:cleanVersions (versions) @ camel-example-hibernate ---
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ camel-example-hibernate ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ camel-example-hibernate ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ camel-example-hibernate ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ camel-example-hibernate ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/tdecarlo/Workspaces/Github/camel-extra/examples/camel-example-hibernate/src/test/resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ camel-example-hibernate ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< camel-maven-plugin:2.18.0:run (default-cli) < test-compile @ camel-example-hibernate <<<
[INFO]
[INFO] --- camel-maven-plugin:2.18.0:run (default-cli) @ camel-example-hibernate ---
[INFO] Using org.apache.camel.spring.Main to initiate a CamelContext
[INFO] Starting Camel ...
[pache.camel.spring.Main.main()] ClassPathXmlApplicationContext WARN  Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'template': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-1': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apacheextras.camel.component.hibernate.HibernateComponent] for bean with name 'hibernate' defined in file [/Users/tdecarlo/Workspaces/Github/camel-extra/examples/camel-example-hibernate/target/classes/META-INF/spring/camel-context.xml]; nested exception is java.lang.ClassNotFoundException: org.apacheextras.camel.component.hibernate.HibernateComponent
[ERROR] *************************************
[ERROR] Error occurred while running main from: org.apache.camel.spring.Main
[ERROR]
java.lang.reflect.InvocationTargetException
        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.apache.camel.maven.RunMojo$1.run(RunMojo.java:472)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'template': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-1': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apacheextras.camel.component.hibernate.HibernateComponent] for bean with name 'hibernate' defined in file [/Users/tdecarlo/Workspaces/Github/camel-extra/examples/camel-example-hibernate/target/classes/META-INF/spring/camel-context.xml]; nested exception is java.lang.ClassNotFoundException: org.apacheextras.camel.component.hibernate.HibernateComponent
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:732)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:222)
        at org.apache.camel.spring.Main.doStart(Main.java:154)
        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at org.apache.camel.main.MainSupport.run(MainSupport.java:138)
        at org.apache.camel.main.MainSupport.run(MainSupport.java:390)
        at org.apache.camel.spring.Main.main(Main.java:86)
        ... 6 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-1': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apacheextras.camel.component.hibernate.HibernateComponent] for bean with name 'hibernate' defined in file [/Users/tdecarlo/Workspaces/Github/camel-extra/examples/camel-example-hibernate/target/classes/META-INF/spring/camel-context.xml]; nested exception is java.lang.ClassNotFoundException: org.apacheextras.camel.component.hibernate.HibernateComponent
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1082)
        at org.apache.camel.spring.CamelBeanPostProcessor$1.getOrLookupCamelContext(CamelBeanPostProcessor.java:66)
        at org.apache.camel.impl.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:87)
        at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:131)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1575)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
        ... 22 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apacheextras.camel.component.hibernate.HibernateComponent] for bean with name 'hibernate' defined in file [/Users/tdecarlo/Workspaces/Github/camel-extra/examples/camel-example-hibernate/target/classes/META-INF/spring/camel-context.xml]; nested exception is java.lang.ClassNotFoundException: org.apacheextras.camel.component.hibernate.HibernateComponent
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1357)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:629)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:597)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1450)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:420)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398)
        at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1178)
        at org.apache.camel.spring.CamelContextFactoryBean.getBeanForType(CamelContextFactoryBean.java:220)
        at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:159)
        at org.apache.camel.spring.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:275)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579)
        ... 35 more
Caused by: java.lang.ClassNotFoundException: org.apacheextras.camel.component.hibernate.HibernateComponent
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
        at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1402)
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1349)
        ... 46 more
[ERROR] *************************************
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.770 s
[INFO] Finished at: 2016-12-13T16:59:25-05:00
[INFO] Final Memory: 43M/446M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:2.18.0:run (default-cli) on project camel-example-hibernate: null: MojoExecutionException: InvocationTargetException: Error creating bean with name 'template': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-1': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apacheextras.camel.component.hibernate.HibernateComponent] for bean with name 'hibernate' defined in file [/Users/tdecarlo/Workspaces/Github/camel-extra/examples/camel-example-hibernate/target/classes/META-INF/spring/camel-context.xml]; nested exception is java.lang.ClassNotFoundException: org.apacheextras.camel.component.hibernate.HibernateComponent -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


Can someone please tell me why the jar files that I've just compiled and put into the local repository are not being found when the application executes?

Thanks,
Thom
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: more camel-example-hibernate problems (v2.18.0)

Pontus Ullgren
Hi,

Yes I get the same error when I test it.

Seems that for some reason no classes are packaged into the jar files in the master branch.

I would recommend that you test with the camel-extra-2.16.x branch instead since that is the latest stable version of camel-extra.

Best regards
Pontus Ullgren
Loading...