Spring bean creation failing due to java.lang.NoClassDefFoundError: net/sf/ehcache/Ehcache

Solution Verified - Updated -

Issue

  • Trying to use the org.apache.cxf.rs.security.oauth2.provider.DefaultEHCacheOAuthDataProvider for our oauth implementation but its throwing an exception because it cant find the net/sf/ehcache/Ehcache definition in any of the installed bundles. Could you please point me to right direction on this, below is the exception
Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/Ehcache
    at java.lang.Class.getDeclaredConstructors0(Native Method)[:1.8.0_45]
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)[:1.8.0_45]
    at java.lang.Class.getConstructor0(Class.java:3075)[:1.8.0_45]
    at java.lang.Class.getDeclaredConstructor(Class.java:2178)[:1.8.0_45]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78)[168:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1032)[168:org.apache.servicemix.bundles.spring-beans:3.2.12.RELEASE_2]
    ... 15 more
Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.Ehcache not found by org.apache.cxf.cxf-rt-rs-security-oauth2 [266]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)[org.apache.felix.framework-4.4.1.jar:]
    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)[org.apache.felix.framework-4.4.1.jar:]
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_45]

Environment

  • Red Hat JBoss Fuse
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content