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

JavaCompiler does not find com.sun.xml.internal.stream.XMLOutputFactoryImpl

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6u24
    • tools
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_24"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]
      Microsoft Windows [Version 5.2.3790]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I have installed the jdk1.6.0_24 on both Windows systems: on XP the 32 Bit version on the Server the 64 Bit version.
      I have installed ant-1.8.2 on both systems.
      I have set JAVA_HOME pointing to C:\Program Files\Java\jdk1.6.0_24 on both systems.


      A DESCRIPTION OF THE PROBLEM :
      I have several Java projects that are compiled via an ant build script.
      When executed within Eclipse everything works fine.
      When executed on the command line javac is unable to find the class com.sun.xml.internal.stream.XMLOutputFactoryImpl and the package also.
      But this class is contained in rt.jar.

      Since my colleague did not have this issue with jdk1.6.0_17, I switched back to jdk1.6.0_23 and then the buildfile executes javac without error.

      REGRESSION. Last worked in version 6

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Install jdk1.6.0_24.
      Install ant1.8.2.
      Set JAVA_HOME to the jdk.
      Set ANT_HOME.
      Add ANT_HOME\bin to your PATH.

      Create one Java class that instantiates an Object of class XMLOutputFactory.

      Write a simple ant build file which runs javac to compile this Java class.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect the Java class to be compiled without Error.
      ACTUAL -
      The class is not compiled.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      build-project:
           [echo] XmlOutputFactoryTest build file: <yourPath>\XmlOutputFactoryTest\build.xml
          [javac] Compiling 1 source file to <yourPath>\XmlOutputFactoryTest\build.ant
          [javac] <yourPath>\XmlOutputFactoryTest\src\bug\ShowCompileBug.java:8: package com.sun.xml.internal.stream does not exist
          [javac] import com.sun.xml.internal.stream.XMLOutputFactoryImpl;
          [javac] ^
          [javac] <yourPath>\XmlOutputFactoryTest\src\bug\ShowCompileBug.java:16: cannot find symbol
          [javac] symbol : class XMLOutputFactoryImpl
          [javac] location: class bug.ShowCompileBug
          [javac] XMLOutputFactory factory = new XMLOutputFactoryImpl();
          [javac] ^
          [javac] 2 errors

      BUILD FAILED

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ==========================================================
      1.: Java class (ShowCompileBug.java)
      -----------------------------------------------------------------------------------------------------
      /**
       *
       */
      package bug;

      import javax.xml.stream.XMLOutputFactory;

      import com.sun.xml.internal.stream.XMLOutputFactoryImpl;

      /**
       *
       */
      public class ShowCompileBug {
      public void createXmlOutputFactory() {
      XMLOutputFactory factory = new XMLOutputFactoryImpl();
      factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.FALSE);
      System.out.println(factory.toString());
      }

      public static void main(String[] args) {
      new ShowCompileBug().createXmlOutputFactory();
      }
      }
      ==========================================================
      2. ant build file: (build.xml)
      -----------------------------------------------------------------------------------------------------
      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <project basedir="." default="jar" name="XmlOutputFactoryTest build file">

      <property name="distribution.dir" value="dist" />
      <property name="build.dir" value="build.ant" />
      <property name="debuglevel" value="source,lines,vars" />
      <property name="target" value="1.6" />
      <property name="source" value="1.6" />

      <target name="init" depends="clean">
      <mkdir dir="${build.dir}" />
      <copy includeemptydirs="false" todir="${build.dir}">
      <fileset dir="src" excludes="**/*.launch, **/*.java" />
      </copy>
      </target>

      <target name="clean">
      <delete dir="${build.dir}" />
      </target>

      <target depends="build-project" name="build" />

      <target depends="init" name="build-project">
      <echo message="${ant.project.name}: ${ant.file}" />
      <touch>
      <fileset dir="src" includes="**/package-info.java" />
      </touch>
      <javac includeantruntime="false" debug="true" debuglevel="${debuglevel}" destdir="${build.dir}" source="${source}" target="${target}">
      <src path="src" />
      <exclude name="**/.svn/**" />
      </javac>
      </target>

      <target name="jar" depends="build">
      <mkdir dir="${distribution.dir}" />

      <jar destfile="${distribution.dir}/XmlOutputFactoryTest.jar" basedir="${build.dir}" excludes="**/.svn/**">
      <manifest><attribute name="version" value="1.0"/></manifest>
      </jar>

      <delete dir="${build.dir}" />
      <antcall target="diag"></antcall>
      </target>

      <target name="diag">
      <echo message="sun.boot.class.path = ${sun.boot.class.path}"/>
      <echo message="sun.boot.library.path = ${sun.boot.library.path}"/>
      </target>

      </project>

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Switch back to jdk 1.6.0_23.

      OR

      manipulate build file:

      declare a path that reads the bootclasspath:

      <path id="bcp">
      <pathelement path="${sun.boot.class.path}"/>
      </path>

      and use it in the javac task:

      <javac bootclasspathref="bcp" includeantruntime="false" debug="true" debuglevel="${debuglevel}" destdir="${build.dir}" source="${source}" target="${target}">
      <src path="src" />
      <exclude name="**/.svn/**" />
      <classpath refid="UserManagementCore.classpath" />
      </javac>

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: