0

When I run my program in Intellij, it throws this error on a console:

javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]

Now, from what I gathered, it's clearly this piece of code that I wrote here that causes this error:

Properties props = new Properties();

            props.put("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
            props.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
            props.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");

I am trying to understand more about this issue and how to resolve it.I've looked into this thread for example:

The meaning of NoInitialContextException error

Yet I couldn't find any JNDI properties file for me to set this configuration. What should I be looking at in this case?

Edit

My library import:

import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
halfer
  • 19,824
  • 17
  • 99
  • 186
Daredevil
  • 1,672
  • 3
  • 18
  • 47

0 Answers0