title: CFCServlet must be initialized
body: <p>I have been trying to call a ColdFusion component from Java and following:</p>
  
  <p><a href="http://www.forta.com/misc/cfcproxy.htm" rel="nofollow noreferrer">http://www.forta.com/misc/cfcproxy.htm</a></p>
  
  <p><a href="https://helpx.adobe.com/coldfusion/developing-applications/using-web-elements-and-external-objects/integrating-jee-and-java-elements-in-cfml-applications/enhanced-java-integration-in-coldfusion.html" rel="nofollow noreferrer">https://helpx.adobe.com/coldfusion/developing-applications/using-web-elements-and-external-objects/integrating-jee-and-java-elements-in-cfml-applications/enhanced-java-integration-in-coldfusion.html</a></p>
  
  <p>Java version: <strong>1.8.0_141</strong></p>
  
  <p>I have added the required following jars in build path:</p>
  
  <pre><code>cfmx_bootstrap.jar
  cfusion.jar
  javax.servlet.jsp.jar
  javax.servlet-api-3.0.1.jar ( Servlet jars added as on running java program it was throwing ClassNotFound errors )
  </code></pre>
  
  <p>After this added <strong>Test.java</strong>:</p>
  
  <pre><code>import coldfusion.cfc.CFCProxy;
  
  public class Test {
  
      public static void main(String args[]) throws ClassNotFoundException {
          Test test = new Test();
          System.out.println(test.invoke().toString());
      }
  
      public String invoke() {
          String cfOp = null;
          try {
  
              // Instantiate CFC
              CFCProxy myCFC = new CFCProxy("D:\\practice\\cf_java.cfc", true);
  
              // Build arguments array
              Object[] myArgs = { "Java invocation!" };
  
              // invoke method from CFC. It returns a string.
              cfOp = (String) myCFC.invoke("getData", myArgs);
  
          } catch (Throwable ex) {
              ex.printStackTrace();
          }
  
          return cfOp;
      }
  }
  </code></pre>
  
  <p>Then added <strong>Test.class</strong> under <strong>/JavaClass/</strong></p>
  
  <p><strong>Application.cfc:</strong></p>
  
  <pre><code>&lt;cfcomponent&gt;
      &lt;cfset THIS.name = "CFTest"&gt;
      &lt;cfset THIS.javaSettings = {
           LoadPaths = ["\JavaClass\"],
           reloadOnChange=true,
           watchInterval=10,
           reloadOnChange = true
      }&gt;
  &lt;/cfcomponent&gt;
  </code></pre>
  
  <p><strong>cf_java.cfc:</strong></p>
  
  <pre><code>&lt;cfcomponent&gt;
      &lt;cffunction name="getData" returntype="string"&gt;
          &lt;cfargument name="msg" required="Yes"&gt;
          &lt;cfreturn "I am alive!"&gt;
       &lt;/cffunction&gt; 
  &lt;/cfcomponent&gt;
  </code></pre>
  
  <p>And finally ran Test.java as a java application and I am getting following:</p>
  
  <pre><code>java.lang.RuntimeException: CFCServlet must be initialized
      at coldfusion.cfc.CFCProxy.&lt;init&gt;(CFCProxy.java:121)
      at coldfusion.cfc.CFCProxy.&lt;init&gt;(CFCProxy.java:73)
      at Test.invoke(Test.java:15)
      at Test.main(Test.java:7)
  Exception in thread "main" java.lang.NullPointerException
      at Test.main(Test.java:7)
  </code></pre>
  
  <p>Did I miss anything? Any suggestions!</p>
  
  <p>Also, from the Adobe Docs:</p>
  
  <blockquote>
    <p>To call CFC, ColdFusion class loader must be the current class loader.</p>
  </blockquote>
  
  <p>Can anyone please explain this or share some links?</p>