Enable User Code Namespaces
For security reasons, you must enable User Code Namespaces using static configuration. You can do this programmatically, or using the Hazelcast configuration file.
If using dynamic persistence, this must be enabled in the Hazelcast configuration file. For further information persisting changes, see the Dynamic Configuration Overview topic under the Configure and Manage Clusters section. |
Enable Programmatically
To enable User Code Namespaces programmatically, create a Member.java file, add the following, then save the file to your configuration folder:
package com.hazelcast.namespace.staticconfig.classconfig;
import com.hazelcast.config.Config;
import com.hazelcast.config.UserCodeNamespaceConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
public class Member {
public static void main(String[] args) {
Config config = new Config();
config.getNamespacesConfig().setEnabled(true);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
}
}
Enable in Configuration File
To enable User Code Namespaces using the hazelcast configuration file, complete the following steps:
Complete the Configuration
You can continue your configuration as follows:
-
In the hazelcast configuration file, as described in the Static Configuration section
-
Using static programmatic configuration, as described in the Programmatic Configuration topic
-
Using dynamic configuration, as described in the Dynamic Configuration API section