Supported Java Runtime Environment for Eclipse 3.8
- JRE 1.5 : OK- JRE 1.6 : OK
- JRE 1.7 : OK
- JRE 1.8 : OK
- JRE 1.9 [9-ea beta] : ?
Problems with JRE 1.9 and Eclipse RCP Application [Teamcenter]
Problem 1. Unable to login with JRE 1.9
| Fig 1. Console Log during launch the RCP Application with JRE 1.9 beta. |
Cause-
The exception is caused by the Java Platform Module System that was introduced in Java 9, particularly its implementation of strong encapsulation. It only allows access under certain conditions, the most prominent ones are:
the type has to be public
the owning package has to be exported
Solution-
Reflective Call Into JDK
The JDK modules are immutable for application developers so we can not change their properties. This leaves only one possible solution: command line flags. With them it is possible to open specific packages up for reflection.
So in a case like above (shortened)...
Unable to make java.lang.ClassLoader.defineClass accessible: module java.base does not "opens java.net" to unnamed module @1941a8ff
... the correct fix is to launch the JVM as follows:
# --add-opens has the following syntax: {A}/{package}={B}
java --add-opens java.base/java.net=ALL-UNNAMED
If the reflecting code is in a named module, ALL-UNNAMED can be replaced by its name.
Note that it can sometimes be hard to find a way to apply this flag to the JVM that will actually execute the reflecting code. This can be particularly tough if the code in question is part of the project's build process and is executed in a JVM that the build tool spawned.
If there are too many flags to be added, you might consider using the encapsulation kill switch --permit-illegal-access instead. It will allow all code on the class path to reflect over all named modules.
* In short pass the given argument during launch the application.
-vmargs --add-opens java.base/java.net=ALL-UNNAMED
OR
-vmargs --permit-illegal-access
I will recommend to pass --permit-illegal-access vm argument because in my application there are such many instances and i want to access non exported packages.
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-March/011763.html
http://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j
Pass following vm argument.
--add-modules=java.xml.bind
Or
--add-modules=java.se.ee
Unfortunately this is not working when we pass to rcp application. so i got another workaround from following bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=466690
-Dorg.osgi.framework.bundle.parent=app
--------------------------------------------------------------------------------------------------------------------------
- JRE 1.8 : OK
- JRE 1.9 [9-ea beta] : ?
Add Existing Installed JRE, has also problem even after the patch installation.
http://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j
Pass following vm argument.
--add-modules=java.xml.bind
Or
--add-modules=java.se.ee
Unfortunately this is not working when we pass to rcp application. so i got another workaround from following bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=466690
-Dorg.osgi.framework.bundle.parent=app
--------------------------------------------------------------------------------------------------------------------------
-JRE 1.8 : OK
-JRE 1.9 : Not Evaluated.
the type has to be public
the owning package has to be exported
Solution-
Reflective Call Into JDK
The JDK modules are immutable for application developers so we can not change their properties. This leaves only one possible solution: command line flags. With them it is possible to open specific packages up for reflection.
So in a case like above (shortened)...
Unable to make java.lang.ClassLoader.defineClass accessible: module java.base does not "opens java.net" to unnamed module @1941a8ff
... the correct fix is to launch the JVM as follows:
# --add-opens has the following syntax: {A}/{package}={B}
java --add-opens java.base/java.net=ALL-UNNAMED
If the reflecting code is in a named module, ALL-UNNAMED can be replaced by its name.
Note that it can sometimes be hard to find a way to apply this flag to the JVM that will actually execute the reflecting code. This can be particularly tough if the code in question is part of the project's build process and is executed in a JVM that the build tool spawned.
If there are too many flags to be added, you might consider using the encapsulation kill switch --permit-illegal-access instead. It will allow all code on the class path to reflect over all named modules.
* In short pass the given argument during launch the application.
-vmargs --add-opens java.base/java.net=ALL-UNNAMED
OR
-vmargs --permit-illegal-access
I will recommend to pass --permit-illegal-access vm argument because in my application there are such many instances and i want to access non exported packages.
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-March/011763.html
Note : This flags will only work with Java 9 [ --permit-illegal-access will not be available in java 10 ]
Problem 2. Bundles could not be resolved.
| Fig 2. After resolve the first error getting another error bundles could not be resolved. |
Cause-
Eclipse 3.8 has not provided capabilities for osgi.ee to support J2SE 9.
See existing bug to understand the issue. https://bugs.eclipse.org/bugs/show_bug.cgi?id=323964
See existing bug to understand the issue. https://bugs.eclipse.org/bugs/show_bug.cgi?id=323964
we need to add support manually by editing the osgi plugin.
Solution-
1) Modify the org.eclipse.osgi_3.8.0.v20120529-1548.jar plugin and add JavaSE-1.8.profile and JavaSE-9.profile file (copy from the eclipse 4.6) and also add this entries in profile.list
Problem 3. Java WebStart throws ClassNotFoundException During Login.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at testme.parts.TestJAXB.main(TestJAXB.java:9)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
at testme.parts.TestJAXB.main(TestJAXB.java:9)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
Cause/Solution-
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8152839http://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j
Pass following vm argument.
--add-modules=java.xml.bind
Or
--add-modules=java.se.ee
Unfortunately this is not working when we pass to rcp application. so i got another workaround from following bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=466690
-Dorg.osgi.framework.bundle.parent=app
--------------------------------------------------------------------------------------------------------------------------
Supported Java Runtime Environment for Eclipse 4.6
- JRE 1.8 : OK
- JRE 1.9 [9-ea beta] : ?
Problems with JRE 1.9 and Eclipse RCP Application [Teamcenter]
1. Bug 490577 JDK 9 b111 can't be added to installed JRE's
Workaround-
Install the feature patch directly from P2 update site.
http://download.eclipse.org/eclipse/updates/4.6-P-builds
| Fig 3. Download feature patch to support java 9. |
| Fig 4: Add installed JRE |
Workaround-
Remove the existing JRE system library and through add external JAR add all the jar from %JRE_HOME%/lib.
| Fig 5: Add the JRE System libraries through external Jar's from (JRE/lib) |
2. Error during start the application.
java.lang.ExceptionInInitializerError
at org.eclipse.osgi.storage.Storage.<init>(Storage.java:100)
at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:87)
at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:66)
at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:303)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:239)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @7fad8c79
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Method.setAccessible(Unknown Source)
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findMethod(FrameworkExtensionInstaller.java:51)
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findMethod(FrameworkExtensionInstaller.java:58)
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findAddURLMethod(FrameworkExtensionInstaller.java:42)
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.<clinit>(FrameworkExtensionInstaller.java:36)
... 14 more
Solution-
See first page (Problem 1. Unable to login with JRE 1.9)
-vmargs --add-opens java.base/java.net=ALL-UNNAMED
OR
-vmargs --permit-illegal-access
I will recommend to pass --permit-illegal-access vm argument because in my application there are such many instances and i want to access non exported packages.
3. Error during start the application [ https://bugs.eclipse.org/bugs/show_bug.cgi?id=493761]
!SESSION 2017-04-28 15:14:24.318 -----------------------------------------------
eclipse.buildId=unknown
java.version=9-ea
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product TestApp.product
Command-line arguments: -product TestApp.product -data F:\JRE9Test/../runtime-EclipseApplication -dev file:F:/JRE9Test/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog
!ENTRY org.eclipse.osgi 4 0 2017-04-28 15:14:25.585
!MESSAGE Application error
!STACK 1
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:386)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:294)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:490)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:504)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:203)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:148)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:151)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:375)
... 19 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.0.v20160319-0612
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:398)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:361)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:353)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 21 more
An error has occurred. See the log file
Sloution /WA-
Add following argument.
-vmargs --add-modules=java.se.ee
| Fig 6: Add vm argument to run the application with JRE 9 in Eclipse Neon. |
Note : This vm arguments will only work with Java 9
Problem 4. Java WebStart throws ClassNotFoundException During Login.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at testme.parts.TestJAXB.main(TestJAXB.java:9)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
at testme.parts.TestJAXB.main(TestJAXB.java:9)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
Cause/Solution-
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8152839http://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j
Pass following vm argument.
--add-modules=java.xml.bind
Or
--add-modules=java.se.ee
Unfortunately this is not working when we pass to rcp application. so i got another workaround from following bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=466690
-Dorg.osgi.framework.bundle.parent=app
--------------------------------------------------------------------------------------------------------------------------
Supported Java Runtime Environment for Eclipse 4.7 [M7]
-JRE 1.8 : OK
-JRE 1.9 : Not Evaluated.
No comments:
Post a Comment