okta unable to add my jhipster microservice application











up vote
0
down vote

favorite












Initially I have setup microservice application with oauth2 and keycloak.
I was able to do that successfully. I have added all things such as SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI, SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI, SECURITY_OAUTH2_CLIENT_CLIENT_ID, SECURITY_OAUTH2_CLIENT_CLIENT_SECRET, SECURITY_OAUTH2_CLIENT_SCOPE, SECURITY_OAUTH2_RESOURCE_USER_INFO_URI. I have jhipster registry running and gateway application running. I have created a application in okta with the openidconnect type application. Screen shot is mentioned below. I able to see the http://localhost:8080. Upon clicking on sign in button I getting the below error.



app1app2app3app4app5app6error










share|improve this question


























    up vote
    0
    down vote

    favorite












    Initially I have setup microservice application with oauth2 and keycloak.
    I was able to do that successfully. I have added all things such as SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI, SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI, SECURITY_OAUTH2_CLIENT_CLIENT_ID, SECURITY_OAUTH2_CLIENT_CLIENT_SECRET, SECURITY_OAUTH2_CLIENT_SCOPE, SECURITY_OAUTH2_RESOURCE_USER_INFO_URI. I have jhipster registry running and gateway application running. I have created a application in okta with the openidconnect type application. Screen shot is mentioned below. I able to see the http://localhost:8080. Upon clicking on sign in button I getting the below error.



    app1app2app3app4app5app6error










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Initially I have setup microservice application with oauth2 and keycloak.
      I was able to do that successfully. I have added all things such as SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI, SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI, SECURITY_OAUTH2_CLIENT_CLIENT_ID, SECURITY_OAUTH2_CLIENT_CLIENT_SECRET, SECURITY_OAUTH2_CLIENT_SCOPE, SECURITY_OAUTH2_RESOURCE_USER_INFO_URI. I have jhipster registry running and gateway application running. I have created a application in okta with the openidconnect type application. Screen shot is mentioned below. I able to see the http://localhost:8080. Upon clicking on sign in button I getting the below error.



      app1app2app3app4app5app6error










      share|improve this question













      Initially I have setup microservice application with oauth2 and keycloak.
      I was able to do that successfully. I have added all things such as SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI, SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI, SECURITY_OAUTH2_CLIENT_CLIENT_ID, SECURITY_OAUTH2_CLIENT_CLIENT_SECRET, SECURITY_OAUTH2_CLIENT_SCOPE, SECURITY_OAUTH2_RESOURCE_USER_INFO_URI. I have jhipster registry running and gateway application running. I have created a application in okta with the openidconnect type application. Screen shot is mentioned below. I able to see the http://localhost:8080. Upon clicking on sign in button I getting the below error.



      app1app2app3app4app5app6error







      jhipster okta okta-api jhipster-registry






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 11:33









      Satyanvesh Muppaneni

      206




      206
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          1
          down vote













          If you look in your browser’s address bar on the 400 error page, you’ll see it has “http://localhost:8080/login” as the redirect URI. Add this value to the Login redirect URIs in your Okta app and you should be good to go.






          share|improve this answer





















          • Thanks for the response. I have added as you said, but its redirecting to login page but not signing into application. My requirement is, upon clicking on the application(once the user is assigned this app), as he has already authenticated from okta, upon clicking the application he should see the home page
            – Satyanvesh Muppaneni
            Nov 11 at 3:49










          • FYI, following are my env variable in app.yml - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=dev-558029.oktapreview.com/oauth2/default/v1/token - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=dev-558029.oktapreview.com/oauth2/default/v1/authorize - SECURITY_OAUTH2_CLIENT_CLIENT_ID=0oah8azcnaz2GunyT0h7 - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET= D5j6vS_eNT3G56jN81riyV8w9rbxuQZph7L2wfgk - SECURITY_OAUTH2_CLIENT_SCOPE=openid profile email - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=dev-558029.oktapreview.com/oauth2/default/v1/userinfo
            – Satyanvesh Muppaneni
            Nov 11 at 3:57












          • In okta app the login redirect uri is : localhost:8080/login Initiate login uri is : localhost:8080
            – Satyanvesh Muppaneni
            Nov 11 at 4:00




















          up vote
          0
          down vote













          Im sensing the problem is with authentication. I have created a user called admin in my okta developer account. In java logs i saw the below error




          2018-11-12 10:51:02.720 DEBUG 29646 --- [ XNIO-2 task-13]
          c.m.myapp.config.OAuth2Configuration : Saving login origin URI:
          http://localhost:8080/ 2018-11-12 10:51:02.721 WARN 29646 --- [
          XNIO-2 task-13] o.s.c.n.zuul.web.ZuulHandlerMapping : No routes
          found from RouteLocator 2018-11-12 10:51:04.015 DEBUG 29646 --- [
          XNIO-2 task-13] c.m.myapp.aop.logging.LoggingAspect : Enter:
          com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
          argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:04.014Z,
          principal=0oahe7g64oGVGiok50h7, type=AUTHENTICATION_SUCCESS,
          data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
          tokenType=BearertokenValue=}]] Hibernate: insert into
          jhi_persistent_audit_event (event_date, event_type, principal) values
          (?, ?, ?) 2018-11-12 10:51:04.022 DEBUG 29646 --- [ XNIO-2 task-13]
          c.m.myapp.aop.logging.LoggingAspect : Exit:
          com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
          result = null Hibernate: insert into jhi_persistent_audit_evt_data
          (event_id, name, value) values (?, ?, ?) 2018-11-12 10:51:04.029 DEBUG
          29646 --- [ XNIO-2 task-13] m.m.s.OAuth2AuthenticationSuccessHandler :
          Redirecting to saved login origin URI: http://localhost:8080/
          2018-11-12 10:51:05.039 DEBUG 29646 --- [ XNIO-2 task-15]
          c.m.myapp.aop.logging.LoggingAspect : Enter:
          com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
          argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:05.039Z,
          principal=0oahe7g64oGVGiok50h7, type=AUTHORIZATION_FAILURE,
          data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
          tokenType=BearertokenValue=,
          type=org.springframework.security.access.AccessDeniedException,
          message=Access is denied}]] 2018-11-12 10:51:05.039 DEBUG 29646 --- [
          XNIO-2 task-15] c.m.myapp.aop.logging.LoggingAspect : Exit:
          com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
          result = null 2018-11-12 10:51:05.079 DEBUG 29646 --- [ XNIO-2
          task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
          com.mycompany.myapp.web.rest.AccountResource.getAccount() with
          argument[s] =
          [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
          Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
          Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
          sessionId=, tokenType=BearertokenValue=; Not granted
          any authorities] 2018-11-12 10:51:05.081 DEBUG 29646 --- [ XNIO-2
          task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
          com.mycompany.myapp.service.UserService.getUserFromAuthentication()
          with argument[s] =
          [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
          Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
          Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
          sessionId=, tokenType=BearertokenValue=; Not granted
          any authorities] 2018-11-12 10:51:05.082 ERROR 29646 --- [ XNIO-2
          task-16] c.m.myapp.aop.logging.LoggingAspect : Exception in
          com.mycompany.myapp.service.UserService.getUserFromAuthentication()
          with cause = 'NULL' and exception = 'null'



          java.lang.NullPointerException: null at
          com.mycompany.myapp.service.UserService.getUserFromAuthentication(UserService.java:153)
          at
          com.mycompany.myapp.service.UserService$$FastClassBySpringCGLIB$$2169c3ce.invoke()
          at
          org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
          at
          org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
          at
          org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
          at
          com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
          sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at
          sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498) at
          org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
          at
          org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
          at
          org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
          at
          org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
          at
          com.mycompany.myapp.service.UserService$$EnhancerBySpringCGLIB$$599f99c8.getUserFromAuthentication()
          at
          com.mycompany.myapp.web.rest.AccountResource.getAccount(AccountResource.java:59)
          at
          com.mycompany.myapp.web.rest.AccountResource$$FastClassBySpringCGLIB$$bb2cce5e.invoke()
          at
          org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
          at
          org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
          at
          org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
          at
          com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
          sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at
          sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498) at
          org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
          at
          org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
          at
          org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
          at
          com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
          at
          com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
          at
          org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
          at
          org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
          at
          com.mycompany.myapp.web.rest.AccountResource$$EnhancerBySpringCGLIB$$fc91dc3c.getAccount()
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
          sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at
          sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498) at
          org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
          at
          org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
          at
          org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
          at
          org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
          at
          org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
          at
          org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
          at
          org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
          at
          org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
          at
          org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
          at
          org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at
          org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at
          io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
          at
          io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
          at
          com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
          at
          io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at
          io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at
          org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
          at
          io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
          at
          io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
          at







          share|improve this answer






























            up vote
            0
            down vote



            accepted










            Thanks, I solved the issue. The solution was, The user with which i was trying to login was not created in users table. For that I have created another user in okta and assigned the roles to it. Reset the password and tried logging to account. Upon invoking "http://localhost:8080" and clicking on "sign in" button it redirected to okta login page and logged in with the above created user and it redirected me to home page of my gateway.



            Thank you






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238520%2fokta-unable-to-add-my-jhipster-microservice-application%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              1
              down vote













              If you look in your browser’s address bar on the 400 error page, you’ll see it has “http://localhost:8080/login” as the redirect URI. Add this value to the Login redirect URIs in your Okta app and you should be good to go.






              share|improve this answer





















              • Thanks for the response. I have added as you said, but its redirecting to login page but not signing into application. My requirement is, upon clicking on the application(once the user is assigned this app), as he has already authenticated from okta, upon clicking the application he should see the home page
                – Satyanvesh Muppaneni
                Nov 11 at 3:49










              • FYI, following are my env variable in app.yml - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=dev-558029.oktapreview.com/oauth2/default/v1/token - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=dev-558029.oktapreview.com/oauth2/default/v1/authorize - SECURITY_OAUTH2_CLIENT_CLIENT_ID=0oah8azcnaz2GunyT0h7 - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET= D5j6vS_eNT3G56jN81riyV8w9rbxuQZph7L2wfgk - SECURITY_OAUTH2_CLIENT_SCOPE=openid profile email - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=dev-558029.oktapreview.com/oauth2/default/v1/userinfo
                – Satyanvesh Muppaneni
                Nov 11 at 3:57












              • In okta app the login redirect uri is : localhost:8080/login Initiate login uri is : localhost:8080
                – Satyanvesh Muppaneni
                Nov 11 at 4:00

















              up vote
              1
              down vote













              If you look in your browser’s address bar on the 400 error page, you’ll see it has “http://localhost:8080/login” as the redirect URI. Add this value to the Login redirect URIs in your Okta app and you should be good to go.






              share|improve this answer





















              • Thanks for the response. I have added as you said, but its redirecting to login page but not signing into application. My requirement is, upon clicking on the application(once the user is assigned this app), as he has already authenticated from okta, upon clicking the application he should see the home page
                – Satyanvesh Muppaneni
                Nov 11 at 3:49










              • FYI, following are my env variable in app.yml - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=dev-558029.oktapreview.com/oauth2/default/v1/token - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=dev-558029.oktapreview.com/oauth2/default/v1/authorize - SECURITY_OAUTH2_CLIENT_CLIENT_ID=0oah8azcnaz2GunyT0h7 - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET= D5j6vS_eNT3G56jN81riyV8w9rbxuQZph7L2wfgk - SECURITY_OAUTH2_CLIENT_SCOPE=openid profile email - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=dev-558029.oktapreview.com/oauth2/default/v1/userinfo
                – Satyanvesh Muppaneni
                Nov 11 at 3:57












              • In okta app the login redirect uri is : localhost:8080/login Initiate login uri is : localhost:8080
                – Satyanvesh Muppaneni
                Nov 11 at 4:00















              up vote
              1
              down vote










              up vote
              1
              down vote









              If you look in your browser’s address bar on the 400 error page, you’ll see it has “http://localhost:8080/login” as the redirect URI. Add this value to the Login redirect URIs in your Okta app and you should be good to go.






              share|improve this answer












              If you look in your browser’s address bar on the 400 error page, you’ll see it has “http://localhost:8080/login” as the redirect URI. Add this value to the Login redirect URIs in your Okta app and you should be good to go.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 10 at 15:21









              Matt Raible

              2,76362972




              2,76362972












              • Thanks for the response. I have added as you said, but its redirecting to login page but not signing into application. My requirement is, upon clicking on the application(once the user is assigned this app), as he has already authenticated from okta, upon clicking the application he should see the home page
                – Satyanvesh Muppaneni
                Nov 11 at 3:49










              • FYI, following are my env variable in app.yml - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=dev-558029.oktapreview.com/oauth2/default/v1/token - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=dev-558029.oktapreview.com/oauth2/default/v1/authorize - SECURITY_OAUTH2_CLIENT_CLIENT_ID=0oah8azcnaz2GunyT0h7 - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET= D5j6vS_eNT3G56jN81riyV8w9rbxuQZph7L2wfgk - SECURITY_OAUTH2_CLIENT_SCOPE=openid profile email - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=dev-558029.oktapreview.com/oauth2/default/v1/userinfo
                – Satyanvesh Muppaneni
                Nov 11 at 3:57












              • In okta app the login redirect uri is : localhost:8080/login Initiate login uri is : localhost:8080
                – Satyanvesh Muppaneni
                Nov 11 at 4:00




















              • Thanks for the response. I have added as you said, but its redirecting to login page but not signing into application. My requirement is, upon clicking on the application(once the user is assigned this app), as he has already authenticated from okta, upon clicking the application he should see the home page
                – Satyanvesh Muppaneni
                Nov 11 at 3:49










              • FYI, following are my env variable in app.yml - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=dev-558029.oktapreview.com/oauth2/default/v1/token - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=dev-558029.oktapreview.com/oauth2/default/v1/authorize - SECURITY_OAUTH2_CLIENT_CLIENT_ID=0oah8azcnaz2GunyT0h7 - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET= D5j6vS_eNT3G56jN81riyV8w9rbxuQZph7L2wfgk - SECURITY_OAUTH2_CLIENT_SCOPE=openid profile email - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=dev-558029.oktapreview.com/oauth2/default/v1/userinfo
                – Satyanvesh Muppaneni
                Nov 11 at 3:57












              • In okta app the login redirect uri is : localhost:8080/login Initiate login uri is : localhost:8080
                – Satyanvesh Muppaneni
                Nov 11 at 4:00


















              Thanks for the response. I have added as you said, but its redirecting to login page but not signing into application. My requirement is, upon clicking on the application(once the user is assigned this app), as he has already authenticated from okta, upon clicking the application he should see the home page
              – Satyanvesh Muppaneni
              Nov 11 at 3:49




              Thanks for the response. I have added as you said, but its redirecting to login page but not signing into application. My requirement is, upon clicking on the application(once the user is assigned this app), as he has already authenticated from okta, upon clicking the application he should see the home page
              – Satyanvesh Muppaneni
              Nov 11 at 3:49












              FYI, following are my env variable in app.yml - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=dev-558029.oktapreview.com/oauth2/default/v1/token - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=dev-558029.oktapreview.com/oauth2/default/v1/authorize - SECURITY_OAUTH2_CLIENT_CLIENT_ID=0oah8azcnaz2GunyT0h7 - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET= D5j6vS_eNT3G56jN81riyV8w9rbxuQZph7L2wfgk - SECURITY_OAUTH2_CLIENT_SCOPE=openid profile email - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=dev-558029.oktapreview.com/oauth2/default/v1/userinfo
              – Satyanvesh Muppaneni
              Nov 11 at 3:57






              FYI, following are my env variable in app.yml - SECURITY_OAUTH2_CLIENT_ACCESS_TOKEN_URI=dev-558029.oktapreview.com/oauth2/default/v1/token - SECURITY_OAUTH2_CLIENT_USER_AUTHORIZATION_URI=dev-558029.oktapreview.com/oauth2/default/v1/authorize - SECURITY_OAUTH2_CLIENT_CLIENT_ID=0oah8azcnaz2GunyT0h7 - SECURITY_OAUTH2_CLIENT_CLIENT_SECRET= D5j6vS_eNT3G56jN81riyV8w9rbxuQZph7L2wfgk - SECURITY_OAUTH2_CLIENT_SCOPE=openid profile email - SECURITY_OAUTH2_RESOURCE_USER_INFO_URI=dev-558029.oktapreview.com/oauth2/default/v1/userinfo
              – Satyanvesh Muppaneni
              Nov 11 at 3:57














              In okta app the login redirect uri is : localhost:8080/login Initiate login uri is : localhost:8080
              – Satyanvesh Muppaneni
              Nov 11 at 4:00






              In okta app the login redirect uri is : localhost:8080/login Initiate login uri is : localhost:8080
              – Satyanvesh Muppaneni
              Nov 11 at 4:00














              up vote
              0
              down vote













              Im sensing the problem is with authentication. I have created a user called admin in my okta developer account. In java logs i saw the below error




              2018-11-12 10:51:02.720 DEBUG 29646 --- [ XNIO-2 task-13]
              c.m.myapp.config.OAuth2Configuration : Saving login origin URI:
              http://localhost:8080/ 2018-11-12 10:51:02.721 WARN 29646 --- [
              XNIO-2 task-13] o.s.c.n.zuul.web.ZuulHandlerMapping : No routes
              found from RouteLocator 2018-11-12 10:51:04.015 DEBUG 29646 --- [
              XNIO-2 task-13] c.m.myapp.aop.logging.LoggingAspect : Enter:
              com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
              argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:04.014Z,
              principal=0oahe7g64oGVGiok50h7, type=AUTHENTICATION_SUCCESS,
              data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
              tokenType=BearertokenValue=}]] Hibernate: insert into
              jhi_persistent_audit_event (event_date, event_type, principal) values
              (?, ?, ?) 2018-11-12 10:51:04.022 DEBUG 29646 --- [ XNIO-2 task-13]
              c.m.myapp.aop.logging.LoggingAspect : Exit:
              com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
              result = null Hibernate: insert into jhi_persistent_audit_evt_data
              (event_id, name, value) values (?, ?, ?) 2018-11-12 10:51:04.029 DEBUG
              29646 --- [ XNIO-2 task-13] m.m.s.OAuth2AuthenticationSuccessHandler :
              Redirecting to saved login origin URI: http://localhost:8080/
              2018-11-12 10:51:05.039 DEBUG 29646 --- [ XNIO-2 task-15]
              c.m.myapp.aop.logging.LoggingAspect : Enter:
              com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
              argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:05.039Z,
              principal=0oahe7g64oGVGiok50h7, type=AUTHORIZATION_FAILURE,
              data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
              tokenType=BearertokenValue=,
              type=org.springframework.security.access.AccessDeniedException,
              message=Access is denied}]] 2018-11-12 10:51:05.039 DEBUG 29646 --- [
              XNIO-2 task-15] c.m.myapp.aop.logging.LoggingAspect : Exit:
              com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
              result = null 2018-11-12 10:51:05.079 DEBUG 29646 --- [ XNIO-2
              task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
              com.mycompany.myapp.web.rest.AccountResource.getAccount() with
              argument[s] =
              [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
              Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
              Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
              sessionId=, tokenType=BearertokenValue=; Not granted
              any authorities] 2018-11-12 10:51:05.081 DEBUG 29646 --- [ XNIO-2
              task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
              com.mycompany.myapp.service.UserService.getUserFromAuthentication()
              with argument[s] =
              [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
              Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
              Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
              sessionId=, tokenType=BearertokenValue=; Not granted
              any authorities] 2018-11-12 10:51:05.082 ERROR 29646 --- [ XNIO-2
              task-16] c.m.myapp.aop.logging.LoggingAspect : Exception in
              com.mycompany.myapp.service.UserService.getUserFromAuthentication()
              with cause = 'NULL' and exception = 'null'



              java.lang.NullPointerException: null at
              com.mycompany.myapp.service.UserService.getUserFromAuthentication(UserService.java:153)
              at
              com.mycompany.myapp.service.UserService$$FastClassBySpringCGLIB$$2169c3ce.invoke()
              at
              org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
              at
              org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
              at
              org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
              at
              com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498) at
              org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
              at
              org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
              at
              org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
              at
              org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
              at
              com.mycompany.myapp.service.UserService$$EnhancerBySpringCGLIB$$599f99c8.getUserFromAuthentication()
              at
              com.mycompany.myapp.web.rest.AccountResource.getAccount(AccountResource.java:59)
              at
              com.mycompany.myapp.web.rest.AccountResource$$FastClassBySpringCGLIB$$bb2cce5e.invoke()
              at
              org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
              at
              org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
              at
              org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
              at
              com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498) at
              org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
              at
              org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
              at
              org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
              at
              com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
              at
              com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
              at
              org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
              at
              org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
              at
              com.mycompany.myapp.web.rest.AccountResource$$EnhancerBySpringCGLIB$$fc91dc3c.getAccount()
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
              sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at
              sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498) at
              org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
              at
              org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
              at
              org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
              at
              org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
              at
              org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
              at
              org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
              at
              org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
              at
              org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
              at
              org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
              at
              org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at
              org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at
              io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
              at
              io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
              at
              com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
              at
              io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
              at
              io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
              at
              org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
              at
              io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
              at
              io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
              at







              share|improve this answer



























                up vote
                0
                down vote













                Im sensing the problem is with authentication. I have created a user called admin in my okta developer account. In java logs i saw the below error




                2018-11-12 10:51:02.720 DEBUG 29646 --- [ XNIO-2 task-13]
                c.m.myapp.config.OAuth2Configuration : Saving login origin URI:
                http://localhost:8080/ 2018-11-12 10:51:02.721 WARN 29646 --- [
                XNIO-2 task-13] o.s.c.n.zuul.web.ZuulHandlerMapping : No routes
                found from RouteLocator 2018-11-12 10:51:04.015 DEBUG 29646 --- [
                XNIO-2 task-13] c.m.myapp.aop.logging.LoggingAspect : Enter:
                com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:04.014Z,
                principal=0oahe7g64oGVGiok50h7, type=AUTHENTICATION_SUCCESS,
                data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
                tokenType=BearertokenValue=}]] Hibernate: insert into
                jhi_persistent_audit_event (event_date, event_type, principal) values
                (?, ?, ?) 2018-11-12 10:51:04.022 DEBUG 29646 --- [ XNIO-2 task-13]
                c.m.myapp.aop.logging.LoggingAspect : Exit:
                com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                result = null Hibernate: insert into jhi_persistent_audit_evt_data
                (event_id, name, value) values (?, ?, ?) 2018-11-12 10:51:04.029 DEBUG
                29646 --- [ XNIO-2 task-13] m.m.s.OAuth2AuthenticationSuccessHandler :
                Redirecting to saved login origin URI: http://localhost:8080/
                2018-11-12 10:51:05.039 DEBUG 29646 --- [ XNIO-2 task-15]
                c.m.myapp.aop.logging.LoggingAspect : Enter:
                com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:05.039Z,
                principal=0oahe7g64oGVGiok50h7, type=AUTHORIZATION_FAILURE,
                data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
                tokenType=BearertokenValue=,
                type=org.springframework.security.access.AccessDeniedException,
                message=Access is denied}]] 2018-11-12 10:51:05.039 DEBUG 29646 --- [
                XNIO-2 task-15] c.m.myapp.aop.logging.LoggingAspect : Exit:
                com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                result = null 2018-11-12 10:51:05.079 DEBUG 29646 --- [ XNIO-2
                task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
                com.mycompany.myapp.web.rest.AccountResource.getAccount() with
                argument[s] =
                [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
                Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
                Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
                sessionId=, tokenType=BearertokenValue=; Not granted
                any authorities] 2018-11-12 10:51:05.081 DEBUG 29646 --- [ XNIO-2
                task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
                com.mycompany.myapp.service.UserService.getUserFromAuthentication()
                with argument[s] =
                [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
                Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
                Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
                sessionId=, tokenType=BearertokenValue=; Not granted
                any authorities] 2018-11-12 10:51:05.082 ERROR 29646 --- [ XNIO-2
                task-16] c.m.myapp.aop.logging.LoggingAspect : Exception in
                com.mycompany.myapp.service.UserService.getUserFromAuthentication()
                with cause = 'NULL' and exception = 'null'



                java.lang.NullPointerException: null at
                com.mycompany.myapp.service.UserService.getUserFromAuthentication(UserService.java:153)
                at
                com.mycompany.myapp.service.UserService$$FastClassBySpringCGLIB$$2169c3ce.invoke()
                at
                org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
                at
                org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
                at
                org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
                at
                com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at
                sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498) at
                org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
                at
                org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
                at
                org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
                at
                org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
                at
                com.mycompany.myapp.service.UserService$$EnhancerBySpringCGLIB$$599f99c8.getUserFromAuthentication()
                at
                com.mycompany.myapp.web.rest.AccountResource.getAccount(AccountResource.java:59)
                at
                com.mycompany.myapp.web.rest.AccountResource$$FastClassBySpringCGLIB$$bb2cce5e.invoke()
                at
                org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
                at
                org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
                at
                org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
                at
                com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at
                sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498) at
                org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
                at
                org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
                at
                org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
                at
                com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
                at
                com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
                at
                org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                at
                org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
                at
                com.mycompany.myapp.web.rest.AccountResource$$EnhancerBySpringCGLIB$$fc91dc3c.getAccount()
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at
                sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498) at
                org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
                at
                org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
                at
                org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
                at
                org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
                at
                org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
                at
                org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
                at
                org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
                at
                org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
                at
                org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
                at
                org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at
                org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at
                io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
                at
                io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
                at
                com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
                at
                io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
                at
                io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
                at
                org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
                at
                io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
                at
                io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
                at







                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Im sensing the problem is with authentication. I have created a user called admin in my okta developer account. In java logs i saw the below error




                  2018-11-12 10:51:02.720 DEBUG 29646 --- [ XNIO-2 task-13]
                  c.m.myapp.config.OAuth2Configuration : Saving login origin URI:
                  http://localhost:8080/ 2018-11-12 10:51:02.721 WARN 29646 --- [
                  XNIO-2 task-13] o.s.c.n.zuul.web.ZuulHandlerMapping : No routes
                  found from RouteLocator 2018-11-12 10:51:04.015 DEBUG 29646 --- [
                  XNIO-2 task-13] c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:04.014Z,
                  principal=0oahe7g64oGVGiok50h7, type=AUTHENTICATION_SUCCESS,
                  data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
                  tokenType=BearertokenValue=}]] Hibernate: insert into
                  jhi_persistent_audit_event (event_date, event_type, principal) values
                  (?, ?, ?) 2018-11-12 10:51:04.022 DEBUG 29646 --- [ XNIO-2 task-13]
                  c.m.myapp.aop.logging.LoggingAspect : Exit:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  result = null Hibernate: insert into jhi_persistent_audit_evt_data
                  (event_id, name, value) values (?, ?, ?) 2018-11-12 10:51:04.029 DEBUG
                  29646 --- [ XNIO-2 task-13] m.m.s.OAuth2AuthenticationSuccessHandler :
                  Redirecting to saved login origin URI: http://localhost:8080/
                  2018-11-12 10:51:05.039 DEBUG 29646 --- [ XNIO-2 task-15]
                  c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:05.039Z,
                  principal=0oahe7g64oGVGiok50h7, type=AUTHORIZATION_FAILURE,
                  data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
                  tokenType=BearertokenValue=,
                  type=org.springframework.security.access.AccessDeniedException,
                  message=Access is denied}]] 2018-11-12 10:51:05.039 DEBUG 29646 --- [
                  XNIO-2 task-15] c.m.myapp.aop.logging.LoggingAspect : Exit:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  result = null 2018-11-12 10:51:05.079 DEBUG 29646 --- [ XNIO-2
                  task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.web.rest.AccountResource.getAccount() with
                  argument[s] =
                  [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
                  Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
                  Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
                  sessionId=, tokenType=BearertokenValue=; Not granted
                  any authorities] 2018-11-12 10:51:05.081 DEBUG 29646 --- [ XNIO-2
                  task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.service.UserService.getUserFromAuthentication()
                  with argument[s] =
                  [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
                  Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
                  Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
                  sessionId=, tokenType=BearertokenValue=; Not granted
                  any authorities] 2018-11-12 10:51:05.082 ERROR 29646 --- [ XNIO-2
                  task-16] c.m.myapp.aop.logging.LoggingAspect : Exception in
                  com.mycompany.myapp.service.UserService.getUserFromAuthentication()
                  with cause = 'NULL' and exception = 'null'



                  java.lang.NullPointerException: null at
                  com.mycompany.myapp.service.UserService.getUserFromAuthentication(UserService.java:153)
                  at
                  com.mycompany.myapp.service.UserService$$FastClassBySpringCGLIB$$2169c3ce.invoke()
                  at
                  org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
                  at
                  org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
                  at
                  org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
                  at
                  com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at
                  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498) at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
                  at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
                  at
                  org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
                  at
                  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
                  at
                  com.mycompany.myapp.service.UserService$$EnhancerBySpringCGLIB$$599f99c8.getUserFromAuthentication()
                  at
                  com.mycompany.myapp.web.rest.AccountResource.getAccount(AccountResource.java:59)
                  at
                  com.mycompany.myapp.web.rest.AccountResource$$FastClassBySpringCGLIB$$bb2cce5e.invoke()
                  at
                  org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
                  at
                  org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
                  at
                  org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
                  at
                  com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at
                  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498) at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
                  at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
                  at
                  org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
                  at
                  com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
                  at
                  com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
                  at
                  com.mycompany.myapp.web.rest.AccountResource$$EnhancerBySpringCGLIB$$fc91dc3c.getAccount()
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at
                  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498) at
                  org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
                  at
                  org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
                  at
                  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
                  at
                  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
                  at
                  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
                  at
                  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
                  at
                  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
                  at
                  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
                  at
                  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
                  at
                  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at
                  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at
                  io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
                  at
                  io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
                  at
                  com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
                  at
                  io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
                  at
                  io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
                  at
                  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
                  at
                  io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
                  at
                  io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
                  at







                  share|improve this answer














                  Im sensing the problem is with authentication. I have created a user called admin in my okta developer account. In java logs i saw the below error




                  2018-11-12 10:51:02.720 DEBUG 29646 --- [ XNIO-2 task-13]
                  c.m.myapp.config.OAuth2Configuration : Saving login origin URI:
                  http://localhost:8080/ 2018-11-12 10:51:02.721 WARN 29646 --- [
                  XNIO-2 task-13] o.s.c.n.zuul.web.ZuulHandlerMapping : No routes
                  found from RouteLocator 2018-11-12 10:51:04.015 DEBUG 29646 --- [
                  XNIO-2 task-13] c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:04.014Z,
                  principal=0oahe7g64oGVGiok50h7, type=AUTHENTICATION_SUCCESS,
                  data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
                  tokenType=BearertokenValue=}]] Hibernate: insert into
                  jhi_persistent_audit_event (event_date, event_type, principal) values
                  (?, ?, ?) 2018-11-12 10:51:04.022 DEBUG 29646 --- [ XNIO-2 task-13]
                  c.m.myapp.aop.logging.LoggingAspect : Exit:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  result = null Hibernate: insert into jhi_persistent_audit_evt_data
                  (event_id, name, value) values (?, ?, ?) 2018-11-12 10:51:04.029 DEBUG
                  29646 --- [ XNIO-2 task-13] m.m.s.OAuth2AuthenticationSuccessHandler :
                  Redirecting to saved login origin URI: http://localhost:8080/
                  2018-11-12 10:51:05.039 DEBUG 29646 --- [ XNIO-2 task-15]
                  c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  argument[s] = [AuditEvent [timestamp=2018-11-12T05:21:05.039Z,
                  principal=0oahe7g64oGVGiok50h7, type=AUTHORIZATION_FAILURE,
                  data={details=remoteAddress=0:0:0:0:0:0:0:1, sessionId=,
                  tokenType=BearertokenValue=,
                  type=org.springframework.security.access.AccessDeniedException,
                  message=Access is denied}]] 2018-11-12 10:51:05.039 DEBUG 29646 --- [
                  XNIO-2 task-15] c.m.myapp.aop.logging.LoggingAspect : Exit:
                  com.mycompany.myapp.repository.CustomAuditEventRepository.add() with
                  result = null 2018-11-12 10:51:05.079 DEBUG 29646 --- [ XNIO-2
                  task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.web.rest.AccountResource.getAccount() with
                  argument[s] =
                  [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
                  Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
                  Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
                  sessionId=, tokenType=BearertokenValue=; Not granted
                  any authorities] 2018-11-12 10:51:05.081 DEBUG 29646 --- [ XNIO-2
                  task-16] c.m.myapp.aop.logging.LoggingAspect : Enter:
                  com.mycompany.myapp.service.UserService.getUserFromAuthentication()
                  with argument[s] =
                  [org.springframework.security.oauth2.provider.OAuth2Authentication@cf5e6315:
                  Principal: 0oahe7g64oGVGiok50h7; Credentials: [PROTECTED];
                  Authenticated: true; Details: remoteAddress=0:0:0:0:0:0:0:1,
                  sessionId=, tokenType=BearertokenValue=; Not granted
                  any authorities] 2018-11-12 10:51:05.082 ERROR 29646 --- [ XNIO-2
                  task-16] c.m.myapp.aop.logging.LoggingAspect : Exception in
                  com.mycompany.myapp.service.UserService.getUserFromAuthentication()
                  with cause = 'NULL' and exception = 'null'



                  java.lang.NullPointerException: null at
                  com.mycompany.myapp.service.UserService.getUserFromAuthentication(UserService.java:153)
                  at
                  com.mycompany.myapp.service.UserService$$FastClassBySpringCGLIB$$2169c3ce.invoke()
                  at
                  org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
                  at
                  org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
                  at
                  org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
                  at
                  com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at
                  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498) at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
                  at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
                  at
                  org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
                  at
                  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
                  at
                  com.mycompany.myapp.service.UserService$$EnhancerBySpringCGLIB$$599f99c8.getUserFromAuthentication()
                  at
                  com.mycompany.myapp.web.rest.AccountResource.getAccount(AccountResource.java:59)
                  at
                  com.mycompany.myapp.web.rest.AccountResource$$FastClassBySpringCGLIB$$bb2cce5e.invoke()
                  at
                  org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
                  at
                  org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
                  at
                  org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
                  at
                  com.mycompany.myapp.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at
                  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498) at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
                  at
                  org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
                  at
                  org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
                  at
                  com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
                  at
                  com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
                  at
                  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
                  at
                  org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
                  at
                  com.mycompany.myapp.web.rest.AccountResource$$EnhancerBySpringCGLIB$$fc91dc3c.getAccount()
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
                  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at
                  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498) at
                  org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
                  at
                  org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
                  at
                  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
                  at
                  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
                  at
                  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
                  at
                  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
                  at
                  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
                  at
                  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
                  at
                  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
                  at
                  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at
                  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at
                  io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
                  at
                  io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
                  at
                  com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
                  at
                  io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
                  at
                  io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
                  at
                  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
                  at
                  io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
                  at
                  io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
                  at








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 12 at 5:38

























                  answered Nov 12 at 5:15









                  Satyanvesh Muppaneni

                  206




                  206






















                      up vote
                      0
                      down vote



                      accepted










                      Thanks, I solved the issue. The solution was, The user with which i was trying to login was not created in users table. For that I have created another user in okta and assigned the roles to it. Reset the password and tried logging to account. Upon invoking "http://localhost:8080" and clicking on "sign in" button it redirected to okta login page and logged in with the above created user and it redirected me to home page of my gateway.



                      Thank you






                      share|improve this answer

























                        up vote
                        0
                        down vote



                        accepted










                        Thanks, I solved the issue. The solution was, The user with which i was trying to login was not created in users table. For that I have created another user in okta and assigned the roles to it. Reset the password and tried logging to account. Upon invoking "http://localhost:8080" and clicking on "sign in" button it redirected to okta login page and logged in with the above created user and it redirected me to home page of my gateway.



                        Thank you






                        share|improve this answer























                          up vote
                          0
                          down vote



                          accepted







                          up vote
                          0
                          down vote



                          accepted






                          Thanks, I solved the issue. The solution was, The user with which i was trying to login was not created in users table. For that I have created another user in okta and assigned the roles to it. Reset the password and tried logging to account. Upon invoking "http://localhost:8080" and clicking on "sign in" button it redirected to okta login page and logged in with the above created user and it redirected me to home page of my gateway.



                          Thank you






                          share|improve this answer












                          Thanks, I solved the issue. The solution was, The user with which i was trying to login was not created in users table. For that I have created another user in okta and assigned the roles to it. Reset the password and tried logging to account. Upon invoking "http://localhost:8080" and clicking on "sign in" button it redirected to okta login page and logged in with the above created user and it redirected me to home page of my gateway.



                          Thank you







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 12 at 7:03









                          Satyanvesh Muppaneni

                          206




                          206






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238520%2fokta-unable-to-add-my-jhipster-microservice-application%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Guess what letter conforming each word

                              Port of Spain

                              Run scheduled task as local user group (not BUILTIN)