How can I confirm that my JAR files are uploaded to Coldfusion? I'm on CF10.
I am currently getting this error:
Could not find the ColdFusion component or interface org.apache.batik.transcoder.image.PNGTranscoder.
My site structure is as follows:
/root /root/application.cfc /root/jar/batik-1.7/
In my application.cfc application, I have the following code:
<cfset This.javaSettings = {loadPaths: ["jar/"],loadColdFusionClassPath: true,reloadOnChange: true,watchInterval: 2}>
Here is my code in terms of invoking everything:
<cffunction name="getPng" access="public" output="true"> <cfsavecontent variable="out"> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve"> <path fill="##006838" stroke="##414042" stroke-miterlimit="10" d="M416.413,388.223c0,6.627-5.373,12-12,12H140.317 c-6.627,0-12-5.373-12-12V272.54c0-6.627,5.373-12,12-12h264.096c6.627,0,12,5.373,12,12V388.223z"/> <text id="HomeScore" transform="matrix(1 0 0 1 358.5391 361.333)" fill="##F1F2F2" font-family="'ArialMT'" font-size="24">3</text> <text id="Home" transform="matrix(1 0 0 1 155.3018 361.333)" fill="##F1F2F2" font-family="'ArialMT'" font-size="24">TEAM B</text> <text id="VisitorScore" transform="matrix(1 0 0 1 358.5391 301.8096)" fill="##F1F2F2" font-family="'ArialMT'" font-size="24">2</text> <text id="Visitor" transform="matrix(1 0 0 1 155.3018 301.8096)" fill="##F1F2F2" font-family="'ArialMT'" font-size="24">TEAM A</text> </svg> </cfsavecontent> <cfreturn out> </cffunction> <cffunction name="renderPng" access="public" output="false"> <cfscript> /*http://cfsearching.blogspot.ca/2008/02/cool-text-effects-with-svg-and-batik.html*/ pngPath = "test.png"; pngFile = expandPath(pngPath); transcoder = createObject("java", "org.apache.batik.transcoder.image.PNGTranscoder").init(); inputStream = createObject("java", "java.io.StringBufferInputStream").init(getPng()); input = createObject("java", "org.apache.batik.transcoder.TranscoderInput").init(inputStream); outputStream = createObject("java", "java.io.FileOutputStream").init(ExpandPath(pngFile)); output = createObject("java", "org.apache.batik.transcoder.TranscoderOutput").init(outputStream); transcoder.transcode(input, output); outputStream.close(); return pngFile; </cfscript> </cffunction> <cfscript> // CREATE OBJECT obj = createObject("component", "#request.cfcPath#.utils"); // CALL THE FUNCTION png = obj.renderPng(); </cfscript>
Update # 1
I checked the administrator and found Settings Summary , which lists CF Server Java Class Path . I added the location of the jar files and rebooted the server. Despite the fact that the path is present in the class path in the Administrator, I still get the same error.
Update 2
Added missing attribute "type" and will receive the following error:
java.lang.NoClassDefFoundError: org/apache/batik/dom/util/DocumentFactory
Line 554: transcoder = createObject("java", "org.apache.batik.transcoder.image.PNGTranscoder").init();
Full stack trace
java.lang.ClassNotFoundException: org.apache.batik.dom.util.DocumentFactory at coldfusion.bootstrap.BootstrapClassLoader.loadClass (BootstrapClassLoader.java:235) in java.lang.ClassLoader.loadClass (ClassLoader.javaava56) lang.Class.getDeclaredFields0 (native method) in java.lang.Class.privateGetDeclaredFields (class .java: 2317) in java.lang.Class.privateGetPublicFields (class .java: 2350) in java.lang.Class.getFields (Class. java: 1378) at coldfusion.runtime.java.ObjectHandler.Initialize (ObjectHandler.java:35) in coldfusion.runtime.java.ObjectHandler. (ObjectHandler.java:30) at coldfusion.runtime.java.ReflectionCache.get (ReflectionCache.java:38) at coldfusion.runtime.java.JavaProxy. (JavaProxy.java:35) at coldfusion.runtime.java.JavaProxyFactory.getProxy (JavaProxyFactory.java:117) at coldfusion.runtime.ProxyFactory.getProxy (ProxyFactory.java: 65) at coldfusion.runtime.CFPage.createObjectProxy (CFP. java: 5747) at coldfusion.runtime.CFPage.CreateObject (CFPage.java:5710) at coldfusion.runti me.CFPage.CreateObject (CFPage.javaโ644) at coldfusion.runtime.CFPage.CreateObject (CFPage.java:5619) at coldfusion.runtime.CFPage.CreateObject (CFPage.java:5566) at cfutils2ecfc521921384 $ funcRENDERPNG.runFunction (C: \ websites \ mgs_bootstrap \ basic \ cfc \ utils.cfc: 554) at coldfusion.runtime.UDFethod. java: 472) on coldfusion.filter.SilentFilter.invoke (SilentFilter.java:47) on coldfusion.runtime.UDFMethod $ ArgumentCollectionFilter.invoke (UDFMethod.javahaps68) on coldfusion.filter.FunctionAccessFilter.invoketer FunctionAccess ) on coldfusion.runtime.UDFMethod.runFilterChain (UDFMethod.java:321) on coldfusion.runtime.UDFMethod. invoke (UDFMethod.java:220) in coldfusion.runtime.TemplateProxy.invoke (TemplateProxy.java:655) in coldfusion.runtime.TemplateProxy.invoke (TemplateProxy.java:444) in coldfusion.runtime.TemplateProxy.invoke (TemplateProxy.java : 414) at coldfusion.runtime.CfJspPage._invoke (CfJspPage.java:2432) at cfsvgtest2ecfm1573707502.runPage (C: \ websites \ mgs_bootstrap \ sv gtest.cfm: 5) at coldfusion.runtime.CfJspage.jfjfage 244) at coldfusion.tagext.lang.IncludeTag.doStartTag (IncludeTag.javarige44) at coldfusion.runtime.CfJspPage._emptyTcfTag (CfJspPage.java: 2799) at cfapplication2ecfc733577694 $ funcONREQUEST.runFunctionfootfrunfunction mgrunfunction.runfunction mgrunfunction_files cfc: 87) at coldfusion.runtime.UDFMethod.invoke (UDFMethod.java:472) at coldfusion.runtime.UDFMethod $ ArgumentCollectionFilter.invoke (UDFMethod.java: 368) at coldfusion.filter.FunctionAccessFilter.avavoke Function ) at coldfusion.runtime.UDFMethod.runFilterChain (UDFMethod.java:321) at coldfusion.runtime.UDFMethod .invoke (UDFMethod.java:220) on coldfusion.runtime.TemplateProxy.invoke (TemplateProxy.java:655) on coldfusion.runtime.TemplateProxy.invoke (TemplateProxy.java:444) on coldfusion.runtime.TemplateProxy.invoke (TemplateProxy. java: 414) on coldfusion.runtime. AppEventInvoker.invoke (AppEventInvoker.java:108) at coldfusion.runtime.AppEventInvoker.onRequest (AppEventInvoker.javahaps) 00) at coldfusion.filter.ApplicationFilter.invoke (ApplicationFilter.java:418) on coldfusion.filtervreil (RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke (MonitoringFilter.java:40) with coldfusion. filter.PathFilter.invoke (PathFilter.java:112) at coldfusion.filter.LicenseFilter.invoke (LicenseFilter.java:30) at coldfusion.filter.ExceptionFilter.invoke (ExceptionFilter.java:94) at coldfusion.filter.BrowserDebugFilterinv (BrowserDebugFilter.java:79) on coldfusion.filter.ClientScopePersistenceFilter.invoke (ClientScopePersistenceFilter.java:28) on coldfusion.filter.BrowserFilter.invoke (BrowserFilter.java:38) on coldfusion.filter.NoCache 46) at coldfusion.filter.GlobalsFilter.invoke (GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke (DatasourceFilter.java:22) with coldfusion.filter.CachingFilter.invoke (CachingFilter.java:62) with coldfusion. CfmServlet.service (CfmServlet.java:204) on coldfusion.bootstrap.BootstrapServlet.service (BootstrapServlet.java:89) in org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:305.al org .core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210) in coldfusion.monitor.event.MonitoringServletFilter.doFilter (MonitoringServletFilter.java:42) on coldfusion.bootstrap.BootstrapFilter.doFilter (BootstavaForgter.ap. catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.vvevevvveve 224) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:472) at org.apache.catalina.corealStandard .invok e (StandardHostValve.java: 168) on org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:98) on org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:928) on org.apache .catalina.core. StandardEngineValve.invoke (StandardEngineValve.java:118) in org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:414) on org.apache.coyote.ajp.AjpProcessor.process (AjpProcessor.java:203) in org .apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process (AbstractProtocol.javaโ39) at org.apache.tomcat.ut il.net.JIoEndpoint $ SocketProcessor.run (JIoEndpoint.java:298) in java.util.concurrent.ThreadPoolExecutor. runWorker (ThreadPoolExecutor.java:1145) in java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java: 615) in java.lang.Thread.run (Thread.java:722)
Update 3
I have this in my application.cfc application
<cfset This.javaSettings = {loadPaths: ["jar/"],loadColdFusionClassPath: false,reloadOnChange: true,watchInterval: 2}>
I called onApplicationStart() and still get the same error.
At this point, I deleted my entry in the ColdFusion class path and will now return to the empty default value.
I want it to upload jar files using the javaSettings variable, since I am on a shared hosting.