Page 1 of 2

Class: java.lang.NullPointerException

PostPosted:Tue Apr 21, 2015 2:46 am
by bigearl
I am trying to set up a automated OCR server, to test the possibility as of expanding it as a Professional version across several sites. On a box running Debian Wheezy I have installed OpenKM 6.3 and Tesseract 3.2, I am trying to import a file however I continue to receive this error "Class: java.lang.NullPointerException"

I have found a post regarding this and tried following along however I am a new user to OpenKM and have trouble understanding the posts.

Thank You

Re: Class: java.lang.NullPointerException

PostPosted:Tue Apr 21, 2015 3:09 am
by bigearl
Logs
Code: Select all
2015-04-20 22:08:00,995 [http-bio-0.0.0.0-8080-exec-9] ERROR com.openkm.servlet.admin.OmrServlet-
java.lang.NullPointerException
        at com.openkm.omr.ImageManipulation.<init>(ImageManipulation.java:66)
        at com.openkm.omr.OMRHelper.trainingTemplate(OMRHelper.java:91)
        at com.openkm.servlet.admin.OmrServlet.doPost(OmrServlet.java:174)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        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:170)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:701)

Re: Class: java.lang.NullPointerException

PostPosted:Thu Apr 23, 2015 11:01 am
by jllort
When you change ocr engine also must change the class related with it, see http://wiki.openkm.com/index.php/Third- ... ation:_OCR

Go to administration -> configuration parameters and there you got a list of registered.text.extractors

If you want to add distinc ocr, tesseract or cuneiform, then must create your own textextractor and do minimal source code modification. The error in the second post seems is caused by OMR, probaly with relation with uncomplete ocr change configuration.

Re: Class: java.lang.NullPointerException

PostPosted:Sun Apr 26, 2015 2:57 am
by bigearl
I have followed the documentation, several times. Can you provide any further direction?

Re: Class: java.lang.NullPointerException

PostPosted:Sun Apr 26, 2015 2:26 pm
by jllort
It seems you missed some steps ( firs of all, have you tried to configure the example what comes on wiki ).

The problem is here:
Code: Select all
Gray8Image grayimage = ImageUtil.readImage(template.getCanonicalPath());
ImageManipulation image = new ImageManipulation(grayimage);
It seems that "grayimage" is null. What kind of image are you using ? At least you need 200 dpi as is indicated in documentation.

Re: Class: java.lang.NullPointerException

PostPosted:Wed Apr 29, 2015 1:28 am
by bigearl
I did not see an Example in the Wiki. Can you link me to it?

Re: Class: java.lang.NullPointerException

PostPosted:Fri May 01, 2015 3:56 pm
by jllort
Here's the link http://wiki.openkm.com/OMR_templates ( into should be an external link to main project, I suggest also read it ). Try first with the examples that comes into zip and when you got it running, then build your own.

Re: Class: java.lang.NullPointerException

PostPosted:Sat May 02, 2015 7:22 pm
by bigearl
I am getting an 404 error. It seems that page is not there or it is a dead link.

Re: Class: java.lang.NullPointerException

PostPosted:Sun May 03, 2015 5:53 pm
by jllort

Re: Class: java.lang.NullPointerException

PostPosted:Sun May 03, 2015 8:56 pm
by bigearl
If you want to add distinc ocr, tesseract or cuneiform, then must create your own textextractor and do minimal source code modification. The error in the second post seems is caused by OMR, probaly with relation with uncomplete ocr change configuration.
Can you link me to more information on doing this?
Gray8Image grayimage = ImageUtil.readImage(template.getCanonicalPath());
ImageManipulation image = new ImageManipulation(grayimage);
Where are these settings located? What are they currently? and what do they need to be changed to?

Re: Class: java.lang.NullPointerException

PostPosted:Sun May 03, 2015 11:26 pm
by bigearl
I have verified that Tesseract is installed and I can run it by command line. However I continue to receive the same error.

Application error
Class: java.lang.NullPointerException
Message: null

Re: Class: java.lang.NullPointerException

PostPosted:Mon May 04, 2015 8:38 am
by jllort
And you're using the samples ?
Did you changed the text extractor class to get tesseract running http://wiki.openkm.com/index.php/Third- ... ation:_OCR ( Administration -> configuration parameters -> registered.text.extractors ).

Anyway seeing the error, really the error has no relation with OCR engine, cuneiform or tesseract the problem I suspect is with the image you're uploading, the format or resolution, because for some reason you're getting a null here
Code: Select all
Gray8Image grayimage = ImageUtil.readImage(template.getCanonicalPath());
This is into Helper.java class, the best option will be debug the code to understand what happening. Here you got our portable dev environment http://sourceforge.net/projects/openkmportabledev/ my suggestion is try on this direction.

Re: Class: java.lang.NullPointerException

PostPosted:Tue May 05, 2015 1:34 am
by bigearl
Thank you for your assistance, I have tried the portable edition with no luck. Like I said I do not know where to locate
Gray8Image grayimage = ImageUtil.readImage(template.getCanonicalPath());
I have ensured that I have completed the installation as directed and configured per the instructions. I have repeated on a second server also. Where I have encountered the same errors.

Re: Class: java.lang.NullPointerException

PostPosted:Fri May 08, 2015 5:35 am
by jllort
You should debug and stack trace log is telling you anything you need:
Code: Select all
java.lang.NullPointerException
        at com.openkm.omr.ImageManipulation.<init>(ImageManipulation.java:66)
        at com.openkm.omr.OMRHelper.trainingTemplate(OMRHelper.java:91)
        at com.openkm.servlet.admin.OmrServlet.doPost(OmrServlet.java:174)
From OmrServlet.java:174 jumps to OMRHelper.java:91 and then here you got the ImageManipulation.java:66 ( CTRL+Shift+R to looking for classes by name on eclipse)

Re: Class: java.lang.NullPointerException

PostPosted:Fri May 08, 2015 10:56 am
by bigearl
I appreciate all your time with this. However I feel that your directions here would only help someone whom already is very familiar with this software, which I am not. Without context or reference to the code/configurations you continue to make, they will not help me.