I have a Java applet that provides a graphical interface for invoking a web service. It uses Jaxb to parse XML data and decouple it into objects. It works correctly from Java 1.5 to 1.8. With Java 9, not much.
I use the HTML container to run it in Internet Explorer 8 + JDK 9:
<applet code="com.blah.MyApplet" archive="myFatJarWithDependencies.jar" mayscript>
<param name="cache_option" value="no" />
</applet>
The applet loads fine and seems to work; however, as soon as I connect to the web service, it kind of stops working. I narrowed it down to this piece of code (where Foo is an automatically generated class with XML binding annotation):
System.out.println("1");
JAXBContext jc = JAXBContext.newInstance(Foo.class);
System.out.println("2");
The Java console shows 1and then ... nothing: it does not crash, the applet is still responding to mouse clicks, it does not throw any exceptions ... there seems to be no error at all. Except for the fact that it does nothing with the received data, and it never outputs 2. I tried alternative methods JAXBContext.newInstance(with the name of the package, with the name of the package plus the class loader), but they all do the same.
If I run a project from Eclipse Oxygen with the same JDK 9, it works. When I connect to the web service, it issues several warnings, including:
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector
(file:/C:/.../.m2/repository/com/sun/xml/bind/jaxb-impl/2.0/jaxb-impl-2.0.jar) to method
java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access
operations
( 2 ). , , Java. , JDK --illegal-access=deny, IE? "-deny-so-the-user-dont-have-a-clue-on-whats-happening"...
--illegal-access=permit JVM? (, JVM , <applet> html )a >
? , - ? (, , ):
Manifest-Version: 1.0
Build-Jdk: 1.8.0_144
Application-name: Blah
Permissions: all-permissions
Sealed: true
Name: blah/Blah.class
SHA-256-Digest: kpf244234234..ahjsdfksf=
...
Jaxb, :
- javax.xml.bind: jaxb-api: 2.0
- com.sun.xml.bind: jaxb-impl: 2.0
- com.sun.xml.bind: jaxb-xjc: 2.0
v2.0 v2.3.0, Java 9:
- javax.xml.bind: jaxb-api: 2.3.0
- com.sun.xml.bind: jaxb-impl: 2.3.0
- com.sun.xml.bind: jaxb-core: 2.3.0
- com.sun.xml.bind: jaxb-xjc: 2.3.0
. nullpointer, :
- javax.xml.bind: jaxb-api: 2.1
- javax.xml: jaxb-impl: 2.1
- jaxb-xjc, -, ...