I never thought I would need to do this, but I need to invoke
ColdFusion components from inside Java (and I will invoke the Java code
in ColdFusion).

I've written a simple test:

import coldfusion.cfc.CFCProxy;

public class UseCFCProxy {

        public String doSomething() throws Throwable {
                CFCProxy aCFC = new CFCProxy("\\\\path\\to\\Test.cfc");
                Object result = aCFC.invoke("aMethod", new Object[] { });
                return (String)result;
        }

}

and Test.cfc looks like this:
<cfcomponent>
        <cffunction name="aMethod">
                <cfreturn "Hello" />
        </cffunction>
</cfcomponent>

I try to use the Class like this:
<cftry>
        <cfset obj = CreateObject("java",
"com.renewtek.framework.UseCFCProxy").init() />
        <cfset obj.doSomething() />

        <cfcatch type="any">
                <cfdump var="#CFCATCH#" />
        </cfcatch>
</cftry>

and I always get a JRun Servlet Error. Checking the log files, I see a
rather long stack trace:
06/09 16:22:08 error coldfusion/cfc/CFCProxy
java.lang.NoClassDefFoundError: coldfusion/cfc/CFCProxy
        at com.renewtek.framework.UseCFCProxy.doSomething(UseCFCProxy.java:8)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at coldfusion.runtime.StructBean.invoke(StructBean.java:391)
        at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1662)
        at
cftest2ecfm386618807.runPage(\\medvwfs02\dev\Develop\sdajb001\scrap\test.cfm:3)
        at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
        at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
        at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
        at
coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:225)
        at
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
        at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
        at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
        at
coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52)
        at
coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
        at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
        at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
        at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
        at
coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
        at coldfusion.CfmServlet.service(CfmServlet.java:107)
        at
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
        at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
        at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
        at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
        at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
        at
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204)
        at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
        at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


Any ideas? Has anyone had success with this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to