java.lang.NoClassDefFoundError: org/springframework/security/context/SecurityContextHolder

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

    Spring 3.0.4.RELEASE support

    jpasecurity | 6 years ago | nurquiza
    java.lang.NoClassDefFoundError: org/springframework/security/context/SecurityContextHolder
  2. 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.
  3. 0
    samebug tip
    If you're using Hibernate, this indicates you're missing FasterXML Classmate dependency, which you can add to your dependencies. To add it, the groupId is com.fasterxml and artifactId is Classmate.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    Check if you didn't forget to instantiate your topic in the kafka broker.
  6. 0
    samebug tip
    NoClassDefFoundError means java has failed to find a class you're trying to instantiate, look if you've added the class you're trying to instantiate to the dependencies.
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.springframework.security.context.SecurityContextHolder

    at java.net.URLClassLoader$1.run()
  2. Java RT
    ClassLoader.loadClass
    1. java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    2. java.security.AccessController.doPrivileged(Native Method)
    3. java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    4. java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    5. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    6. java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    6 frames
  3. net.sf.jpasecurity
    EntityManagerInvocationHandler.persist
    1. net.sf.jpasecurity.security.authentication.SpringAuthenticationProvider.getPrincipal(SpringAuthenticationProvider.java:36)
    2. net.sf.jpasecurity.persistence.EntityManagerInvocationHandler.getCurrentUser(EntityManagerInvocationHandler.java:310)
    3. net.sf.jpasecurity.persistence.EntityManagerInvocationHandler.isAccessible(EntityManagerInvocationHandler.java:283)
    4. net.sf.jpasecurity.entity.AbstractSecureObjectManager.checkAccess(AbstractSecureObjectManager.java:375)
    5. net.sf.jpasecurity.entity.EntityPersister.createUnsecureObject(EntityPersister.java:241)
    6. net.sf.jpasecurity.entity.AbstractSecureObjectManager.getUnsecureObject(AbstractSecureObjectManager.java:133)
    7. net.sf.jpasecurity.entity.EntityPersister.getUnsecureObject(EntityPersister.java:232)
    8. net.sf.jpasecurity.entity.EntityPersister.persist(EntityPersister.java:62)
    9. net.sf.jpasecurity.persistence.EntityManagerInvocationHandler.persist(EntityManagerInvocationHandler.java:109)
    9 frames
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  5. net.sf.jpasecurity
    EntityManagerInvocationHandler.invoke
    1. net.sf.jpasecurity.util.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:55)
    2. net.sf.jpasecurity.util.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:48)
    3. net.sf.jpasecurity.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:302)
    3 frames
  6. Unknown
    $Proxy171.persist
    1. $Proxy171.persist(Unknown Source)
    1 frame
  7. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  8. Spring ORM
    SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke
    1. org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
    1 frame
  9. Unknown
    $Proxy88.persist
    1. $Proxy88.persist(Unknown Source)
    1 frame
  10. com.krfs.dao
    GenericEntityDaoImpl.create
    1. com.krfs.dao.GenericEntityDaoImpl.create(GenericEntityDaoImpl.java:96)
    1 frame
  11. com.krfs.service
    GenericEntityCrudServiceImpl.create
    1. com.krfs.service.impl.GenericEntityCrudServiceImpl.create(GenericEntityCrudServiceImpl.java:48)
    1 frame
  12. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  13. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    3 frames
  14. Spring Tx
    TransactionInterceptor.invoke
    1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    1 frame
  15. Spring AOP
    JdkDynamicAopProxy.invoke
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    2 frames
  16. Unknown
    $Proxy110.create
    1. $Proxy110.create(Unknown Source)
    1 frame
  17. com.krfs.service
    ClientServiceImplTest.setUpTestDataWithinTransaction
    1. com.krfs.service.impl.ClientServiceImplTest.setUpTestDataWithinTransaction(ClientServiceImplTest.java:136)
    1 frame
  18. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  19. JUnit
    RunBefores.evaluate
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    4. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    4 frames
  20. Spring TestContext
    RunBeforeTestMethodCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    1 frame
  21. JUnit
    RunAfters.evaluate
    1. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    1 frame
  22. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
    2. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
    3 frames
  23. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    2. org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    3. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    4. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    5. org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    6. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    6 frames
  24. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    2 frames
  25. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    1 frame
  26. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
    1 frame
  27. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    1 frame
  28. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    5 frames