ye___li
ye___li
采纳率66.7%
2018-11-14 09:19 阅读 3.6k

springboot security oauth2 报错 java.lang.IllegalArgumentException: URI must not be null

5
 2018-11-14 17:12:11.816 [http-nio-8081-exec-1] WARN  o.s.s.o.p.token.RemoteTokenServices-Null Client ID or Client Secret detected. Endpoint that requires authentication will reject request with 401 error. 
2018-11-14 17:12:11.823 [http-nio-8081-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet]-Servlet.service() for servlet [dispatcherServlet] in context with path [/smartHome] threw exception 
java.lang.IllegalArgumentException: URI must not be null
    at org.springframework.util.Assert.notNull(Assert.java:193)
    at org.springframework.web.util.UriComponentsBuilder.fromUriString(UriComponentsBuilder.java:197)
    at org.springframework.web.util.DefaultUriBuilderFactory$DefaultUriBuilder.initUriComponentsBuilder(DefaultUriBuilderFactory.java:218)
    at org.springframework.web.util.DefaultUriBuilderFactory$DefaultUriBuilder.<init>(DefaultUriBuilderFactory.java:214)
    at org.springframework.web.util.DefaultUriBuilderFactory.uriString(DefaultUriBuilderFactory.java:197)
    at org.springframework.web.util.DefaultUriBuilderFactory.expand(DefaultUriBuilderFactory.java:191)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:679)
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:600)
    at org.springframework.security.oauth2.provider.token.RemoteTokenServices.postForMap(RemoteTokenServices.java:147)
    at org.springframework.security.oauth2.provider.token.RemoteTokenServices.loadAuthentication(RemoteTokenServices.java:106)
    at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager.authenticate(OAuth2AuthenticationManager.java:83)
    at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:150)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at com.lx.smarthome.securityoauth.permit.PermitAuthenticationFilter.doFilterInternal(PermitAuthenticationFilter.java:122)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • devmiao devmiao 2018-11-14 11:13
  • ye___li ye___li 2018-11-15 01:02

    正常情况下:

    ![![

    
    
    
    

    图片说明](https://img-ask.csdn.net/upload/201811/15/1542243751_545443.png)

    
    

    图片说明](https://img-ask.csdn.net/upload/201811/15/1542243674_674681.png)

     2018-11-15 08:57:16.697 [http-nio-8081-exec-3] INFO  c.l.s.s.p.PermitAuthenticationFilter-请求信息==== { url : /smartHome/user/Login | remoteAddr : 127.0.0.1 | requestMethod : POST
    param : {phone:["13553406767"],code:null,userLoginType["0"]} 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG o.apache.commons.beanutils.BeanUtils-BeanUtils.populate(User{, userId=null, username=null, password=null, phone=null, email=null, salt=null, userGateways=null}, org.apache.catalina.util.ParameterMap@2a18900e) 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG o.a.commons.beanutils.ConvertUtils-Convert string '13553406767' to class 'java.lang.String' 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG o.a.c.b.converters.StringConverter-Converting 'String' value '13553406767' to type 'String' 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG o.a.commons.beanutils.ConvertUtils-Convert string '667788' to class 'java.lang.String' 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG o.a.c.b.converters.StringConverter-Converting 'String' value '667788' to type 'String' 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG o.a.commons.beanutils.ConvertUtils-Convert string '0' to class 'java.lang.String' 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG o.a.c.b.converters.StringConverter-Converting 'String' value '0' to type 'String' 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG org.mybatis.spring.SqlSessionUtils-Creating a new SqlSession 
    2018-11-15 08:57:16.698 [http-nio-8081-exec-3] DEBUG org.mybatis.spring.SqlSessionUtils-SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@21c4eece] was not registered for synchronization because synchronization is not active 
    2018-11-15 08:57:16.721 [http-nio-8081-exec-3] DEBUG o.m.s.t.SpringManagedTransaction-JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@2c9baf1] will not be managed by Spring 
    2018-11-15 08:57:16.721 [http-nio-8081-exec-3] DEBUG c.l.s.a.user.dao.UserMapper.getUser-==>  Preparing: SELECT userId, nickname,username, password, phone, email, salt FROM user where phone=? and username=?  
    2018-11-15 08:57:16.722 [http-nio-8081-exec-3] DEBUG c.l.s.a.user.dao.UserMapper.getUser-==> Parameters: 13553406767(String), 13553406767(String) 
    2018-11-15 08:57:16.735 [http-nio-8081-exec-3] DEBUG c.l.s.a.user.dao.UserMapper.getUser-<==      Total: 1 
    

    异常情况:

    点赞 评论 复制链接分享

相关推荐