Search
Calendar
December 2017
S M T W T F S
« Sep    
 12
3456789
10111213141516
17181920212223
24252627282930
31  
Your widget title
Archives

Posts Tagged ‘Groovy’

PostHeaderIcon Could not initialize class net.sf.cglib.proxy.Enhancer

Error

Compiling with Maven 2, you have:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [businessApplicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

Turning Spring logging level to DEBUG, you find:
DEBUG main org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver - Ignoring handler [org.springframework.scripting.config.LangNamespaceHandler]: problem with class file or dependent class
java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException

Fix

Add dependencies to Groovy, BSH and JRuby in your pom.xml:

<dependency>
      <groupId>groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>1.0</version>
</dependency>
<dependency>
      <groupId>org.beanshell</groupId>
      <artifactId>bsh</artifactId>
      <version>2.0b4</version>
</dependency>
<dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby</artifactId>
      <version>0.9.8</version>
</dependency>

Try of Explanation

Spring depends on the three jars above. But Maven does not link your project to them.