title: FOP/ikvm: error "Provider com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl not found"
body: <p>I have produced a fop.dll from fop-1.0 with ikvm:<br></p>
  
  <pre>ikvmc -target:library -reference:IKVM.OpenJDK.Core.dll -recurse:{myPathToJars}\*.jar -version:1.0 -out:{myPathToJars}\fop.dll</pre>
  
  <p><br>
  If I use my fop.dll in a Windows Application, everything works perfect.<br>
  If I use it in a Class Library, I get the following error:<br></p>
  
  <pre>"Provider com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl not found" at javax.xml.transform.TransformerFactory.newInstance()</pre>
  
  <p>The code line is: <pre>TransformerFactory factory = TransformerFactory.newInstance();</pre>
  Here is the code of method:</p>
  
  <pre>        public static void xmlToPDF(String xmlPath, String xslPath, SortedList arguments, String destPdfPath)
          {
              java.io.File xmlfile = new java.io.File(xmlPath);
              java.io.File pdffile = new java.io.File(destPdfPath);
              try
              {
                  // configure fopFactory as desired
                  FopFactory fopFactory = FopFactory.newInstance();
  
                  FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
                  // configure foUserAgent as desired
  
                  // Setup output
                  OutputStream outputStream = new java.io.FileOutputStream(pdffile);
                  outputStream = new java.io.BufferedOutputStream(outputStream);
  
                  try
                  {
                      // Construct fop with desired output format
                      Fop fop = fopFactory.newFop("application/pdf" /*MimeConstants.MIME_PDF*/, foUserAgent, outputStream);
  
                      // Setup XSLT
                      TransformerFactory factory = TransformerFactory.newInstance();
  
                      java.io.File xsltfile = new java.io.File(xslPath);
                      Transformer transformer = factory.newTransformer(new StreamSource(xsltfile.getAbsoluteFile()));
  
                      // Set the value of a  in the stylesheet
                      if (arguments != null)
                      {
                          IList keys = arguments.GetKeyList();
                          foreach (var key in keys)
                          {
                              Object value = arguments[key];
                              transformer.setParameter(key.ToString(), value);
                          }
  
                      }
  
                      // Setup input for XSLT transformation
                      Source src = new StreamSource(xmlfile);
  
                      // Resulting SAX events (the generated FO) must be piped through to FOP
                      Result res = new SAXResult(fop.getDefaultHandler());
  
                      // Start XSLT transformation and FOP processing
                      transformer.transform(src, res);
                  }
                  catch (Exception e1)
                  {
                      System.Console.WriteLine(e1.Message);
                  }
                  finally
                  {
                      outputStream.close();
                  }
  
              }
              catch (Exception ex)
              {
                  System.Console.WriteLine(ex.Message);
              }
          }
  </pre>
  
  <p>I used ikvm-0.46.0.1 to make my fop.dll (based on fop 1.0). I included the following jars:<br></p>
  
  <pre>
  avalon-framework-4.2.0.jar
  batik-all-1.7.jar
  commons-io-1.3.1.jar
  commons-logging-1.0.4.jar
  fop.jar
  serializer-2.7.0.jar
  xalan-2.7.0.jar
  xercesImpl-2.7.1.jar
  xml-apis-1.3.04.jar
  xml-apis-ext-1.3.04.jar
  xmlgraphics-commons-1.4.jar
  </pre>
  
  <p>Any idea why this error occurs? Why is the behaviour different between Windows Application and Class Library?<br>
  <br>
  <strong>Addition 10/19/11:</strong><br>
  I managed to get working the following:<br></p>
  
  <ul>
  <li>MyMainPrg (a Windows Forms Application)</li>
  <li>MyFopWrapper (a Class Library that calls fop.dll)</li>
  </ul>
  
  <p>But for my case this is not the solution, because in my target project, I have the following structure:<br></p>
  
  <ul>
  <li>MainCmdLinePrg  (a Console Application; calls DLL_1)</li>
  <li>DLL_1     (calls DLLsharedFop)  {there are several DLLs that can call DLLsharedFop}</li>
  <li>DLLsharedFop   (calls directly fop.dll; or - I don't care - might call MyFopWrapper)</li>
  </ul>
  
  <p>Unfortunately this construct results in the error.<br>
  You can shorten to a pair (ACmdLinePrg,MyFopWrapper): already this does not work! But (MyMainPrg,MyFopWrapper) does...</p>