我正在尝试部署使用Elasticache的Java Servlet应用程序。 (Tomcat7,Beanstalk上的Java7)
但它在这个陈述中给出了错误:
client=new MemcachedClient(new InetSocketAddress(configEndpoint, clusterPort));
筹码:
java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:127)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:644)
at net.spy.memcached.MemcachedConnection.createConnections(MemcachedConnection.java:243)
at net.spy.memcached.MemcachedConnection.<init>(MemcachedConnection.java:182)
at net.spy.memcached.DefaultConnectionFactory.createConnection(DefaultConnectionFactory.java:203)
at net.spy.memcached.MemcachedClient.setupConnection(MemcachedClient.java:338)
at net.spy.memcached.MemcachedClient.initializeClientUsingConfigEndPoint(MemcachedClient.java:300)
at net.spy.memcached.MemcachedClient.<init>(MemcachedClient.java:284)
at net.spy.memcached.MemcachedClient.<init>(MemcachedClient.java:204)
at com.xxx.adserver.GetJs.<init>(GetJs.java:48)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:143)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:680)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
我尝试编写一个简单的Java程序来连接到同一个beanstalk的ec2实例上的Elasticache集群,并且该程序正常工作。所以在tomcat中似乎有一些配置冲突。