-
Bug
-
Resolution: Fixed
-
P3
-
9-repo-jigsaw
I tried to run the below test on jigsaw,
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
public class ModuleTest {
public static void main(String[] args) throws Exception {
String auth = "dns:/XYZ:53/domain1.com.";
DirContext ctx = new InitialDirContext();
Attributes attrs = ctx.getAttributes(auth, new String[] { "*" });
System.out.println(attrs);
}
}
but confronted the following error,
Exception in thread "main" javax.naming.NamingException: Cannot access com.sun.jndi.url.dns.dnsURLContextFactory [Root exception is java.lang.IllegalAccessException: Class com.sun.naming.internal.ResourceManager (module java.naming) can not access a member of class com.sun.jndi.url.dns.dnsURLContextFactory (module jdk.naming.dns) with modifiers "public", module jdk.naming.dns does not export com.sun.jndi.url.dns to module java.naming]
at com.sun.naming.internal.ResourceManager.getFactory(java.naming@9.0/ResourceManager.java:412)
at javax.naming.spi.NamingManager.getURLObject(java.naming@9.0/NamingManager.java:597)
at javax.naming.spi.NamingManager.getURLContext(java.naming@9.0/NamingManager.java:555)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(java.naming@9.0/InitialContext.java:337)
at javax.naming.directory.InitialDirContext.getURLOrDefaultInitDirCtx(java.naming@9.0/InitialDirContext.java:106)
at javax.naming.directory.InitialDirContext.getAttributes(java.naming@9.0/InitialDirContext.java:142)
at ModuleTest.main(ModuleTest.java:10)
Caused by: java.lang.IllegalAccessException: Class com.sun.naming.internal.ResourceManager (module java.naming) can not access a member of class com.sun.jndi.url.dns.dnsURLContextFactory (module jdk.naming.dns) with modifiers "public", module jdk.naming.dns does not export com.sun.jndi.url.dns to module java.naming
at sun.reflect.Reflection.throwIAE(java.base@9.0/Reflection.java:472)
at sun.reflect.Reflection.ensureMemberAccess(java.base@9.0/Reflection.java:128)
at java.lang.Class.newInstance(java.base@9.0/Class.java:520)
at com.sun.naming.internal.ResourceManager.getFactory(java.naming@9.0/ResourceManager.java:405)
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
public class ModuleTest {
public static void main(String[] args) throws Exception {
String auth = "dns:/XYZ:53/domain1.com.";
DirContext ctx = new InitialDirContext();
Attributes attrs = ctx.getAttributes(auth, new String[] { "*" });
System.out.println(attrs);
}
}
but confronted the following error,
Exception in thread "main" javax.naming.NamingException: Cannot access com.sun.jndi.url.dns.dnsURLContextFactory [Root exception is java.lang.IllegalAccessException: Class com.sun.naming.internal.ResourceManager (module java.naming) can not access a member of class com.sun.jndi.url.dns.dnsURLContextFactory (module jdk.naming.dns) with modifiers "public", module jdk.naming.dns does not export com.sun.jndi.url.dns to module java.naming]
at com.sun.naming.internal.ResourceManager.getFactory(java.naming@9.0/ResourceManager.java:412)
at javax.naming.spi.NamingManager.getURLObject(java.naming@9.0/NamingManager.java:597)
at javax.naming.spi.NamingManager.getURLContext(java.naming@9.0/NamingManager.java:555)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(java.naming@9.0/InitialContext.java:337)
at javax.naming.directory.InitialDirContext.getURLOrDefaultInitDirCtx(java.naming@9.0/InitialDirContext.java:106)
at javax.naming.directory.InitialDirContext.getAttributes(java.naming@9.0/InitialDirContext.java:142)
at ModuleTest.main(ModuleTest.java:10)
Caused by: java.lang.IllegalAccessException: Class com.sun.naming.internal.ResourceManager (module java.naming) can not access a member of class com.sun.jndi.url.dns.dnsURLContextFactory (module jdk.naming.dns) with modifiers "public", module jdk.naming.dns does not export com.sun.jndi.url.dns to module java.naming
at sun.reflect.Reflection.throwIAE(java.base@9.0/Reflection.java:472)
at sun.reflect.Reflection.ensureMemberAccess(java.base@9.0/Reflection.java:128)
at java.lang.Class.newInstance(java.base@9.0/Class.java:520)
at com.sun.naming.internal.ResourceManager.getFactory(java.naming@9.0/ResourceManager.java:405)