3

I am trying to use a java class file called Open_NLP but I am running into issues.

This is what I did so far

• Added the class file in C:\ColdFusion11\cfusion\wwwroot\WEB-INF\classes
• Restarted the CF service

This is how I am calling it

<cfset myObj = CreateObject("java", "Open_NLP")>

And this is the Error I am getting

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.

Am I calling the class wrong? Do I have to take more steps before I am able to call the class?

Stack Trace
at cfwordcloud2ecfm316238315.runPage(Z:/Sites/xamplifier/views/surveyreporting/wordcloud.cfm:91) at cfcfml2ecfm1851198363$func$INCLUDEANDRETURNOUTPUT.runFunction(Z:/Sites/xamplifier/wheels/global/cfml.cfm:138) at cfrendering2ecfm1331024027$func$INCLUDEFILE.runFunction(Z:/Sites/xamplifier/wheels/controller/rendering.cfm:498) at cfrendering2ecfm1331024027$func$RENDERPAGE.runFunction(Z:/Sites/xamplifier/wheels/controller/rendering.cfm:257) at cfrendering2ecfm1331024027$funcRENDERPAGE.runFunction(Z:/Sites/xamplifier/wheels/controller/rendering.cfm:68) at cfprocessing2ecfm608176556$func$CALLACTION.runFunction(Z:/Sites/xamplifier/wheels/controller/processing.cfm:99) at cfprocessing2ecfm608176556$func$PROCESSACTION.runFunction(Z:/Sites/xamplifier/wheels/controller/processing.cfm:60) at cfrequest2ecfm2131921479$func$REQUEST.runFunction(Z:/Sites/xamplifier/wheels/dispatch/request.cfm:167) at cfindex2ecfm2029461072.runPage(Z:/Sites/xamplifier/wheels/index.cfm:1) at cfindex2ecfm1778521657.runPage(Z:/Sites/xamplifier/index.cfm:1) at cfonrequest2ecfm1108885784$funcONREQUEST.runFunction(Z:/Sites/xamplifier/wheels/events/onrequest.cfm:1) 
 at cfwordcloud2ecfm316238315.runPage(Z:/Sites/xamplifier/views/surveyreporting/wordcloud.cfm:91) at cfcfml2ecfm1851198363$func$INCLUDEANDRETURNOUTPUT.runFunction(Z:/Sites/xamplifier/wheels/global/cfml.cfm:138) at cfrendering2ecfm1331024027$func$INCLUDEFILE.runFunction(Z:/Sites/xamplifier/wheels/controller/rendering.cfm:498) at cfrendering2ecfm1331024027$func$RENDERPAGE.runFunction(Z:/Sites/xamplifier/wheels/controller/rendering.cfm:257) at cfrendering2ecfm1331024027$funcRENDERPAGE.runFunction(Z:/Sites/xamplifier/wheels/controller/rendering.cfm:68) at cfprocessing2ecfm608176556$func$CALLACTION.runFunction(Z:/Sites/xamplifier/wheels/controller/processing.cfm:99) at cfprocessing2ecfm608176556$func$PROCESSACTION.runFunction(Z:/Sites/xamplifier/wheels/controller/processing.cfm:60) at cfrequest2ecfm2131921479$func$REQUEST.runFunction(Z:/Sites/xamplifier/wheels/dispatch/request.cfm:167) at cfindex2ecfm2029461072.runPage(Z:/Sites/xamplifier/wheels/index.cfm:1) at cfindex2ecfm1778521657.runPage(Z:/Sites/xamplifier/index.cfm:1) at cfonrequest2ecfm1108885784$funcONREQUEST.runFunction(Z:/Sites/xamplifier/wheels/events/onrequest.cfm:1) 

java.lang.NoClassDefFoundError: opennlp/tools/util/ObjectStream
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.privateGetPublicFields(Unknown Source)
    at java.lang.Class.getFields(Unknown Source)
    at coldfusion.runtime.java.ObjectHandler.Initialize(ObjectHandler.java:35)
    at coldfusion.runtime.java.ObjectHandler.<init>(ObjectHandler.java:30)
    at coldfusion.runtime.java.ReflectionCache.get(ReflectionCache.java:38)
    at coldfusion.runtime.java.JavaProxy.<init>(JavaProxy.java:35)
    at coldfusion.runtime.java.JavaProxyFactory.getProxy(JavaProxyFactory.java:121)
    at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65)
    at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:6168)
    at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6131)
    at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6065)
    at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6040)
    at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5987)
    at cfwordcloud2ecfm316238315.runPage(Z:\Sites\xamplifier\views\surveyreporting\wordcloud.cfm:91)
    at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:246)
    at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:736)
    at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:572)
    at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2986)
    at cfcfml2ecfm1851198363$func$INCLUDEANDRETURNOUTPUT.runFunction(Z:\Sites\xamplifier\wheels\global\cfml.cfm:138)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:533)
    at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2805)
    at cfrendering2ecfm1331024027$func$INCLUDEFILE.runFunction(Z:\Sites\xamplifier\wheels\controller\rendering.cfm:498)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:533)
    at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2805)
    at cfrendering2ecfm1331024027$func$RENDERPAGE.runFunction(Z:\Sites\xamplifier\wheels\controller\rendering.cfm:257)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:533)
    at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2805)
    at cfrendering2ecfm1331024027$funcRENDERPAGE.runFunction(Z:\Sites\xamplifier\wheels\controller\rendering.cfm:68)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:231)
    at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2840)
    at cfprocessing2ecfm608176556$func$CALLACTION.runFunction(Z:\Sites\xamplifier\wheels\controller\processing.cfm:99)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:533)
    at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2805)
    at cfprocessing2ecfm608176556$func$PROCESSACTION.runFunction(Z:\Sites\xamplifier\wheels\controller\processing.cfm:60)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:231)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:643)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:432)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:402)
    at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2483)
    at cfrequest2ecfm2131921479$func$REQUEST.runFunction(Z:\Sites\xamplifier\wheels\dispatch\request.cfm:167)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:231)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:643)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:432)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:402)
    at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2483)
    at cfindex2ecfm2029461072.runPage(Z:\Sites\xamplifier\wheels\index.cfm:1)
    at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:246)
    at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:736)
    at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:572)
    at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2986)
    at cfindex2ecfm1778521657.runPage(Z:\Sites\xamplifier\index.cfm:1)
    at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:246)
    at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:736)
    at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:572)
    at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2986)
    at cfonrequest2ecfm1108885784$funcONREQUEST.runFunction(Z:\Sites\xamplifier\wheels\events\onrequest.cfm:1)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:487)
    at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:420)
    at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:383)
    at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
    at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:334)
    at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:231)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:643)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:432)
    at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:402)
    at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:108)
    at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:301)
    at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:462)
    at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:42)
    at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
    at coldfusion.filter.PathFilter.invoke(PathFilter.java:142)
    at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
    at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:78)
    at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
    at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
    at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)
    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:219)
    at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    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:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:422)
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:199)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: opennlp.tools.util.ObjectStream
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
    ... 145 more
11
  • 1
    Why are you using WEB-INF\classes? That is typically for individual .class files only. For jar files, use WEB-INF\lib. Can you post the stack trace message? Commented Jan 6, 2015 at 23:14
  • 2
    After you move the OpenNLP jars to ..\lib and restart, do you still get the error above? Also, from the piece of the error message we can see, it looks a lot like the error in your previous thread about CF9 - any relevance? Commented Jan 7, 2015 at 3:37
  • By the way did you already read the article - 'Creating and using a simple Java class' from adobe help.adobe.com/en_US/ColdFusion/9.0/Developing/… It might be helpful. Commented Jan 7, 2015 at 5:24
  • @Leigh my previous thread was when the other developer was working on it and I posted the article for him. That time we got it to work by accident to be honest and it was in a totally different folder. I am only using a single class file that's why I added it under classes. I will need to search more to see if there are any more files associated with this task. Will get back to you soon Commented Jan 7, 2015 at 15:15
  • 1
    (Edit) It is a missing a class. See Caused by: java.lang.ClassNotFoundException: opennlp.tools.util.ObjectStream... Why do you think only a single class file is involved? Perhaps you are using some custom class built on top of the OpenNLP project linked above? If so, it is not just a single class. It is dependent on the OpenNLP jars too. So you need put those jars in the WEB-INF\lib folder and restart. Commented Jan 7, 2015 at 15:53

1 Answer 1

3

If this is a jar file it needs to go into the /lib directory of the specific ColdFusion instance. The location depends on your type of installation and platform. But it's the same /lib that contains other CF specific jars - look in your CF Admin settings under "system information" or "settings summary" - you will see a long list of jar files that are being loaded upon start. In the one I'm currently looking at (which is a multi-instance cf 9) it is under instancename/cfusion.ear/cfusion.war/WEB-INF/cfusion/lib/ but on CF 11 it should be just ../WEB-INF/lib.

You can also put it anywhere on the server and add th location to the class path file by editing the jvm.config file.

After adding it to /lib or to the classpath you will need to restart ColdFusion. Good luck!

-Mark

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.