Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8177705

Java WebStart throws ClassNotFoundException when attempting to link to JAXB type

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+161)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+161, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Professional Edition 64 bit

      A DESCRIPTION OF THE PROBLEM :
      When launching my application with javaws I got the exception:

      java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
      at cin.confirma.applet.managers.EnvironmentManager.getTokenEnvironment(EnvironmentManager.java:126)
      at cin.confirma.jws.configuration.Initializer.initializeApplication(Initializer.java:150)
      at cin.confirma.jws.SignerJWS.main(SignerJWS.java:48)
      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 jdk.javaws@9-ea/com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.run(Unknown Source)
      at java.base/java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBContext
      at jdk.deploy@9-ea/com.sun.deploy.security.DeployURLClassLoader.findClass(Unknown Source)
      at jdk.javaws@9-ea/com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
      at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      at jdk.javaws@9-ea/com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
      at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      ... 12 more
      mar 24, 2017 11:17:45 AM cin.confirma.jws.configuration.Initializer initializationError
      GRAVE: javax/xml/bind/JAXBContext
      java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
      at cin.confirma.applet.managers.EnvironmentManager.getTokenEnvironment(EnvironmentManager.java:126)
      at cin.confirma.jws.configuration.Initializer.initializeApplication(Initializer.java:150)
      at cin.confirma.jws.SignerJWS.main(SignerJWS.java:48)
      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 jdk.javaws@9-ea/com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
      at jdk.javaws@9-ea/com.sun.javaws.Launcher.run(Unknown Source)
      at java.base/java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBContext
      at jdk.deploy@9-ea/com.sun.deploy.security.DeployURLClassLoader.findClass(Unknown Source)
      at jdk.javaws@9-ea/com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
      at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      at jdk.javaws@9-ea/com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
      at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
      ... 12 more

      I have added in jnlp file:
      ...
      <j2se version="1.6+" java-vm-args="--add-modules java.xml.bind"/>
      ...

      but still not working, while similar code launched with java and same arg doesn't result in any Issue

      I found an old Bug indicating a very similar problem:

      http://bugs.java.com/view_bug.do?bug_id=8152839

      Could it be a Regression case?

      Thanks for yout attention


      REGRESSION. Last worked in version 8u121

      ADDITIONAL REGRESSION INFORMATION:
      I didn't check in other early access versions for java 9

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Should start as webstart code like this:

      import javax.xml.bind.JAXBContext;
      import javax.xml.bind.JAXBException;

      public class Test {
              public static void main(String[] args) {
                      try {
      JAXBContext.newInstance("NotExistent.class");
      } catch (JAXBException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }
              }
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      javax.xml.bind.JAXBException: "NotExistent.class" non contiene ObjectFactory.class o jaxb.index
              at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
              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 java.xml.bind@9-ea/javax.xml.bind.ContextFinder.newInstance(Unknown Source)
              at java.xml.bind@9-ea/javax.xml.bind.ContextFinder.newInstance(Unknown Source)
              at java.xml.bind@9-ea/javax.xml.bind.ContextFinder.find(Unknown Source)
              at java.xml.bind@9-ea/javax.xml.bind.JAXBContext.newInstance(Unknown Source)
              at java.xml.bind@9-ea/javax.xml.bind.JAXBContext.newInstance(Unknown Source)
              at java.xml.bind@9-ea/javax.xml.bind.JAXBContext.newInstance(Unknown Source)
              at it.test.Test.main(Test.java:8)
      ACTUAL -
      java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.xml.bind.JAXBContext;
      import javax.xml.bind.JAXBException;

      public class Test {
              public static void main(String[] args) {
                      try {
      JAXBContext.newInstance("NotExistent.class");
      } catch (JAXBException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }
              }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pardesha Pardeep Sharma
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: