Skip to main content
Version: 6.0-SNAPSHOT
Enterprise Edition
This feature requires Hazelcast Enterprise, a licensed edition of the Hazelcast Platform.

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.

note

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:

jave
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;
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);

public class Member {

public static void main(String[] args) {
Config config = new Config();
config.getNamespacesConfig().setEnabled(true);
}
}

Enable in Configuration File​

To enable User Code Namespaces using the hazelcast configuration file, complete the following steps:

  1. Open the hazelcast configuration file in your preferred editor

    The hazelcast configuration file can be either an XML or YAML file.

  2. Scroll to the bottom of the file

  3. Add the following:

    xml
    <user-code-namespaces enabled="true">
    </user-code-namespaces>

Complete the Configuration​

You can continue your configuration as follows: