title: Apache POI 3.10 Final XWPFDocument.setParagraph()
body: <p>I am viewing the Apache POI docs, both the ones that came with my download, and the ones on the live site. There should be a <code>setParagraph()</code> method in the <code>org.apache.poi.xwpf.usermodel.XWPFDocument</code> class. I am consuming this class in ColdFusion, and am unable to access many of the methods listed in the docs.</p>
  
  <p>Is this due to consuming the class or possibly class dependencies improperly? Or is this due to Apache POI .jars being updated and no longer supporting the <code>setParagraph()</code> method?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I am using ColdFusion 9 and am loading the classes using JavaLoader.cfc. Here is the code I use to instantiate the classes I require for my manipulations.</p>
  
  <pre><code>&lt;cfset javaLoader = server[application.myJavaLoaderKey]&gt;
  &lt;cfset OPCPackage = javaLoader.create("org.apache.poi.openxml4j.opc.OPCPackage")&gt;
  &lt;cfset dot_template_opc = OPCPackage.open("pathToDocxFileInstantiated")&gt;
  &lt;cfset XWPFDocument = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFDocument")&gt;
  &lt;cfset dot_template = XWPFDocument.init(dot_template_opc)&gt;
  &lt;cfset XWPFParagraph = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFParagraph")&gt;
  &lt;cfset XWPFTable = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFTable")&gt;
  &lt;cfset XWPFRun = javaLoader.create("org.apache.poi.xwpf.usermodel.XWPFRun")&gt;
  &lt;cfset CTP = javaLoader.create("org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP")&gt;
  &lt;cfset CTRImpl = javaLoader.create("org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTRImpl")&gt;
  &lt;cfset CTText = javaLoader.create("org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText")&gt;
  &lt;cfset dot_output = "pathToNewDocxFile"&gt;&lt;!--- Edited version of original ---&gt;
  &lt;cfset outputObject_dot = CreateObject("java","java.io.FiltOutputStream",
          "java",
          "java.io.FileOutputStream"
          ).Init(
              CreateObject(
                  "java",
                  "java.io.File"
                  ).Init(
                      dot_output
                  )&gt;
  </code></pre>
  
  <p>Here is the relevant code from Application.cfc pertaining to JavaLoader.cfc. It is being held within the onApplicationStart() method.</p>
  
  <pre><code>&lt;cfset var myJavaLoaderKey = "ABCDEF-01234567-9876543210-ABCDEF54321_javaloader"&gt;
  &lt;cfset var jarPaths = arrayNew(1)&gt;
  
  &lt;!--- if the javaLoader was not created yet ---&gt;
  &lt;cfif NOT structKeyExists(server, myJavaLoaderKey)&gt;
  
  &lt;!--- these are absolute paths to the POI jar files ---&gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/poi-3.10-FINAL-20140208.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/poi-examples-3.10-FINAL-20140208.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/poi-excelant-3.10-FINAL-20140208.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/poi-ooxml-3.10-FINAL-20140208.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/poi-ooxml-schemas-3.10-FINAL-20140208.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/poi-scratchpad-3.10-FINAL-20140208.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/lib/commons-codec-1.5.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/lib/commons-logging-1.1.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/lib/junit-4.11.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/lib/log4j-1.2.13.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/ooxml-lib/dom4j-1.6.1.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/ooxml-lib/stax-api-1.0.1.jar")) &gt;
  &lt;cfset arrayAppend( jarPaths, expandPath("../wwwroot/poi/ooxml-lib/xmlbeans-2.3.0.jar")) &gt;
  &lt;cfif NOT structKeyExists(server, myJavaLoaderKey)&gt;
     &lt;cflock name="#Hash(myJavaLoaderKey)#" type="exclusive" timeout="10"&gt;
         &lt;!---  create an instance of the JavaLoader and store it in the server scope ---&gt;
         &lt;cfset server[myJavaLoaderKey] = createObject("component", "javaloader.JavaLoader").init(loatPaths=jarPaths,loadColdFusionClassPath=true)&gt;
     &lt;/cflock&gt;
  &lt;/cfif&gt;
  &lt;cfset application.myJavaLoaderKey = myJavaLoaderKey&gt;
  &lt;/cfif&gt;
  
  &lt;cfscript&gt;
  _Thread = createObject("java", "java.lang.Thread");
  currentClassloader = _Thread.currentThread().getContextClassLoader();
  try { // Set the current thread's context class loader as Javaloader's classloader, so dom4j doesn't die _Thread.currentThread().setContextClassLoader(server[var.JLKey].getURLClassLoader());
  }
  catch(Any exc) {
      rethrow;
  }
  finally { // We have to reset the classloader, due to thread pooling.
      _Thread.currentThread().setContextClassLoader(currentClassloader);
  }
  &lt;/cfscript&gt;
  </code></pre>
  
  <p>All this being said, I have NOT deleted the original .jars packaged with CF. I recently attempted to and was unable to, I'm sure I can if I try a little harder of course but, feel this should not be necessary.</p>
  
  <p>I AM making a call to CreateObject to instantiate java.io.File and java.io.FileOutputStream. Does this somehow revert the instantiation of my XWPFDocument to CF's default class?</p>