I'm facing some problems when configuring hazelcast ec2 auto
discovery. When I try to start the cluster in Amazon's environment I
got the following stack trace:
Dec 19, 2011 8:28:44 AM com.hazelcast.impl.TcpIpJoinerOverAWS
WARNING: ec2.us-east-1b.amazonaws.com
java.net.UnknownHostException: ec2.us-east-1b.amazonaws.com
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:
175)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
at java.net.Socket.connect(Socket.java:546)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:579)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:
160)
at sun.net.NetworkClient.doConnect(NetworkClient.java:178)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:409)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:
275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:332)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:
191)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:
876)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:
177)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:
153)
at
com.hazelcast.aws.impl.DescribeInstances.callService(DescribeInstances.java:
87)
at
com.hazelcast.aws.impl.DescribeInstances.execute(DescribeInstances.java:
77)
at com.hazelcast.aws.impl.AWSClient.getPrivateDnsNames(AWSClient.java:
34)
at
com.hazelcast.impl.TcpIpJoinerOverAWS.getMembers(TcpIpJoinerOverAWS.java:
49)
at com.hazelcast.impl.TcpIpJoiner.getPossibleMembers(TcpIpJoiner.java:
324)
at
com.hazelcast.impl.TcpIpJoiner.searchForOtherClusters(TcpIpJoiner.java:
403)
at
com.hazelcast.impl.SplitBrainHandler.searchForOtherClusters(SplitBrainHandler.java:
58)
at com.hazelcast.impl.SplitBrainHandler.access
$000(SplitBrainHandler.java:22)
at com.hazelcast.impl.SplitBrainHandler
$1.doRun(SplitBrainHandler.java:46)
at
com.hazelcast.impl.FallThroughRunnable.run(FallThroughRunnable.java:
23)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1110)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Here follows my configuration file:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/config"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-spring.xsd">
<!-- Hazelcast spring configuration -->
<hz:hazelcast id="security-instance">
<hz:config>
<hz:group password="S3cuRit1-Clu273R" name="security-cluster"/>
<!-- Properties configuration -->
<hz:properties>
<hz:property name="hazelcast.logging.type">log4j</
hz:property>
</hz:properties>
<!-- Network configuration -->
<hz:network port="5703" port-auto-increment="true">
<hz:join>
<hz:multicast enabled="false"/>
<hz:tcp-ip enabled="false"/>
<hz:aws enabled="true" access-key="MYACCESSKEY" secret-
key="MYSECRETKEY" region="us-east-1b" security-group-name="security-
cluster"/>
</hz:join>
</hz:network>
<!-- Both maps bellow will work as a distributed cache with time-to-
live-seconds time to live on the cache objects. -->
<hz:map name="nonceMap" backup-count="1" max-size="0" time-to-live-
seconds="3600" max-idle-seconds="3600" eviction-policy="NONE" eviction-
percentage="25" merge-policy="hz.LATEST_UPDATE" read-backup-
data="true"/>
<hz:map name="tokenMap" backup-count="1" max-size="0" time-to-live-
seconds="450" max-idle-seconds="450" eviction-policy="NONE" eviction-
percentage="25" merge-policy="hz.LATEST_UPDATE" read-backup-
data="true"/>
<!-- Bellow we are configuring some application configuration cache
maps. -->
<hz:map name="appConfigMap" backup-count="1" max-size="0"
read-backup-data="true"/>
<hz:map name="appErrorMap" backup-count="1" max-size="0"
read-backup-data="true"/>
</hz:config>
</hz:hazelcast>
</beans>
and also my small application for starting hazelcast.
public final class SecurityClusterInitializer {
/** Logger for the class. */
private static final Logger logger =
LoggerFactory.getLogger(SecurityClusterInitializer.class);
/** The hazelcast instance for this server. */
private static HazelcastInstance instance = null;
/**
* Constructor
*/
private SecurityClusterInitializer() {
}
/**
* Main method.
*
* @param args The arguments parameters
*/
public static void main(String[] args) {
try {
LoggerUtils.trace(logger, "Entering the method main {" +
(args.length > 0 ? args[0] : "?????") + "}");
// Reading the necessary properties for starting the
cluster.
if(args.length > 0) {
if(args[0].equals("start")) {
if(null == instance) {
LoggerUtils.info(logger, "Starting a new
instance.");
LoggerUtils.info(logger, "Spring Beans = {" +
System.getProperty("ZEUS_SECURITY_CLUSTER_SPRING_BEANS") + "}");
instance =
SecurityClusterInitializer.initializeInstance(System.getProperty("ZEUS_SECURITY_CLUSTER_SPRING_BEANS"));
LoggerUtils.info(logger, "Instance {" +
instance.getName() + "} started");
}
}
}
else {
System.out.println("Usage: java -jar security-cluster-
initializer.jar [start|shutdown]");
}
}
finally {
LoggerUtils.trace(logger, "Exiting the method main");
}
}
/**
* Method used to initialize the hazelcast cluster from the given
spring configuration.
*/
public static HazelcastInstance initializeInstance(String
configLocation) {
logger.trace("Creating a new instance of the security-
cluster");
ClassPathResource resource = new
ClassPathResource(configLocation);
logger.debug("Got the resource from {" + configLocation +
"}");
BeanFactory factory = new XmlBeanFactory(resource);
logger.debug("Got the factory for the resource {" +
configLocation + "}");
HazelcastInstance instance = (HazelcastInstance)
factory.getBean("security-instance");
logger.debug("Created the instance {" + instance.getName() +
"}");
resource = null;
factory = null;
logger.trace("The security-cluster is now created.");
return instance;
}
}
What am I doing wrong?
Thanks in advance for the help.
Rodrigo.
Thanks in advance.
Rodrigo.
On 19 dez, 11:36, Rodrigo <rjds...@gmail.com> wrote:
> Hi, Hazelcast team.
>
> I'm facing some problems when configuring hazelcast ec2 auto
> discovery. When I try to start the cluster in Amazon's environment I
> got the following stack trace:
>
> Dec 19, 2011 8:28:44 AM com.hazelcast.impl.TcpIpJoinerOverAWS
> WARNING: ec2.us-east-1b.amazonaws.com
> java.net.UnknownHostException: ec2.us-east-1b.amazonaws.com
> at
> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:
> 175)
> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
> at java.net.Socket.connect(Socket.java:546)
> at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:579)
> at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:
> 160)
> at sun.net.NetworkClient.doConnect(NetworkClient.java:178)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:409)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
> at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:
> 275)
> at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:332)
> at
> sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClien...
> 191)
> at
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:
> 876)
> at
> sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Abstrac...
> 177)
> at
> sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionI...
> SecurityClusterInitializer.initializeInstance(System.getProperty("ZEUS_SECU RITY_CLUSTER_SPRING_BEANS"));
I was using the zone instead of the region.
Thanks a lot.
Rodrigo.