java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine

Spring JIRA | Karol Dowbecki | 2 years ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael and Rafael Fischer Viola . Or join the community to write better ones.
  1. 0

    Creating a custom processor module with Apache Velocity (org.apache.velocity:velocity:1.7) as dependency results in {{java.lang.ClassNotFoundException}} during stream deployment: {code} 2015-04-08 17:35:32,595 1.1.1.RELEASE INFO DeploymentsPathChildrenCache-0 server.DeploymentListener - Deploying module [ModuleDescriptor@144d1f50 moduleName = 'custom-velocity-processor', moduleLabel = 'custom-velocity-processor', group = 'velocity-stream', sourceChannelName = [null], sinkChannelName = [null], index = 1, type = processor, parameters = map[[empty]], children = list[[empty]]] 2015-04-08 17:35:32,768 1.1.1.RELEASE WARN DeploymentsPathChildrenCache-0 support.DefaultListableBeanFactory - FactoryBean threw exception from getObjectType, despite the contract saying that it should return null if the type of its object cannot be determined yet java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine at org.springframework.ui.velocity.VelocityEngineFactoryBean.getObjectType(VelocityEngineFactoryBean.java:69) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBean(FactoryBeanRegistrySupport.java:66) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:795) at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:542) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:436) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:404) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398) at org.springframework.integration.jmx.config.JmxIntegrationConfigurationInitializer.registerMBeanExporterHelperIfNecessary(JmxIntegrationConfigurationInitializer.java:42) at org.springframework.integration.jmx.config.JmxIntegrationConfigurationInitializer.initialize(JmxIntegrationConfigurationInitializer.java:38) at org.springframework.integration.config.IntegrationConfigurationBeanFactoryPostProcessor.postProcessBeanFactory(IntegrationConfigurationBeanFactoryPostProcessor.java:48) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:177) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:214) at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217) at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200) at org.springframework.xd.dirt.server.DeploymentListener.deployModule(DeploymentListener.java:363) at org.springframework.xd.dirt.server.DeploymentListener.deployStreamModule(DeploymentListener.java:332) at org.springframework.xd.dirt.server.DeploymentListener.onChildAdded(DeploymentListener.java:179) at org.springframework.xd.dirt.server.DeploymentListener.childEvent(DeploymentListener.java:147) at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509) at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503) at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92) at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83) at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500) at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35) at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.velocity.app.VelocityEngine at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 39 more {code} Attached is module source code. Executing commands in {{xd-shell-commands.cmd}} file is enough to trigger the exception. Everything works when velocity jar is placed in {{$XD_HOME/lib}} and excluded from the processor module.

    Spring JIRA | 2 years ago | Karol Dowbecki
    java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine
  2. 0

    Creating a custom processor module with Apache Velocity (org.apache.velocity:velocity:1.7) as dependency results in {{java.lang.ClassNotFoundException}} during stream deployment: {code} 2015-04-08 17:35:32,595 1.1.1.RELEASE INFO DeploymentsPathChildrenCache-0 server.DeploymentListener - Deploying module [ModuleDescriptor@144d1f50 moduleName = 'custom-velocity-processor', moduleLabel = 'custom-velocity-processor', group = 'velocity-stream', sourceChannelName = [null], sinkChannelName = [null], index = 1, type = processor, parameters = map[[empty]], children = list[[empty]]] 2015-04-08 17:35:32,768 1.1.1.RELEASE WARN DeploymentsPathChildrenCache-0 support.DefaultListableBeanFactory - FactoryBean threw exception from getObjectType, despite the contract saying that it should return null if the type of its object cannot be determined yet java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine at org.springframework.ui.velocity.VelocityEngineFactoryBean.getObjectType(VelocityEngineFactoryBean.java:69) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBean(FactoryBeanRegistrySupport.java:66) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:795) at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:542) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:436) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:404) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398) at org.springframework.integration.jmx.config.JmxIntegrationConfigurationInitializer.registerMBeanExporterHelperIfNecessary(JmxIntegrationConfigurationInitializer.java:42) at org.springframework.integration.jmx.config.JmxIntegrationConfigurationInitializer.initialize(JmxIntegrationConfigurationInitializer.java:38) at org.springframework.integration.config.IntegrationConfigurationBeanFactoryPostProcessor.postProcessBeanFactory(IntegrationConfigurationBeanFactoryPostProcessor.java:48) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:177) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139) at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:214) at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217) at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200) at org.springframework.xd.dirt.server.DeploymentListener.deployModule(DeploymentListener.java:363) at org.springframework.xd.dirt.server.DeploymentListener.deployStreamModule(DeploymentListener.java:332) at org.springframework.xd.dirt.server.DeploymentListener.onChildAdded(DeploymentListener.java:179) at org.springframework.xd.dirt.server.DeploymentListener.childEvent(DeploymentListener.java:147) at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509) at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503) at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92) at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83) at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500) at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35) at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.velocity.app.VelocityEngine at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 39 more {code} Attached is module source code. Executing commands in {{xd-shell-commands.cmd}} file is enough to trigger the exception. Everything works when velocity jar is placed in {{$XD_HOME/lib}} and excluded from the processor module.

    Spring JIRA | 2 years ago | Karol Dowbecki
    java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine
  3. 0
    samebug tip
    Check if you didn't forget to instantiate your topic in the kafka broker.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    A few things cause this exception: 1) Check if you have all jars and if they're in the correct path when running. 2) Your classpath might be broken, you can define it in the command line with "java -cp yourClassPath" or at your IDE if you're using one.
  6. 0
    samebug tip
    If you're using Hibernate, this indicates you're missing FasterXML Classmate dependency, which you can add with the following: <groupId>com.fasterxml</groupId> <artifactId>classmate</artifactId> <version>1.0</version>
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.ClassNotFoundException

    org.apache.velocity.app.VelocityEngine

    at java.net.URLClassLoader$1.run()
  2. Java RT
    ClassLoader.loadClass
    1. java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    2. java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    3. java.security.AccessController.doPrivileged(Native Method)
    4. java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    5. java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    6. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    7. java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    7 frames
  3. Spring Context Support
    VelocityEngineFactoryBean.getObjectType
    1. org.springframework.ui.velocity.VelocityEngineFactoryBean.getObjectType(VelocityEngineFactoryBean.java:69)
    1 frame
  4. Spring Beans
    DefaultListableBeanFactory.getBeanNamesForType
    1. org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBean(FactoryBeanRegistrySupport.java:66)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:795)
    3. org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:542)
    4. org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:436)
    5. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:404)
    6. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398)
    6 frames
  5. Spring Integration JMX Support
    JmxIntegrationConfigurationInitializer.initialize
    1. org.springframework.integration.jmx.config.JmxIntegrationConfigurationInitializer.registerMBeanExporterHelperIfNecessary(JmxIntegrationConfigurationInitializer.java:42)
    2. org.springframework.integration.jmx.config.JmxIntegrationConfigurationInitializer.initialize(JmxIntegrationConfigurationInitializer.java:38)
    2 frames
  6. Spring Integration Core
    IntegrationConfigurationBeanFactoryPostProcessor.postProcessBeanFactory
    1. org.springframework.integration.config.IntegrationConfigurationBeanFactoryPostProcessor.postProcessBeanFactory(IntegrationConfigurationBeanFactoryPostProcessor.java:48)
    1 frame
  7. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
    2. org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:177)
    3. org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
    4. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
    4 frames
  8. Spring Boot
    SpringApplicationBuilder.run
    1. org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    2. org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
    3. org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
    3 frames
  9. org.springframework.xd
    DeploymentListener.childEvent
    1. org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:214)
    2. org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217)
    3. org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200)
    4. org.springframework.xd.dirt.server.DeploymentListener.deployModule(DeploymentListener.java:363)
    5. org.springframework.xd.dirt.server.DeploymentListener.deployStreamModule(DeploymentListener.java:332)
    6. org.springframework.xd.dirt.server.DeploymentListener.onChildAdded(DeploymentListener.java:179)
    7. org.springframework.xd.dirt.server.DeploymentListener.childEvent(DeploymentListener.java:147)
    7 frames
  10. Fabric8
    PathChildrenCache$5.apply
    1. org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
    2. org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
    2 frames
  11. Curator Framework
    ListenerContainer$1.run
    1. org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
    1 frame
  12. Guava
    MoreExecutors$SameThreadExecutorService.execute
    1. com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
    1 frame
  13. Curator Framework
    ListenerContainer.forEach
    1. org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
    1 frame
  14. Fabric8
    PathChildrenCache$10.run
    1. org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
    2. org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
    3. org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
    3 frames
  15. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:262)
    3. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    4. java.util.concurrent.FutureTask.run(FutureTask.java:262)
    5. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    6. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    7. java.lang.Thread.run(Thread.java:745)
    7 frames