Redis and session sharing use error at the same time

Source: Internet
Author: User
Tags redis socket

Reids Error

/** * Note If jedisconnectionfactory is used with Jedispool error <br/> * * @return */@Bean @Order (2)
        @ConfigurationProperties (prefix = "Spring.redis") public jedisconnectionfactory getconnectionfactory () {
        Jedisconnectionfactory factory = new Jedisconnectionfactory ();
        Factory.setusepool (TRUE);
            if (config = = null) {//Baseapplication.getbeanfactory (). Createbean (Jedispoolconfig.class);
        Config = Getredisconfig ();

        } factory.setpoolconfig (This.config);
        Logger.info ("Jedisconnectionfactory Bean init success.");
    return factory; }//@Bean//@Order (3)//Public Jedispool Getredispool () {//if (config = = null) {////Baseapplicat
Ion.getbeanfactory (). Createbean (Jedispoolconfig.class);
Config = Getredisconfig ();
}//Jedispool Jedispool = new Jedispool (config, host, port, 15000, password, 1);
return jedispool; //  }
Error starting ApplicationContext.
To display the Auto-configuration report re-run your application with ' debug ' enabled.
2018-03-24 15:49:32.517 ERROR [main] [Hio-sys] o.s.boot.springapplication-application startup failed Org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' Enablerediskeyspacenotificationsinitializer ' defined in Org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration:Invocation of Init method failed; Nested exception is org.springframework.data.redis.RedisConnectionFailureException:Cannot get Jedis connection;  Nested exception is redis.clients.jedis.exceptions.JedisConnectionException:Could does get a resource from the pool at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1628) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( Abstractautowirecapablebeanfactory.java:555) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:483) at org.springframework.beans.factory.support.abstractbeanfactory$1. GetObject (abstractbeanfactory.java:306) at Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:230) at Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:302) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:197) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:761) at Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:867) at Org.springframework.context.support.abstractapplicationcontext.__refresh (Abstractapplicationcontext.java:543) at Org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh ( Abstractapplicationcontext.java) at Org.springframework.context.support.AbstractApplicationContext.refresh ( Abstractapplicationcontext.java) at Org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh ( embeddedwebapplicationcontext.java:122) at Org.springframework.boot.SpringApplication.refresh ( springapplication.java:693) at Org.springframework.boot.SpringApplication.refreshContext (Springapplication.java : In Org.springframework.boot.SpringApplication.run (springapplication.java:303) at Com.jzy.hio.HioSysApplicati On.main (hiosysapplication.java:36) caused by:org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection;  Nested exception is redis.clients.jedis.exceptions.JedisConnectionException:Could does get a resource from the pool at Org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJeDisconnector (jedisconnectionfactory.java:204) at Org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection ( jedisconnectionfactory.java:348) at org.springframework.session.data.redis.config.annotation.web.http.redishttpsessionconfiguration$ Enablerediskeyspacenotificationsinitializer.afterpropertiesset (redishttpsessionconfiguration.java:249) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1687) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1624) ...  Common frames omitted caused by:redis.clients.jedis.exceptions.JedisConnectionException:Could not get a resource from The pool at Redis.clients.util.Pool.getResource (pool.java:53) at Redis.clients.jedis.JedisPool.getResource (jedisp ool.java:226) at Redis.clients.jedis.JedisPool.getResource (Jedispool.java:(+) at Org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector ( jedisconnectionfactory.java:194) ... Common frames omitted caused by:redis.clients.jedis.exceptions.JedisConnectionException: Java.net.ConnectException:Connection Refused:connect at Redis.clients.jedis.Connection.connect (Connection.java : 207) at Redis.clients.jedis.BinaryClient.connect (binaryclient.java:93) at Redis.clients.jedis.BinaryJedis.connect (binaryjedis.java:1767) at Redis.clients.jedis.JedisFactory.makeObject (jedisfactory.java:106) at Org.apache.common S.pool2.impl.genericobjectpool.create (genericobjectpool.java:888) at Org.apache.commons.pool2.impl.GenericObjectPool.borrowObject (genericobjectpool.java:432) at Org.apache.commons.pool2.impl.GenericObjectPool.borrowObject (genericobjectpool.java:361) at Redis.clients.util.Pool.getResource (pool.java:49) ... Common frames omitted caused by:java.net.ConnectException:Connection refused: Connect at Java.net.DualStackPlainSocketImpl.waitForConnect (Native Method) at Java.net.DualStackPlainSocketImpl. Socketconnect (dualstackplainsocketimpl.java:85) at Java.net.AbstractPlainSocketImpl.doConnect ( abstractplainsocketimpl.java:350) at Java.net.AbstractPlainSocketImpl.connectToAddress ( abstractplainsocketimpl.java:206) at Java.net.AbstractPlainSocketImpl.connect (abstractplainsocketimpl.java:188) A T Java.net.PlainSocketImpl.connect (plainsocketimpl.java:172) at Java.net.SocksSocketImpl.connect ( sockssocketimpl.java:392) at Java.net.Socket.connect (socket.java:589) at Redis.clients.jedis.Connection.connect (Co nnection.java:184) ... Common frames omitted
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.