Created
August 25, 2013 12:16
-
-
Save existdissolve/6333559 to your computer and use it in GitHub Desktop.
SVG to PNG using Batik 1.7: http://xmlgraphics.apache.org/batik/ As written, this works fine when the batik-* jars are added to the ColdFusion class path, but fails when used via JavaLoader. Tried adding the rest of the jars from Batik 1.7 /lib, but doesn't change the outcome.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coldfusion.runtime.java.JavaObjectInstantiationException: Object instantiation exception. | |
at coldfusion.runtime.java.JavaProxyFactory.getProxy(JavaProxyFactory.java:170) | |
at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65) | |
at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:5747) | |
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5710) | |
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5644) | |
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5619) | |
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5566) | |
at cfGeneral2ecfc646371968$funcINDEX.runFunction(/Applications/MAMP/htdocs/gloss_2.0/handlers/General.cfc:32) | |
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) | |
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:518) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:660) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:469) | |
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2373) | |
at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:402) | |
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2800) | |
at cfController2ecfc1145999322$funcINVOKER.runFunction(/Applications/MAMP/htdocs/coldbox_3.7.0/coldbox/system/web/Controller.cfc:756) | |
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:2659) | |
at cfController2ecfc1145999322$funcRUNEVENT.runFunction(/Applications/MAMP/htdocs/coldbox_3.7.0/coldbox/system/web/Controller.cfc:640) | |
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:518) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:660) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:469) | |
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2373) | |
at cfColdbox2ecfc365152025$funcPROCESSCOLDBOXREQUEST.runFunction(/Applications/MAMP/htdocs/coldbox_3.7.0/coldbox/system/Coldbox.cfc:236) | |
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) | |
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:655) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414) | |
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432) | |
at cfApplication2ecfc1740922731$funcONREQUESTSTART.runFunction(/Applications/MAMP/htdocs/gloss_2.0/Application.cfc:82) | |
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) | |
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:655) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444) | |
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414) | |
at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:108) | |
at coldfusion.runtime.AppEventInvoker.onRequestStart(AppEventInvoker.java:278) | |
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:411) | |
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) | |
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) | |
at 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.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) | |
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) | |
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) | |
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) | |
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) | |
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) | |
at coldfusion.CfmServlet.service(CfmServlet.java:204) | |
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) | |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) | |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) | |
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) | |
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) | |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) | |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) | |
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: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.core.StandardHostValve.invoke(StandardHostValve.java:168) | |
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) | |
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928) | |
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) | |
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414) | |
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:203) | |
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539) | |
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) | |
at java.lang.Thread.run(Thread.java:680) | |
Caused by: java.lang.NoClassDefFoundError: org/apache/batik/dom/util/DocumentFactory | |
at java.lang.Class.getDeclaredFields0(Native Method) | |
at java.lang.Class.privateGetDeclaredFields(Class.java:2300) | |
at java.lang.Class.privateGetPublicFields(Class.java:2333) | |
at java.lang.Class.getFields(Class.java:1361) | |
at coldfusion.runtime.java.ObjectHandler.Initialize(ObjectHandler.java:35) | |
at 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:121) | |
... 95 more | |
Caused by: java.lang.ClassNotFoundException: org.apache.batik.dom.util.DocumentFactory | |
at coldfusion.bootstrap.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:235) | |
at java.lang.ClassLoader.loadClass(ClassLoader.java:247) | |
... 104 more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var response = getPageContext().getFusionContext().getResponse(); | |
response.setContentType( 'image/png' ); | |
var content = fileread( expandPath( "./handlers/test.svg" ) ); | |
var inputStream = createObject("java", "java.io.StringBufferInputStream").init( content ); | |
var input = createObject( "java", "org.apache.batik.transcoder.TranscoderInput").init(inputStream); | |
var outputStream = response.getOutputStream();; | |
var output = createObject( "java", "org.apache.batik.transcoder.TranscoderOutput").init(outputStream); | |
var transcoder = createObject( "java", "org.apache.batik.transcoder.image.PNGTranscoder" ).init(); | |
transcoder.transcode(input, output); | |
outputStream.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" standalone="yes"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="480px" height="205px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><defs><linearGradient x1="0" y1="0" x2="6.123031769111886e-17" y2="1" id="gradientGreen"><stop offset="0%" stop-color="#94ae0a" stop-opacity="1"></stop><stop offset="100%" stop-color="#6b7e07" stop-opacity="1"></stop></linearGradient><linearGradient x1="0" y1="0" x2="6.123031769111886e-17" y2="1" id="gradientYellow"><stop offset="0%" stop-color="#9D8D00" stop-opacity="1"></stop><stop offset="100%" stop-color="#FFFF00" stop-opacity="1"></stop></linearGradient><linearGradient x1="0" y1="0" x2="6.123031769111886e-17" y2="1" id="gradientRed"><stop offset="0%" stop-color="#a61120" stop-opacity="1"></stop><stop offset="100%" stop-color="#780c17" stop-opacity="1"></stop></linearGradient></defs><rect width="100%" height="100%" fill="#fff" fill-opacity="0" stroke="none" /><path d="M 135 155 L 125 155 Z" fill="none" stroke="#444" stroke-width="1" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 155.05321559063054 93.28254850929031 L 146.96304564688106 87.40469598636558 Z" fill="none" stroke="#444" stroke-width="1" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 207.55321559063054 55.13906578900887 L 204.46304564688106 45.62850062605733 Z" fill="none" stroke="#444" stroke-width="1" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 272.44678440936946 55.13906578900888 L 275.536954353119 45.628500626057345 Z" fill="none" stroke="#444" stroke-width="1" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 324.94678440936946 93.28254850929032 L 333.036954353119 87.4046959863656 Z" fill="none" stroke="#444" stroke-width="1" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 345 155 L 355 155 Z" fill="none" stroke="#444" stroke-width="1" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 166.5 155L 135 155A 105 105 0 0 1 142.3734689817336 116.34692196810883L 171.66142828721354 127.94284537767618A 73.5 73.5 0 0 0 166.5 155Z" fill="url(#gradientGreen)" stroke-width="0px" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 171.66142828721354 127.94284537767618L 142.3734689817336 116.34692196810883A 105 105 0 0 1 155.05321559063054 93.28254850929031L 180.53725091344137 111.79778395650322A 73.5 73.5 0 0 0 171.66142828721354 127.94284537767618Z" fill="url(#gradientYellow)" stroke-width="0px" z-index="0" transform="matrix(1,0,0,1,0,0)" /><path d="M 180.53725091344137 111.79778395650322L 155.05321559063054 93.28254850929031A 105 105 0 0 1 345 155L 313.5 155A 73.5 73.5 0 0 0 180.53725091344137 111.79778395650322Z" fill="url(#gradientRed)" stroke-width="0px" z-index="0" transform="matrix(1,0,0,1,0,0)" /><circle cx="240" cy="155" r="5" fill="#000" transform="matrix(1,0,0,1,0,0)" /><path d="M 240 155 C 240 155 324.94678440936946 93.28254850929034 324.94678440936946 93.28254850929034" fill="none" stroke="#000" stroke-width="2" z-index="0" transform="matrix(1,0,0,1,0,0)" /><text x="235" y="102.5" font-size="18" font-family="Arial" fill="#000" transform="matrix(1,0,0,1,0,0)" ><tspan x="235" dy="4.5">20</tspan></text><text x="115" y="147.99999999999997" font-size="12" font-family="Heveltica, sans-serif" text-anchor="middle" fill="#333" transform="matrix(1,0,0,1,0,0)" ><tspan x="115" dy="3">0</tspan></text><text x="138.87287570313157" y="81.52684346344084" font-size="12" font-family="Heveltica, sans-serif" text-anchor="middle" fill="#333" transform="matrix(1,0,0,1,0,0)" ><tspan x="138.87287570313157" dy="3">5</tspan></text><text x="201.37287570313157" y="36.117935463105795" font-size="12" font-family="Heveltica, sans-serif" text-anchor="middle" fill="#333" transform="matrix(1,0,0,1,0,0)" ><tspan x="201.37287570313157" dy="3">10</tspan></text><text x="278.62712429686843" y="36.11793546310581" font-size="12" font-family="Heveltica, sans-serif" text-anchor="middle" fill="#333" transform="matrix(1,0,0,1,0,0)" ><tspan x="278.62712429686843" dy="3">15</tspan></text><text x="341.12712429686843" y="81.52684346344085" font-size="12" font-family="Heveltica, sans-serif" text-anchor="middle" fill="#333" transform="matrix(1,0,0,1,0,0)" ><tspan x="341.12712429686843" dy="3">20</tspan></text><text x="365" y="148" font-size="12" font-family="Heveltica, sans-serif" text-anchor="middle" fill="#333" transform="matrix(1,0,0,1,0,0)" ><tspan x="365" dy="3">25</tspan></text></svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment