java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User

Apereo Issues | Ivan Goonich | 5 years ago
  1. 0

    Dear Scott, In atlassian-seraph-2.5.0 (included in JIRA 4.3.4, in previous version was atlassian-seraph-2.5.0-m3) the implementation of "DefaultAuthenticator" has changed. Namely, the following code was changed in the "login" method in: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0)|borderStyle=solid} ... final String METHOD = "login : "; final boolean dbg = log.isDebugEnabled(); final Principal principal = new Principal() { public String getName() { return userName; } }; final boolean authenticated = authenticate(principal, password); ... {code} And in the previous version was: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0-m3)|borderStyle=solid} ... final Principal user = getUser(userName); if (user == null) { log.info(METHOD + "'" + userName + "' does not exist and cannot be authenticated."); } else { final boolean authenticated = authenticate(user, password); ... {code} As a result current implementation of "JiraCasAuthenticator#authenticate" fails with ClassCastException: {code:title=JiraCasAuthenticator.java|borderStyle=solid} ... @Override protected boolean authenticate(final Principal principal, final String password) throws AuthenticatorException { return ((User) principal).authenticate(password); } ... {code} Stack trace: {noformat} java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User at org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate(JiraCasAuthenticator.java:55) at com.atlassian.seraph.auth.DefaultAuthenticator.login(DefaultAuthenticator.java:94) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.runAuthentication(PasswordBasedLoginFilter.java:127) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.login(PasswordBasedLoginFilter.java:72) at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:130) at com.atlassian.jira.web.filters.JiraLoginFilter.doFilter(JiraLoginFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) {noformat} Best regards, Ivan Goonich eVelopers, Corp.

    Apereo Issues | 5 years ago | Ivan Goonich
    java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User
  2. 0

    Dear Scott, In atlassian-seraph-2.5.0 (included in JIRA 4.3.4, in previous version was atlassian-seraph-2.5.0-m3) the implementation of "DefaultAuthenticator" has changed. Namely, the following code was changed in the "login" method in: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0)|borderStyle=solid} ... final String METHOD = "login : "; final boolean dbg = log.isDebugEnabled(); final Principal principal = new Principal() { public String getName() { return userName; } }; final boolean authenticated = authenticate(principal, password); ... {code} And in the previous version was: {code:title=DefaultAuthenticator.java (atlassian-seraph-2.5.0-m3)|borderStyle=solid} ... final Principal user = getUser(userName); if (user == null) { log.info(METHOD + "'" + userName + "' does not exist and cannot be authenticated."); } else { final boolean authenticated = authenticate(user, password); ... {code} As a result current implementation of "JiraCasAuthenticator#authenticate" fails with ClassCastException: {code:title=JiraCasAuthenticator.java|borderStyle=solid} ... @Override protected boolean authenticate(final Principal principal, final String password) throws AuthenticatorException { return ((User) principal).authenticate(password); } ... {code} Stack trace: {noformat} java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User at org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate(JiraCasAuthenticator.java:55) at com.atlassian.seraph.auth.DefaultAuthenticator.login(DefaultAuthenticator.java:94) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.runAuthentication(PasswordBasedLoginFilter.java:127) at com.atlassian.seraph.filter.PasswordBasedLoginFilter.login(PasswordBasedLoginFilter.java:72) at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:130) at com.atlassian.jira.web.filters.JiraLoginFilter.doFilter(JiraLoginFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) {noformat} Best regards, Ivan Goonich eVelopers, Corp.

    Apereo Issues | 5 years ago | Ivan Goonich
    java.lang.ClassCastException: com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User
  3. 0

    If a multi user custom field is added to JIRA, and the custom field is added to the Assignable User permission, the Assign Issue operation breaks, when trying to gather the list of assignable Users. This is basically because our MultiUserCF is not specific enough and relies to much on the AbstractMultiCFType. The MultiUserCFType needs to override the getValueFromIssue(CustomField field, Issue issue) method to return a *Set* rather than a *List*. Or, we could make the UserCF a little more robust and make the following method able to handle more than just a Set: {code} public Set getUsers(PermissionContext ctx, String customFieldId) { if (ctx.getIssue() == null) { throw new IllegalArgumentException("PermissionContext has no issue"); } Issue issue = ctx.getIssue(); FieldManager fieldManager = ComponentManager.getInstance().getFieldManager(); CustomField field = fieldManager.getCustomField(customFieldId); CustomFieldType type = field.getCustomFieldType(); Object obj = type.getValueFromIssue(field, issue); Set users = new HashSet(1); if (obj != null) { if (obj instanceof Set) { users = (Set) obj; } else { users.add(obj); } } return users; } {code} Currently it can't, and the following exception is the result (a little further down the track, after the UserCF has added the wrong thing to the set of users): {noformat} java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.opensymphony.user.User at com.atlassian.core.user.BestNameComparator.compare(BestNameComparator.java:26) at java.util.Arrays.mergeSort(Arrays.java:1270) at java.util.Arrays.sort(Arrays.java:1210) at java.util.Collections.sort(Collections.java:159) at com.atlassian.jira.issue.fields.AssigneeSystemField.makeAssigneeOptionsList(AssigneeSystemField.java:416) at com.atlassian.jira.issue.fields.AssigneeSystemField.getAssigneeOptionsList(AssigneeSystemField.java:348) at com.atlassian.jira.issue.fields.AssigneeSystemField.getEditHtml(AssigneeSystemField.java:87) 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:589) at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:61) at webwork.util.InjectionUtils.invoke(InjectionUtils.java:52) at webwork.util.ValueStack.findValue(ValueStack.java:426) {noformat}

    Atlassian JIRA | 9 years ago | Andreas Knecht
    java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.opensymphony.user.User
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    If a multi user custom field is added to JIRA, and the custom field is added to the Assignable User permission, the Assign Issue operation breaks, when trying to gather the list of assignable Users. This is basically because our MultiUserCF is not specific enough and relies to much on the AbstractMultiCFType. The MultiUserCFType needs to override the getValueFromIssue(CustomField field, Issue issue) method to return a *Set* rather than a *List*. Or, we could make the UserCF a little more robust and make the following method able to handle more than just a Set: {code} public Set getUsers(PermissionContext ctx, String customFieldId) { if (ctx.getIssue() == null) { throw new IllegalArgumentException("PermissionContext has no issue"); } Issue issue = ctx.getIssue(); FieldManager fieldManager = ComponentManager.getInstance().getFieldManager(); CustomField field = fieldManager.getCustomField(customFieldId); CustomFieldType type = field.getCustomFieldType(); Object obj = type.getValueFromIssue(field, issue); Set users = new HashSet(1); if (obj != null) { if (obj instanceof Set) { users = (Set) obj; } else { users.add(obj); } } return users; } {code} Currently it can't, and the following exception is the result (a little further down the track, after the UserCF has added the wrong thing to the set of users): {noformat} java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.opensymphony.user.User at com.atlassian.core.user.BestNameComparator.compare(BestNameComparator.java:26) at java.util.Arrays.mergeSort(Arrays.java:1270) at java.util.Arrays.sort(Arrays.java:1210) at java.util.Collections.sort(Collections.java:159) at com.atlassian.jira.issue.fields.AssigneeSystemField.makeAssigneeOptionsList(AssigneeSystemField.java:416) at com.atlassian.jira.issue.fields.AssigneeSystemField.getAssigneeOptionsList(AssigneeSystemField.java:348) at com.atlassian.jira.issue.fields.AssigneeSystemField.getEditHtml(AssigneeSystemField.java:87) 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:589) at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:61) at webwork.util.InjectionUtils.invoke(InjectionUtils.java:52) at webwork.util.ValueStack.findValue(ValueStack.java:426) {noformat}

    Atlassian JIRA | 9 years ago | Andreas Knecht
    java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.opensymphony.user.User
  6. 0

    problem while using multi user picker custom filed with the "Add Field Value to Parent Function" "Copy Field Value to Parent Function " with errors 2010-11-11 11:23:37,547 TP-Processor3 WARN u324 683x20316x1 16pufrx 10.3.4.148 /secure/WorkflowUIDispatcher.jspa [jmwe.plugins.functions.AddFieldValueToParentFunction] Error while executing function : java.lang.ClassCastException: com.opensymphony.user.User cannot be cast to java.lang.String java.lang.ClassCastException: com.opensymphony.user.User cannot be cast to java.lang.String at com.atlassian.jira.issue.customfields.impl.MultiUserCFType.getValueFromCustomFieldParams(MultiUserCFType.java:90) at com.innovalog.googlecode.jsu.util.WorkflowUtils.setFieldValue(WorkflowUtils.java:358) at com.innovalog.jmwe.plugins.functions.AddFieldValueToParentFunction.executeFunction(AddFieldValueToParentFunction.java:58) at com.innovalog.jmwe.plugins.functions.AbstractPreserveChangesPostFunction.execute(AbstractPreserveChangesPostFunction.java:58) at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:869) at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1265) at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:567) at com.atlassian.jira.workflow.SimpleWorkflowManager.doWorkflowAction(SimpleWorkflowManager.java:300) at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:416) at com.atlassian.jira.web.action.workflow.SimpleWorkflowAction.doExecute(SimpleWorkflowAction.java:30) at webwork.action.ActionSupport.execute(ActionSupport.java:165)

    JIRA | 6 years ago | abd null
    java.lang.ClassCastException: com.opensymphony.user.User cannot be cast to java.lang.String

    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.ClassCastException

      com.atlassian.seraph.auth.DefaultAuthenticator$1 cannot be cast to com.opensymphony.user.User

      at org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate()
    2. org.jasig.cas
      JiraCasAuthenticator.authenticate
      1. org.jasig.cas.client.integration.atlassian.JiraCasAuthenticator.authenticate(JiraCasAuthenticator.java:55)
      1 frame
    3. com.atlassian.seraph
      BaseLoginFilter.doFilter
      1. com.atlassian.seraph.auth.DefaultAuthenticator.login(DefaultAuthenticator.java:94)
      2. com.atlassian.seraph.filter.PasswordBasedLoginFilter.runAuthentication(PasswordBasedLoginFilter.java:127)
      3. com.atlassian.seraph.filter.PasswordBasedLoginFilter.login(PasswordBasedLoginFilter.java:72)
      4. com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:130)
      4 frames
    4. com.atlassian.jira
      JiraLoginFilter.doFilter
      1. com.atlassian.jira.web.filters.JiraLoginFilter.doFilter(JiraLoginFilter.java:70)
      1 frame
    5. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      2 frames