[crowd] Crowd 2.3 Customs Directory example code

Does anyone have example code of a custom directory for Crowd 2.3. I am trying to create one and am getting a java.lang.NullPointerException. Exception trace stack:

java.lang.NullPointerException
at com.atlassian.crowd.manager.application.ApplicationServiceGeneric.isUserAuthorised(ApplicationServiceGeneric.java:171)
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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy10.isUserAuthorised(Unknown Source)
at com.atlassian.crowd.manager.application.CachingApplicationService.isUserAuthorised(CachingApplicationService.java:72)
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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy10.isUserAuthorised(Unknown Source)

public class CSPDirectoryServer implements RemoteDirectory {

public User authenticate(String name, PasswordCredential credential)

throws UserNotFoundException, InactiveAccountException,

InvalidAuthenticationException, ExpiredCredentialException,

OperationFailedException {

log.info("authenticate(“ + name + “)");

UserTemplate user = new UserTemplate(name, getDirectoryId());

user.setName(name);

user.setFirstName("Joe");

user.setLastName("Nevermind");

user.setDisplayName("Nevermind, Joe (" + name + ")");

user.setEmailAddress(name + "@cmp.com");

user.setActive(true);

log.info("User: " + user.toString());

return (User) user;

}

….

}

1 answer

1 accepted

Accepted Answer
0 votes

I recommend downloading the source code for Crowd 2.3 from my.atlassian.com.

Then in your IDE of choice, set a break point at line 171 of com.atlassian.crowd.manager.application.ApplicationServiceGeneric line 171

and see what it is that is null

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 4 hours ago in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

15 views 0 1
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you