Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Java upgrading from 1.8 to JDk 17.0.8 version for netbeans 15 ant project -factory already defined at java.base/java.net.URL

Introuduction


I've come across an unexpected error caused by calling URL.setURLStreamHandlerFactory(factory); in an Netbeans ant application that is being updated to netbeans 15 and jdk 17 from netbeans 1.8 to jdk 1.8 version.

Warning:


run.run:
Aug 22, 2023 10:57:02 PM org.netbeans.ProxyURLStreamHandlerFactory register
SEVERE: No way to find original stream handler for jar protocol
java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.net.URLStreamHandler java.net.URL.handler accessible: module java.base does not "opens java.net" to unnamed module @27973e9b
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at org.netbeans.ProxyURLStreamHandlerFactory.register(ProxyURLStreamHandlerFactory.java:59)
at org.netbeans.JarClassLoader.<clinit>(JarClassLoader.java:117)
at org.netbeans.MainImpl.execute(MainImpl.java:153)
at org.netbeans.MainImpl.main(MainImpl.java:60)
at org.netbeans.Main.main(Main.java:58)

System information:


System Info:
Operating System = Windows Server 2019 version 10.0 running on amd64
Java; VM; Vendor = 17.0.8; Java HotSpot(TM) 64-Bit Server VM 17.0.8+9-LTS-211; Oracle Corporation
Runtime = Java(TM) SE Runtime Environment 17.0.8+9-LTS-211
Java Home = C:\Program Files\Java\jdk-17
System Locale; Encoding = en_US (asgraphicruleside); Cp1252
Boot & Ext. Classpath =
Application Classpath = C:\Program Files\NetBeans-15\netbeans\platform\lib\boot.jar;C:\Program Files\NetBeans-15\netbeans\platform\lib\org-openide-modules.jar;C:\Program Files\NetBeans-15\netbeans\platform\lib\org-openide-util-lookup.jar;C:\Program Files\NetBeans-15\netbeans\platform\lib\org-openide-util-ui.jar;C:\Program Files\NetBeans-15\netbeans\platform\lib\org-openide-util.jar
Startup Classpath = C:\Program Files\NetBeans-15\netbeans\platform\core\asm-9.3.jar;C:\Program Files\NetBeans-15\netbeans\platform\core\asm-commons-9.3.jar;C:\Program Files\NetBeans-15\netbeans\platform\core\asm-tree-9.3.jar;C:\Program Files\NetBeans-15\netbeans\platform\core\core-base.jar;C:\Program Files\NetBeans-15\netbeans\platform\core\core.jar;C:\Program Files\NetBeans-15\netbeans\platform\core\org-netbeans-libs-asm.jar;C:\Program Files\NetBeans-15\netbeans\platform\core\org-openide-filesystems-compat8.jar;C:\Program Files\NetBeans-15\netbeans\platform\core\org-openide-filesystems.jar;D:\JAVA_17\build\cluster\core\locale\core_asgraphicruleside.jar

Error Logs:


Java Version Found..17.0.8
java.lang.Error: factory already defined
at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1228)
at org.eclipse.osgi.framework.internal.core.Framework.installURLStreamHandlerFactory(Framework.java:1765)
at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:232)
at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.internalInit(EquinoxLauncher.java:67)
at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.init(EquinoxLauncher.java:37)
at org.eclipse.osgi.launch.Equinox.init(Equinox.java:178)
at org.netbeans.modules.netbinox.Netbinox.init(Netbinox.java:63)
at org.netbeans.core.netigso.Netigso.prepare(Netigso.java:146)
at org.netbeans.NetigsoHandle.turnOn(NetigsoHandle.java:115)
at org.netbeans.ModuleManager.enable(ModuleManager.java:1445)
at org.netbeans.ModuleManager.enable(ModuleManager.java:1254)
at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:316)
at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:252)
at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:298)
at org.netbeans.core.startup.Main.getModuleSystem(Main.java:173)
at org.netbeans.core.startup.Main.getModuleSystem(Main.java:142)
at org.netbeans.core.startup.Main.start(Main.java:299)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
at java.base/java.lang.Thread.run(Thread.java:833)
WARNING [org.netbeans.core.modules]: Use of OpenIDE-Module-Class: Loader in com.adminserver.asgraphicrulesidemodule is obsolete.

I tried below options as per forms : updated class paths with arguments " --add-opens=java.base/java.lang=ALL-UNNAMED

--add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"

Updated spring and jakartha and maven version as per campatibility of jdk 17. updated netbeans modules as per netbeans 15 supports.

Kindly help me resolve this issue.

Thanks & Regads,

Abdul

Comments
Post Details
Added on Aug 23 2023
0 comments
346 views