我刚开始使用cf ImagePaste()
功能在网站上收到500错误。
<cfscript> ImagePaste(image, watermark, 0, 0); </cfscript>
<cfset ImagePaste(image, watermark, 0, 0) />
我在上面尝试了两种方式
该函数的完整源代码如下 - 它可以在imagepaste注释掉的情况下正常工作。
<cffunction name="watermark" access="public"
description="adds the carproof logo to a jpeg" output="yes" returntype="any">
<cfargument name="path" required="yes" type="string" default="" />
<cfargument name="filename" required="yes" type="string" />
<cfimage source="#path##filename#" name="image">
<cfimage source="#basepath#../Images/carproof-watermark.png"
name="watermark">
<!---cfscript> ImagePaste(image, watermark, 1, 1); </cfscript--->
<cfimage action="write" destination="#path##filename#"
source="#image#" overwrite="yes" />
</cffunction>
这是我得到的错误:
500
ROOT CAUSE:
coldfusion.runtime.EventHandlerException: Event handler exception.
at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:251)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:278)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
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.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
at coldfusion.CfmServlet.service(CfmServlet.java:198)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.lang.ExceptionInInitializerError
at coldfusion.image.Image.paste(Image.java:2307)
at coldfusion.runtime.CFPage.ImagePaste(CFPage.java:5877)
at cffile2ecfm1620657721$funcWATERMARK.runFunction(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Assets/CFC/file.cfm:19)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2471)
at cffile2ecfm1620657721$funcUPLOAD.runFunction(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Assets/CFC/file.cfm:91)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2471)
at cfimage2dupload2dtest2ecfm664365309.runPage(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Assets/XHTML/image-upload-test.cfm:10)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:483)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661)
at cfindex2ecfm1182266435.runPage(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/index.cfm:27)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:483)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661)
at cfApplication2ecfc1506803272$funcONREQUEST.runFunction(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Application.cfc:130)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:448)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:308)
at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:74)
at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:243)
... 27 more
Caused by: java.lang.NullPointerException
at com.sun.media.jai.util.PropertyUtil.getString(PropertyUtil.java:159)
at javax.media.jai.JaiI18N.getString(JaiI18N.java:22)
at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:357)
at javax.media.jai.JAI.<clinit>(JAI.java:560)
... 63 more
javax.servlet.ServletException: ROOT CAUSE:
coldfusion.runtime.EventHandlerException: Event handler exception.
at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:251)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:278)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
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.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
at coldfusion.CfmServlet.service(CfmServlet.java:198)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.lang.ExceptionInInitializerError
at coldfusion.image.Image.paste(Image.java:2307)
at coldfusion.runtime.CFPage.ImagePaste(CFPage.java:5877)
at cffile2ecfm1620657721$funcWATERMARK.runFunction(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Assets/CFC/file.cfm:19)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2471)
at cffile2ecfm1620657721$funcUPLOAD.runFunction(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Assets/CFC/file.cfm:91)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2471)
at cfimage2dupload2dtest2ecfm664365309.runPage(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Assets/XHTML/image-upload-test.cfm:10)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:483)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661)
at cfindex2ecfm1182266435.runPage(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/index.cfm:27)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:483)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661)
at cfApplication2ecfc1506803272$funcONREQUEST.runFunction(/var/www/vhosts/newride.ca/subdomains/admin/httpdocs/Application.cfc:130)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:192)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:448)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:308)
at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:74)
at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:243)
... 27 more
Caused by: java.lang.NullPointerException
at com.sun.media.jai.util.PropertyUtil.getString(PropertyUtil.java:159)
at javax.media.jai.JaiI18N.getString(JaiI18N.java:22)
at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:357)
at javax.media.jai.JAI.<clinit>(JAI.java:560)
... 63 more
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:70)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
答案 0 :(得分:0)
测试了其他图像功能,其中一些 工作与有些人不这样做:
许多图像功能都使用JAI。因此,给定消息Could not initialize class javax.media.jai.JAI
,这些功能也不起作用。首先,我要确保类路径没有被破坏(丢失罐子,太多罐子等等)。这是问题的最常见原因。
但java.lang.NoClassDefFoundError
错误为a pain to figure out。只是猜测,但仔细观察可能是初始化问题Caused by: java.lang.ExceptionInInitializerError
。我知道JAI在启动时从jar中读取一些属性文件。也许他们因某些原因无法访问(缺失,权限,......)?我没有运行Centos。所以这是我现在最好的猜测。
答案 1 :(得分:0)
可能是时候将图像处理卸载到第三方二进制文件了。
Imagemagick,pil,gd等。
你在OS X上运行CF吗? (正如我们所做)
与Windows X机器上的最新版本相比,OS X Java附带的JAI库是旧版本。对我们来说,一些图像编辑功能根本不适用于我们的Mac开发环境,但在Windows等效环境中完美运行。