Exception while starting hazelcast instance

1,857 views
Skip to first unread message

Santosh Math

unread,
Sep 24, 2013, 5:34:42 AM9/24/13
to haze...@googlegroups.com
if i run the code using hazelcast source(from eclipse), I am getting exception while starting the hazelcast instance.

Note,
1. This issues comes only if use hazelcast source code instead of binaries.
2. This occurs with hazelcast 3.0.x.
3. I already raised this as an issue against 3.0.0 and it's closed in 3.0.2.


Java Code:
========
        HazelcastInstance instance = Hazelcast.newHazelcastInstance();
        System.out.println("Starting server...");

        System.out.println("Creating map...");
        IMap<Integer, String> mapCustomers = instance.getMap("dev");
        mapCustomers.put(1, "customer 1");
        mapCustomers.put(2, "customer 2");
        mapCustomers.put(3, "customer 3");
        mapCustomers.put(4, "customer 4");

        System.out.println("Server STARTED and map created.");


Hazelcast Console:
==============
Sep 24, 2013 2:00:27 PM com.hazelcast.config.XmlConfigBuilder
INFO: Looking for hazelcast.xml config file in classpath.
Sep 24, 2013 2:00:27 PM com.hazelcast.config.XmlConfigBuilder
WARNING: Could not find hazelcast.xml in classpath.
Hazelcast will use hazelcast-default.xml config file in jar.
Sep 24, 2013 2:00:27 PM com.hazelcast.config.XmlConfigBuilder
WARNING: Could not find hazelcast-default.xml in the classpath!
This may be due to a wrong-packaged or corrupted jar file.
Sep 24, 2013 2:00:27 PM com.hazelcast.config.XmlConfigBuilder
WARNING: Having problem parsing the hazelcast-default.xml config file in the classpath.
Exception: InputStream cannot be null
Hazelcast will start with default configuration.
Sep 24, 2013 2:00:27 PM com.hazelcast.instance.DefaultAddressPicker
INFO: Prefer IPv4 stack is true.
Sep 24, 2013 2:00:28 PM com.hazelcast.instance.DefaultAddressPicker
INFO: Picked Address[16.154.181.109]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Sep 24, 2013 2:00:29 PM com.hazelcast.system
INFO: [16.154.181.109]:5701 [dev] Hazelcast Community Edition unknown (unknown) starting at Address[16.154.181.109]:5701
Sep 24, 2013 2:00:29 PM com.hazelcast.system
INFO: [16.154.181.109]:5701 [dev] Copyright (C) 2008-2013 Hazelcast.com
Sep 24, 2013 2:00:29 PM com.hazelcast.core.LifecycleService
INFO: [16.154.181.109]:5701 [dev] Address[16.154.181.109]:5701 is STARTING
Sep 24, 2013 2:00:29 PM com.hazelcast.spi.impl.ServiceManager
SEVERE: [16.154.181.109]:5701 [dev] Error while initializing service: Could not find PortableFactory for factoryId: -3
com.hazelcast.nio.serialization.HazelcastSerializationException: Could not find PortableFactory for factoryId: -3
    at com.hazelcast.nio.serialization.SerializationContextImpl.getPortableContext(SerializationContextImpl.java:90)
    at com.hazelcast.nio.serialization.SerializationContextImpl.registerClassDefinition(SerializationContextImpl.java:65)
    at com.hazelcast.client.ClientEngineImpl.init(ClientEngineImpl.java:388)
    at com.hazelcast.spi.impl.ServiceManager.start(ServiceManager.java:134)
    at com.hazelcast.spi.impl.NodeEngineImpl.start(NodeEngineImpl.java:76)
    at com.hazelcast.instance.Node.start(Node.java:304)
    at com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:94)
    at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:87)
    at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:65)
    at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:87)
    at StartServer.main(StartServer.java:8)

Sep 24, 2013 2:00:29 PM com.hazelcast.instance.Node
WARNING: [16.154.181.109]:5701 [dev] No join method is enabled! Starting standalone.
Sep 24, 2013 2:00:29 PM com.hazelcast.instance.Node
WARNING: [16.154.181.109]:5701 [dev] ManagementCenterService could not be constructed!
java.lang.IllegalArgumentException: version string 'unknown' is not valid
    at com.hazelcast.management.ManagementCenterIdentifier.getVersionAsInt(ManagementCenterIdentifier.java:58)
    at com.hazelcast.management.ManagementCenterIdentifier.<init>(ManagementCenterIdentifier.java:42)
    at com.hazelcast.management.ManagementCenterService.<init>(ManagementCenterService.java:91)
    at com.hazelcast.instance.Node.start(Node.java:328)
    at com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:94)
    at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:87)
    at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:65)
    at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:87)
    at StartServer.main(StartServer.java:8)

Sep 24, 2013 2:00:29 PM com.hazelcast.core.LifecycleService
INFO: [16.154.181.109]:5701 [dev] Address[16.154.181.109]:5701 is STARTED
Starting server...
Creating map...
Sep 24, 2013 2:00:30 PM com.hazelcast.util.HealthMonitor
INFO: [16.154.181.109]:5701 [dev]
memory used=4.1M, free=11.4M, total=15.5M, max=247.5M, used/total=26.13% used/max=1.64%
cpu process-load=-100.00%, system-load=100.00%, system-loadaverage=-100.00%
Sep 24, 2013 2:00:30 PM com.hazelcast.partition.PartitionService
INFO: [16.154.181.109]:5701 [dev] Initializing cluster partition table first arrangement...
Server STARTED and map created.


Peter Veentjer

unread,
Sep 24, 2013, 7:05:19 AM9/24/13
to haze...@googlegroups.com
Hi Santosh,

I tried your example and it looks fine. So I need to know:

- the java version/vendor you are using
- the operating system your are using
- the exact version of Hazelcast that is causing this problem. You said that you are using the Hazelcast sourcecode, so you are building hazelcast yourself? Which branch are you using?

I have seen this issue with someone else, so I would like to get as much information as possible so we can reproduce and fix the problem.

Santosh Math

unread,
Sep 24, 2013, 7:52:14 AM9/24/13
to haze...@googlegroups.com
Hi Peter,

I am using the hazelcast 3.0.2 source from github.

I have attached the eclipse project with this post. If you are using eclipse then you can import this project and run the program "StartServer.java". (Note: due to size restriction of posting the message, i have not added the required jar files in the attached zip file).

Details:
- Windows Vista (32-Bit)
- Eclipse Indigo
- Hazelcast 3.0.2
- Github tag: v3.0.2 (https://github.com/hazelcast/hazelcast/tree/v3.0.2)
- java version "1.7.0_10"
  Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
  Java HotSpot(TM) Client VM (build 23.6-b04, mixed mode, sharing)

To Reproduce,
1. Download the source from https://github.com/hazelcast/hazelcast/archive/v3.0.2.zip and extract the source to some location.
2. Create a java project in eclipse.
3. Import "hazelcast-client" and "hazelcast" sources from the downloaded copy into above created java project.
4. Use the below Sample program to reproduce,

public class StartServer {

    public static void main(String[] args) {
hc_3.0.2.zip

Peter Veentjer

unread,
Sep 24, 2013, 12:08:00 PM9/24/13
to haze...@googlegroups.com
Hi Santosh,

thank you very much for your detailed information.

I hope I can have a look at it today, but we are quite tied up at Java One. 

Peter.


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast.
For more options, visit https://groups.google.com/groups/opt_out.

Santosh Math

unread,
Sep 25, 2013, 1:00:19 AM9/25/13
to haze...@googlegroups.com
Hi Peter,

I debugged little bit for this exception. The problem is with following line in ClientPortableHook, this is returning -3(default value).

public static final int ID = FactoryIdHelper.getFactoryId(FactoryIdHelper.CLIENT_PORTABLE_FACTORY, -3);

Because of above line, factoryId will be -3. And in following method of SerializationContextImpl

    private PortableContext getPortableContext(int factoryId) {
        final PortableContext ctx = portableContextMap.get(factoryId);
        if (ctx == null) {
            throw new HazelcastSerializationException("Could not find PortableFactory for factoryId: " + factoryId);
        }
        return ctx;
    }

The portableContextMap is empty and throws the exception.

Regards,
Santosh

Peter Veentjer

unread,
Sep 25, 2013, 10:03:01 AM9/25/13
to haze...@googlegroups.com
Hi Santosh,

excellent. 

I hope I have some time for it today but is is really crazy here at Java One (we are booth babes). So we wake up, eat, go to java one, eat, go back to hotel and sleep :) Today is our last day, so tomorrow we have a lot more time.

Peter.

Santosh Math

unread,
Sep 25, 2013, 11:21:34 PM9/25/13
to haze...@googlegroups.com
Ok. No issue. Hope you enjoyed @ Java One :)

Santosh Math

unread,
Sep 26, 2013, 5:57:29 AM9/26/13
to haze...@googlegroups.com
Hi Peter,

I resolved this issue. The problem was because of META-INF/services directory. When i ran hazelcast from eclipse, this directory was not in classpath. So i copied the directory and put it in classpath. Now server is starting without any problem.

These files were not there in 2.x version of hazelcast because of which i was successfully able to run 2.5 from eclipse.

Thank you for your support.

Santosh

Peter Veentjer

unread,
Sep 26, 2013, 8:49:24 AM9/26/13
to haze...@googlegroups.com
Hi Santosh,

great :) And thanks for sending back the cause, so that others can be helped in the future.

Santosh Math

unread,
Sep 26, 2013, 9:01:41 AM9/26/13
to haze...@googlegroups.com
Hi Peter,

I was thinking, it would be good to display a ERROR or WARNING in console if the files in "META-INF/services" are not found. Similar to how it displays for not finding "hazelcast.xml".

Thanks,
Santosh

Peter Veentjer

unread,
Sep 26, 2013, 3:33:29 PM9/26/13
to haze...@googlegroups.com
Hi Santosh,

can you create an issue for it on the issue tracker so we don't forget?

Santosh Math

unread,
Sep 27, 2013, 3:07:25 AM9/27/13
to haze...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages