Tuesday, February 09, 2010    
Home My Books Blog ColdFusion About Me Back    

Calendar
<< Feb 2010 >>
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28            

Search

Categories
 • Acrobat (3) [RSS]
 • Adobe (88) [RSS]
 • AdobeMAX06 (45) [RSS]
 • AdobeMAX07 (59) [RSS]
 • AdobeMAX08 (66) [RSS]
 • AdobeMAX09 (39) [RSS]
 • AdobeMAX10 (1) [RSS]
 • AIR (215) [RSS]
 • Appearances (190) [RSS]
 • Books (72) [RSS]
 • CFEclipse (15) [RSS]
 • ColdFusion (1371) [RSS]
 • Data Services (33) [RSS]
 • Fish Tank (4) [RSS]
 • Flash (179) [RSS]
 • Flex (493) [RSS]
 • Home Automation (4) [RSS]
 • Jobs (116) [RSS]
 • JRun (14) [RSS]
 • Labs (43) [RSS]
 • LiveCycle (34) [RSS]
 • MAX (232) [RSS]
 • Mobile (109) [RSS]
 • Regular Expressions (17) [RSS]
 • RIA (19) [RSS]
 • SQL (40) [RSS]
 • Stuff (532) [RSS]
 • Tips (CF Studio) (80) [RSS]
 • Tips (CF) (795) [RSS]
 • Tips (Dreamweaver) (91) [RSS]
 • Tips (Flex Builder) (2) [RSS]
 • Using CF (161) [RSS]

Other BLOGs
 • Charlie Arehart
 • Lee Brimelow
 • Ray Camden
 • Christophe Coenraets
 • Sean Corfield
 • Mihai Corlan
 • Cornel Creanga
 • Mark Doherty
 • John Dowdell
 • Danny Dura
 • Enrique Duvos
 • Steven Erat
 • Kevin Hoyt
 • Serge Jespers
 • Adam Lehman
 • Duane Nickull
 • Miti Pricope
 • Andrew Shorten
 • Ryan Stewart
 • James Ward
 • Greg Wilson
 • Full As A Goog

RSS Feeds
 • Feed
 • Subscribe

Join my mailing list and find out about new books and other topics of interest.

Thoughts, ideas, tips, musings, and pontifications (not necessarily in that order) by Ben Forta ...
NOTE: This is my personal blog, and the opinions and statements voiced here are my own.

Viewing By Entry / Main
September 29, 2005

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.

TrackBacks
There are no trackbacks for this entry.

No trackback URL. Trackbacks are only allowed via interactive form.

Comments
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...

------------------------
test.cfm:
------------------------
<cfset invkJAVA = createObject("java","Coldfusion2").init()>
<cfset LvarArgs = structNew()>
<cfset LvarArgs.dato = "hello">
<cfset x = invkJAVA.jCFCinvoker('TestColdfusion','ping',LvarArgs)>
------------------------
Coldfusion2.java:
------------------------
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;
      try{
         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());
       e.printStackTrace();
      }
      return map;
   }
}
------------------------
TestColdfusion.cfc
------------------------
<cffunction name="ping" returntype="string" output="no">
   <cfargument name="dato" required="yes" type="string">
   <cfreturn dato>
</cffunction>
<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 = "">
   
   <cftry>
      <cfinvoke    component   ="#Arguments.cfc#"
               method      ="#Arguments.fn#"
               returnvariable="LvarRes"
      >
         <cfloop collection="#Arguments.args#" item="arg">
            <cfinvokeargument name="#arg#" value="#Arguments.args[arg]#">
         </cfloop>
      </cfinvoke>
      <cfif isdefined("LvarRes")>
         <cfset LvarResult.Result = LvarRes>
      </cfif>
   <cfcatch type="any">
      <cfset LvarResult.Error = cfcatch.Message & " " & cfcatch.Detail>
   </cfcatch>
   </cftry>
   <cfreturn LvarResult>
</cffunction>
-------------------------------------------
# Posted By Ozkar | 10/7/09 5:22 PM
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");

and

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.
# Posted By Charlie Arehart | 11/23/09 12:49 AM

  © Copyright 1997-2009 Ben Forta, All Rights Reserved