Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java upgrading from 11 to JDk 17.0.8 version for NetBeans 15 Ant project -factory already defined error at java.base/java.net.URL #4

Open
AbdulAmeer55 opened this issue Aug 23, 2023 · 0 comments

Comments

@AbdulAmeer55
Copy link

Introduction
I've come across an unexpected error caused by calling

Java Version Found..17.0.8 java.lang.Error: factory already defined at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1228)

in an Netbeans Ant application that is being updated to Netbeans 15 and jdk 17 from netbeans 12 and jdk11 version.

System information

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

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)

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 Jakarta and maven version as per compatibility of jdk 17. updated NetBeans modules as per NetBeans 15 supports.

Could you please help me to resolve this issue.

Thanks & Regards,
Abdul Ameer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant