org.sonatype.security.usermanagement.UserNotFoundException: User: 'anonymous' could not be found.

Sonatype JIRA | Juven Xu | 8 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    here is the code: {code:java} User anon = getAnonymousUser(); if ( !anon.getRoles().contains( ACCOUNT_SIGN_UP_ROLE ) ) { anon.addRole( ACCOUNT_SIGN_UP_ROLE ); if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Set roles for user: '" + anon.getUserId() + "', source: '" + anon.getSource() + "'." ); } securitySystem.setUsersRoles( anon.getUserId(), anon.getSource(), anon.getRoles() ); } {code} and I got this exception: {noformat} org.sonatype.security.usermanagement.UserNotFoundException: User: 'anonymous' could not be found. at org.sonatype.security.DefaultSecuritySystem.setUsersRoles(DefaultSecuritySystem.java:426) at com.sonatype.nexus.account.DefaultUserAccountManager.enableAccountSignUp(DefaultUserAccountManager.java:158) at com.sonatype.nexus.account.UserAccountManagerTest.testEnableSignUpService(UserAccountManagerTest.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) {noformat}

    Sonatype JIRA | 8 years ago | Juven Xu
    org.sonatype.security.usermanagement.UserNotFoundException: User: 'anonymous' could not be found.

    Root Cause Analysis

    1. org.sonatype.security.usermanagement.UserNotFoundException

      User: 'anonymous' could not be found.

      at org.sonatype.security.DefaultSecuritySystem.setUsersRoles()
    2. ${project.groupId}:${project.artifactId}
      DefaultSecuritySystem.setUsersRoles
      1. org.sonatype.security.DefaultSecuritySystem.setUsersRoles(DefaultSecuritySystem.java:426)
      1 frame
    3. com.sonatype.nexus
      UserAccountManagerTest.testEnableSignUpService
      1. com.sonatype.nexus.account.DefaultUserAccountManager.enableAccountSignUp(DefaultUserAccountManager.java:158)
      2. com.sonatype.nexus.account.UserAccountManagerTest.testEnableSignUpService(UserAccountManagerTest.java:54)
      2 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. JUnit
      TestSuite.run
      1. junit.framework.TestCase.runTest(TestCase.java:154)
      2. junit.framework.TestCase.runBare(TestCase.java:127)
      3. junit.framework.TestResult$1.protect(TestResult.java:106)
      4. junit.framework.TestResult.runProtected(TestResult.java:124)
      5. junit.framework.TestResult.run(TestResult.java:109)
      6. junit.framework.TestCase.run(TestCase.java:118)
      7. junit.framework.TestSuite.runTest(TestSuite.java:208)
      8. junit.framework.TestSuite.run(TestSuite.java:203)
      8 frames
    6. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      2. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      6. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      6 frames