不知道为什么不能在我的本地计算机上引用。它适用于我的远程测试环境。当前代码:
<cfset local = {}>
<cfset local.paths = []>
<cfset local.paths[1] = GetDirectoryFromPath(GetCurrentTemplatePath()) & "lib\jsoup-1.7.2.jar">
<cfset local.javaloader = createObject("component", "javaloader.JavaLoader").init(local.paths)>
<cfset jSoupClass = local.javaloader.create( "org.jsoup.Jsoup" )>
在
<cfset local.javaloader....>
上的错误有任何想法吗? #local#到达正确的
jsoup-1.7.2.jar
在浏览器上抛出错误:
coldfusion.runtime.CfJspPage$NoSuchTemplateException: Could not find the ColdFusion component or interface javaloader.JavaLoader.
at coldfusion.runtime.TemplateProxyFactory.getResolvedFile(TemplateProxyFactory.java:1407)
at coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper(TemplateProxyFactory.java:1642)
at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:51)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6352)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6371)
at cfquote_htmlparser2ecfm1800247286.runPage(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\modules\tools\quote_htmlparser.cfm:8)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:251)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:737)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:573)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:3698)
at cfquoteadder2ecfm646267101.runPage(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\modules\tools\quoteadder.cfm:24)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:251)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:737)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:573)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:3698)
at cfmodules2ecfm877363338._factor1(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\modules.cfm:47)
at cfmodules2ecfm877363338._factor5(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\modules.cfm:45)
at cfmodules2ecfm877363338._factor9(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\modules.cfm:31)
at cfmodules2ecfm877363338._factor10(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\modules.cfm:28)
at cfmodules2ecfm877363338.runPage(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\modules.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:251)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:737)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:573)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:3698)
at cfbody2ecfm524231656._factor11(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\body.cfm:246)
at cfbody2ecfm524231656.runPage(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\body.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:251)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:737)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:573)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:3698)
at cfportal2ecfm1302691009.runPage(C:\Users\Charles\Documents\GitHub\MilestonePortal\MilestonePortalV2\portal.cfm:144)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:251)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:737)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:573)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:45)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:505)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:153)
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:60)
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.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151)
at coldfusion.CfmServlet.service(CfmServlet.java:219)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
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:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:121)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:536)
at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:898)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
最佳答案
您实际上有一个名为“ javaloader.Javaloader”的CFC吗?在我看来,这听起来像是一个Java类。尝试这个:
<cfset local = {}>
<cfset local.paths = []>
<cfset local.paths[1] = GetDirectoryFromPath(GetCurrentTemplatePath()) & "lib\jsoup-1.7.2.jar">
<cfset local.javaloader = createObject("java", "javaloader.JavaLoader").init(local.paths)>
<cfset jSoupClass = local.javaloader.create( "org.jsoup.Jsoup" )>
还请记住,Java类和文件名区分大小写。因此,您需要精确匹配它们。
关于java - 找不到ColdFusion组件或接口(interface)javaloader.JavaLoader,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41064441/