当前位置:   article > 正文

java.lang.IllegalArgumentException: hostname can't be null这个异常的解决办法分析

java.lang.illegalargumentexception: hostname can't be null

HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: hostname can't be null


type Exception report

message Request processing failed; nested exception is java.lang.IllegalArgumentException: hostname can't be null

description The server encountered an internal error that prevented it from fulfilling this request.

exception

  1. org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: hostname can't be null
  2. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
  3. org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
  4. javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
  5. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
  6. javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
  7. org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  8. org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  9. org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

root cause

  1. java.lang.IllegalArgumentException: hostname can't be null
  2. java.net.InetSocketAddress.checkHost(InetSocketAddress.java:149)
  3. java.net.InetSocketAddress.<init>(InetSocketAddress.java:216)
  4. redis.clients.jedis.Connection.connect(Connection.java:142)
  5. redis.clients.jedis.BinaryClient.connect(BinaryClient.java:75)
  6. redis.clients.jedis.Connection.sendCommand(Connection.java:77)
  7. 我一开始测试的时候是没问题的但是实际运用这个jedis去自动增长主键时,却报了这个错误,后来查阅资料才发现原来是忘记写数据类型了
  8. 解决办法如下
  9. <!-- 配置Jedis-->
  10.         <bean id="jedis" class="redis.clients.jedis.Jedis">
  11.             <constructor-arg index="0" value="192.168.200.128" type="java.lang.String"/>
  12.             <constructor-arg index="1" value="6379"/>
  13.         </bean>
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号