Basically, here's the code (for ease of use, I have a folder called
"newtest" which contains INDEX.CFM, the iText-2.1.7.jar file, and the
JavaLoader 1.0 folder, then I make a call using cfscript to the
iText-2.1.7 rectangle object and use cfdump to view the output:
index.cfm:
===========================================
<!--- using cfcdynamicproxy --->
<!---<cfif not structKeyExists(server,"loader")>
<cfset paths = ArrayNew(1) />
<cfset paths[1] = expandPath("javaLoader/support/cfcdynamicproxy/lib/
cfcdynamicproxy.jar") />
<cfset paths[2] = expandPath("iText-2.1.7.jar") />
<cflock scope="Server" type="exclusive" timeout="10">
<cfif not structKeyExists(server,"loader")>
<cfset server.loader = CreateObject("component",
"javaloader.JavaLoader").init(loadPaths=paths,
loadColdFusionClassPath=false) />
</cfif>
</cflock>
</cfif> --->
<!--- using JavaLoader regularly --->
<cfif not structKeyExists(server,"loader")>
<cfset paths = ArrayNew(1) />
<cfset paths[1] = expandPath("iText-2.1.7.jar") />
<cflock scope="Server" type="exclusive" timeout="10">
<cfif not structKeyExists(server,"loader")>
<cfset server.loader = CreateObject("component",
"javaloader.JavaLoader").init( paths ) />
</cfif>
</cflock>
</cfif>
<cfscript>
rectangle = server.loader.create("com.lowagie.text.Rectangle");
</cfscript>
<cfdump var="#rectangle#"><cfabort>
================================
When I run the above file with first block of code using
"cfcdynamicproxy" and "Disable access to internal ColdFusion Java
components" checked, I get the following error:
Java method security exception.
A security exception occurred while invoking Java method on a
"java.lang.Class" object. MethodName is getClassLoader. Possible
cause: Either the createobject function and cfobject tag are disabled
in the security sandbox or you are trying to create a class in the
ColdFusion package and that is disabled.
The error occurred in C:\Inetpub\wwwroot\newtest\javaloader
\JavaLoader.cfc: line 40
38 : //can't use above, as doesn't work in some... things
39 :
40 : arguments.parentClassLoader =
getPageContext().getClass().getClassLoader();
41 :
42 : //arguments.parentClassLoader = createObject("java",
"java.lang.ClassLoader").getSystemClassLoader();
Stack Trace
at cfJavaLoader2ecfc2106460248$funcINIT.runFunction(C:\Inetpub\wwwroot
\newtest\javaloader\JavaLoader.cfc:40) at
cfindex2ecfm1019747591.runPage(C:\Inetpub\wwwroot\newtest\index.cfm:8)
coldfusion.runtime.StructBean$SecurityException: Java method security
exception.
at coldfusion.runtime.StructBean.checkPermission(StructBean.java:96)
at coldfusion.runtime.StructBean.invoke(StructBean.java:482)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2393)
at cfJavaLoader2ecfc2106460248$funcINIT.runFunction(C:\Inetpub\wwwroot
\newtest\javaloader\JavaLoader.cfc:40)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod
$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:517)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:496)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:355)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2301)
at cfindex2ecfm1019747591.runPage(C:\Inetpub\wwwroot\newtest
\index.cfm:8)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:
381)
at
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:
48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:
40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
When I use the SECOND block of code without "cfcdynamicproxy" and
"Disable access to internal ColdFusion Java components" checked, I get
the following error:
Permission denied for creating Java object:
coldfusion.runtime.java.JavaProxy.
Access to Java objects in the ColdFusion package has been disabled by
the administrator.
The error occurred in C:\Inetpub\wwwroot\newtest\javaloader
\JavaLoader.cfc: line 329
Called from C:\Inetpub\wwwroot\newtest\javaloader\JavaLoader.cfc: line
87
Called from C:\Inetpub\wwwroot\newtest\index.cfm: line 27
327 : <cfargument name="class" hint="the java class to create the
proxy with" type="any" required="Yes">
328 : <cfscript>
329 : return createObject("java",
"coldfusion.runtime.java.JavaProxy").init(arguments.class);
330 : </cfscript>
331 : </cffunction>
Stack Trace
at cfJavaLoader2ecfc2106460248$funcCREATEJAVAPROXY.runFunction(C:
\Inetpub\wwwroot\newtest\javaloader\JavaLoader.cfc:329) at
cfJavaLoader2ecfc2106460248$funcCREATE.runFunction(C:\Inetpub\wwwroot
\newtest\javaloader\JavaLoader.cfc:87) at
cfindex2ecfm1019747591.runPage(C:\Inetpub\wwwroot\newtest\index.cfm:
27)
coldfusion.runtime.java.JavaProxyFactory
$ColdFusionJavaNotAllowedException: Permission denied for creating
Java object: coldfusion.runtime.java.JavaProxy.
at
coldfusion.runtime.java.JavaProxyFactory.getProxy(JavaProxyFactory.java:
77)
at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65)
at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:5002)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4966)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4907)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4885)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4842)
at cfJavaLoader2ecfc2106460248$funcCREATEJAVAPROXY.runFunction(C:
\Inetpub\wwwroot\newtest\javaloader\JavaLoader.cfc:329)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod
$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582)
at cfJavaLoader2ecfc2106460248$funcCREATE.runFunction(C:\Inetpub
\wwwroot\newtest\javaloader\JavaLoader.cfc:87)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod
$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
at cfindex2ecfm1019747591.runPage(C:\Inetpub\wwwroot\newtest
\index.cfm:27)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:
381)
at
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:
48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:
40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
So, is it true then that with CF Version 9,0,1,274733 (fully hotfixed
and patched) running on Java JRE 1.6.0_23, that if
"Disable access to internal ColdFusion Java components" is checked,
there is no way to use the JavaLoader?
Thanks for all of your help!
Michael
On Jan 13, 5:30 pm, Mark Mandel <
mark.man...@gmail.com> wrote:
> I believe that's what I explained above? Let me know if I wasn't clear.
>
> To help rectify the issue, I need to see the code.
>
> On Fri, Jan 14, 2011 at 8:14 AM, webpointz <
webpoi...@gmail.com> wrote:
> > However, I was under the assumption that your JavaProxy.CFC was used
> > for this very situation??
> > Unfortunately, it seems that CF9 offers no granularity when it comes
> > to JAVA. Either it's on or it's off.
>
> Mark
>
> --
> E:
mark.man...@gmail.com