Using Java libraries with ColdFusion 9

混江龙づ霸主 提交于 2019-12-12 18:31:49

问题


I am currently running a Java application which applies some natural language processing techniques to analyze data. This application includes a Java Class file and 1 library of .bin extension The application works fine on my development server but on the live server I get the error below:

Object instantiation exception.
An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: opennlp/tools/util/ObjectStream.

Stack Trace java.lang.NoClassDefFoundError: opennlp/tools/util/ObjectStream at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2291) at java.lang.Class.privateGetPublicFields(Class.java:2324) at java.lang.Class.getFields(Class.java:1359) at coldfusion.runtime.java.ObjectHandler.Initialize(ObjectHandler.java:35) at coldfusion.runtime.java.ObjectHandler.(ObjectHandler.java:30) at coldfusion.runtime.java.ReflectionCache$1.fetch(ReflectionCache.java:29) at coldfusion.util.SoftCache.get_statsOff(SoftCache.java:133) at coldfusion.util.SoftCache.get(SoftCache.java:81) at coldfusion.runtime.java.ReflectionCache.get(ReflectionCache.java:36) at coldfusion.runtime.java.JavaProxy.(JavaProxy.java:35) at coldfusion.runtime.java.JavaProxyFactory.getProxy(JavaProxyFactory.java:89) 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 cfWord_Cloud_Report2ecfm2061667591.runPage(E:\sites\SignatureWebMedical.Com\cf_modules\reports\sounding\Word_Cloud_Report.cfm:40) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722) at cfindex2ecfm1980726432._factor0(E:\sites_virtualdirs\admin\reports\index.cfm:425) at cfindex2ecfm1980726432._factor7(E:\sites_virtualdirs\admin\reports\index.cfm:403) at cfindex2ecfm1980726432._factor8(E:\sites_virtualdirs\admin\reports\index.cfm:188) at cfindex2ecfm1980726432.runPage(E:\sites_virtualdirs\admin\reports\index.cfm:1) 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:360) 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.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.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126) at coldfusion.CfmServlet.service(CfmServlet.java:200) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at com.intergral.fusionreactor.filter.FusionReactorFilter.b(FusionReactorFilter.java:376) at com.intergral.fusionreactor.filter.FusionReactorFilter.c(FusionReactorFilter.java:254) at com.intergral.fusionreactor.filter.FusionReactorFilter.doFilter(FusionReactorFilter.java:164) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) 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.ClassNotFoundException:opennlp.tools.util.ObjectStream at coldfusion.bootstrap.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:235) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316) ... 61 more

It seems to me that it’s a class path issue. I had the same problem with the Dev server but fixed it by placing all my files in the Cold Fusion 9 directory: C:\ColdFusion9\runtime\servers\lib When I place the class file and library .bin file in the same folder on the Live server it does not work. I restart my production server every time I am adding/deleting the class file and .bin files.


回答1:


Did you check if the class path is added in the ColdFusion Administrator Java JVM settings ?




回答2:


This might be similar to what you are dealing with: https://newrelic.com/docs/java/installing-the-java-agent-on-coldfusion




回答3:


My issue was the versions of windows. On development we are using Windows server 2008 R2 and on production we were using Windows server 2008 SP2, which based on what I read online they have a lot differences (minor but important) We updated our production server on Friday and everything started working. Thanks to all that replied to this post.



来源:https://stackoverflow.com/questions/13479961/using-java-libraries-with-coldfusion-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!