# NullPointerException when trying app-profile-jee-vanilla

**URL:** <https://forum.keycloak.org/t/nullpointerexception-when-trying-app-profile-jee-vanilla/1866>\
**Category:** Configuring the server\
**Tags:** authentication, oidc\
**Created:** [March 28, 2020, 1:20pm UTC](https://forum.keycloak.org/t/nullpointerexception-when-trying-app-profile-jee-vanilla/1866 "2020-03-28T13:20:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcel\_k](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/marcel_k/32/554_2.png) [@marcel\_k](https://forum.keycloak.org/u/marcel_k)\
**Post date:** [March 28, 2020, 1:20pm UTC](https://forum.keycloak.org/t/nullpointerexception-when-trying-app-profile-jee-vanilla/1866/1 "2020-03-28T13:20:42Z")

</div>

I installed WildFly and Keycloak according to [the docs](https://www.keycloak.org/docs/latest/getting_started/). I also succesfully ran the WildFly adapter in WildFly’s root directory. Then I cloned [keycloak-quickstarts](https://github.com/keycloak/keycloak-quickstarts) and ran `mvn clean wildfly:deploy` in app-profile-jee-vanilla to test my installation.

However, when opening localhost:8080/vanilla, I get the following error:

```auto
java.lang.NullPointerException
	at org.keycloak.adapters.OAuthRequestAuthenticator.getRedirectUri(OAuthRequestAuthenticator.java:175)
	at org.keycloak.adapters.OAuthRequestAuthenticator.loginRedirect(OAuthRequestAuthenticator.java:213)
	at org.keycloak.adapters.OAuthRequestAuthenticator.authenticate(OAuthRequestAuthenticator.java:275)
	at org.keycloak.adapters.RequestAuthenticator.authenticate(RequestAuthenticator.java:138)
	at org.keycloak.adapters.elytron.ElytronRequestAuthenticator.authenticate(ElytronRequestAuthenticator.java:44)
	at org.keycloak.adapters.elytron.KeycloakHttpServerAuthenticationMechanism.evaluateRequest(KeycloakHttpServerAuthenticationMechanism.java:92)
	at org.wildfly.security.http.util.SetMechanismInformationMechanismFactory$1.evaluateRequest(SetMechanismInformationMechanismFactory.java:119)
	at org.wildfly.security.auth.server.SecurityIdentityServerMechanismFactory$1.evaluateRequest(SecurityIdentityServerMechanismFactory.java:85)
	at org.wildfly.security.http.HttpAuthenticator$AuthenticationExchange.authenticate(HttpAuthenticator.java:263)
	at org.wildfly.security.http.HttpAuthenticator$AuthenticationExchange.access$800(HttpAuthenticator.java:242)
	at org.wildfly.security.http.HttpAuthenticator.authenticate(HttpAuthenticator.java:97)
	at org.wildfly.elytron.web.undertow.server.SecurityContextImpl.authenticate(SecurityContextImpl.java:96)
	at org.wildfly.elytron.web.undertow.server.servlet.ServletSecurityContextImpl.authenticate(ServletSecurityContextImpl.java:115)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:55)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
	at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at org.wildfly.elytron.web.undertow.server.servlet.CleanUpHandler.handleRequest(CleanUpHandler.java:38)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
	at org.keycloak.adapters.elytron.KeycloakServletExtension.lambda$null$0(KeycloakServletExtension.java:39)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1541)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1541)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1541)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1541)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1348)
	at java.lang.Thread.run(Thread.java:748)

```

What is going on, here? I also tried to secure a Spring Boot application and managed to get redirected after opening a secured page, but that resulted in the same error.

---

<div class="post-metadata">

**Author:** ![zonaut](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/zonaut/32/666_2.png) [@zonaut](https://forum.keycloak.org/u/zonaut)\
**Post date:** [March 28, 2020, 5:15pm UTC](https://forum.keycloak.org/t/nullpointerexception-when-trying-app-profile-jee-vanilla/1866/2 "2020-03-28T17:15:13Z")

</div>

Did you complete all steps in the wiki? Especially the #configure-client-adapter-subsystem part.

> <https://github.com/keycloak/keycloak-quickstarts/blob/latest/app-profile-jee-vanilla/README.md#configure-client-adapter-subsystem>

---

<div class="post-metadata">

**Author:** ![marcel\_k](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/marcel_k/32/554_2.png) [@marcel\_k](https://forum.keycloak.org/u/marcel_k)\
**Post date:** [March 28, 2020, 7:40pm UTC](https://forum.keycloak.org/t/nullpointerexception-when-trying-app-profile-jee-vanilla/1866/3 "2020-03-28T19:40:55Z")

</div>

You’re correct, how could I have missed that? After applying the described configuration, the example application seems to work correctly. However, that README states:

> Unlike most other quickstarts for this quickstart you should first deploy the application so you can see that it’s secured with basic authentication. Afterwards you will configure the client adapter subsystem to secure the application and re-deploy the application to see the application is now secured with Keycloak without having to do any changes to the application itself.

So, if I’m not mistaken, the application should also work without security at all. I wonder why it tried to connect to (a not-properly configured) Keycloak instance.

---

<div class="post-metadata">

**Author:** ![zonaut](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/zonaut/32/666_2.png) [@zonaut](https://forum.keycloak.org/u/zonaut)\
**Post date:** [March 28, 2020, 8:19pm UTC](https://forum.keycloak.org/t/nullpointerexception-when-trying-app-profile-jee-vanilla/1866/4 "2020-03-28T20:19:53Z")

</div>

If you want you can create a Jira issue about this if it doesn’t exist already because it seems there are a few issues out there about the docs. Too few hands I suppose.  
Glad it works.

---

<div class="post-metadata">

**Author:** ![marcel\_k](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/marcel_k/32/554_2.png) [@marcel\_k](https://forum.keycloak.org/u/marcel_k)\
**Post date:** [March 28, 2020, 9:46pm UTC](https://forum.keycloak.org/t/nullpointerexception-when-trying-app-profile-jee-vanilla/1866/5 "2020-03-28T21:46:49Z")

</div>

Thanks for the directions, perhaps I’ll do so, after retrying everything from a clean install and looking into it further, myself.
