Using ColdFusion MX 7.0.1 CFCProxy

ColdFusion MX 7.0.1 includes a Java CFCProxy class which can be used to invoke ColdFusion Components from within Java code. Lots of developers are trying to find documentation on this class, and we will be posting this shortly. But in the interim, I have posted a copy on my site.

8 responses to “Using ColdFusion MX 7.0.1 CFCProxy”

  1. Gareth Avatar

    Is this an enterprise only feature?

  2. Michael Dinowitz Avatar
    Michael Dinowitz


  3. Mujeebur Rahmansaher Avatar
    Mujeebur Rahmansaher

    Thanks a Lot Ben! is a ideal place to get your answers.:)

  4. Michael Dinowitz Avatar
    Michael Dinowitz

    The docs say that the CF Classloader has to be the current classloader for any class making use of a CFCProxy. Does this mean that only java classes called by ColdFusion can use CFCProxy or that a non-ColdFusion app can use CFCProxy in some way?
    I’m sure that this is totally clear to a J2EE person, but the question of how to get a class to be part of the ColdFusion context without being inside ColdFusion is one that has to be asked.

  5. Sean Corfield Avatar
    Sean Corfield

    Java code running in the same J2EE Context as ColdFusion will bee able to use CFCProxy.

  6. George Bridgeman Avatar
    George Bridgeman

    The application scope does not seem to be accessible from a CFC created via CFCProxy.
    My methods work fine when I create the CFC from ColdFusion but as soon as I create it from Java using CFCProxy I get errors because variables don’t exist in the application scope.
    Is this intended behaviour?

  7. Ozkar Avatar

    CFCproxy in Coldfusion 9
    First I received this error:Caused by: java.lang.NoClassDefFoundError: coldfusion/cfc/CFCProxy, Caused by: java.lang.ClassNotFoundException: coldfusion.cfc.CFCProxy
    Now I received this error: instantiation exception.An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: coldfusion/cfc/CFCProxy…
    <cfset invkJAVA = createObject("java","Coldfusion2").init()>
    <cfset LvarArgs = structNew()>
    <cfset LvarArgs.dato = "hello">
    <cfset x = invkJAVA.jCFCinvoker(‘TestColdfusion’,’ping’,LvarArgs)>
    import coldfusion.cfc.CFCProxy;
    import java.util.Map;
    public class Coldfusion2
    public java.util.Map jCFCinvoker(String cfc, String fn, java.util.Map args)
    throws Throwable
    Map map = null;
    CFCProxy myCFC;
    myCFC = new CFCProxy ("C:\ColdFusion9\wwwroot\TestColdfusion.cfc");
    Object[] myArgs = {cfc, fn, args};
    map = (java.util.Map) myCFC.invoke("rmiCFCinvoker", myArgs);
    }catch (Throwable e){
    System.out.println("exception: " + e.getMessage());
    return map;
    <cffunction name="ping" returntype="string" output="no">
    <cfargument name="dato" required="yes" type="string">
    <cfreturn dato>
    <cffunction name="rmiCFCinvoker" returntype="any" output="no">
    <cfargument name="cfc" required="yes">
    <cfargument name="fn" required="yes">
    <cfargument name="args" required="yes" type="struct">
    <cfset LvarResult = structNew()>
    <cfset LvarResult.Error = "">
    <cfinvoke component ="#Arguments.cfc#"
    method ="#Arguments.fn#"
    <cfloop collection="#Arguments.args#" item="arg">
    <cfinvokeargument name="#arg#" value="#Arguments.args[arg]#">
    <cfif isdefined("LvarRes")>
    <cfset LvarResult.Result = LvarRes>
    <cfcatch type="any">
    <cfset LvarResult.Error = cfcatch.Message & " " & cfcatch.Detail>
    <cfreturn LvarResult>

  8. Charlie Arehart Avatar
    Charlie Arehart

    Ozkar, did you ever resolve your problem? I can report that both errors have the same underlying cause: if you comment out the lines:
    myCFC = new CFCProxy ("C:\ColdFusion9\wwwroot\TestColdfusion.cfc");
    map = (java.util.Map) myCFC.invoke("rmiCFCinvoker", myArgs);
    (and recompile Coldfusion2 and restart CF), you won’t get the errors when invoking the class from within CF, but of course the question it begs is why the CFCProxy is considered notfound. I’m experiencing the same thing in CF8 (so it’s not a CF9 thing). I can confirm (for those who would wonder) that I am on the Enterprise edition, not Standard. the CFCProxy is inside the cfusion.jar, which is already in the classpath for CF. Very curious.

Leave a Reply