You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Alex Ott (JIRA)" <ji...@apache.org> on 2010/06/15 20:55:23 UTC

[jira] Created: (TIKA-441) Sometimes, tika not working (crashed) because of null classloader

Sometimes, tika not working (crashed) because of null classloader
-----------------------------------------------------------------

                 Key: TIKA-441
                 URL: https://issues.apache.org/jira/browse/TIKA-441
             Project: Tika
          Issue Type: Bug
          Components: general
         Environment: MS Windows with tika running under Apache Commons Daemon (procrun)
            Reporter: Alex Ott
            Priority: Minor
             Fix For: 0.8
         Attachments: classloader-fix.diff

I used Tika inside application, that should run as MS Windows service via Apache Commons Daemon - procrun (http://commons.apache.org/daemon/procrun.html). When it was running under procrun, then Thread.currentThread().getContextClassLoader() returned null instead ClassLoader's instance. I made a workaround in my app by explicitly setting classloader for current thread.  I'll attach fix, that should use system class loader if getContextClassLoader will return null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TIKA-441) Sometimes, tika not working (crashed) because of null classloader

Posted by "Alex Ott (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TIKA-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879463#action_12879463 ] 

Alex Ott commented on TIKA-441:
-------------------------------

Thank you. I understand, that my patch isn't perfect - I hadn't program in Java at least 5 years and only year ago I started to return to JVM, but I mostly use Clojure...

> Sometimes, tika not working (crashed) because of null classloader
> -----------------------------------------------------------------
>
>                 Key: TIKA-441
>                 URL: https://issues.apache.org/jira/browse/TIKA-441
>             Project: Tika
>          Issue Type: Bug
>          Components: general
>         Environment: MS Windows with tika running under Apache Commons Daemon (procrun)
>            Reporter: Alex Ott
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: classloader-fix.diff
>
>
> I used Tika inside application, that should run as MS Windows service via Apache Commons Daemon - procrun (http://commons.apache.org/daemon/procrun.html). When it was running under procrun, then Thread.currentThread().getContextClassLoader() returned null instead ClassLoader's instance. I made a workaround in my app by explicitly setting classloader for current thread.  I'll attach fix, that should use system class loader if getContextClassLoader will return null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TIKA-441) Sometimes, tika not working (crashed) because of null classloader

Posted by "Alex Ott (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TIKA-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Ott updated TIKA-441:
--------------------------

    Attachment: classloader-fix.diff

proposed patch to fix this issue

> Sometimes, tika not working (crashed) because of null classloader
> -----------------------------------------------------------------
>
>                 Key: TIKA-441
>                 URL: https://issues.apache.org/jira/browse/TIKA-441
>             Project: Tika
>          Issue Type: Bug
>          Components: general
>         Environment: MS Windows with tika running under Apache Commons Daemon (procrun)
>            Reporter: Alex Ott
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: classloader-fix.diff
>
>
> I used Tika inside application, that should run as MS Windows service via Apache Commons Daemon - procrun (http://commons.apache.org/daemon/procrun.html). When it was running under procrun, then Thread.currentThread().getContextClassLoader() returned null instead ClassLoader's instance. I made a workaround in my app by explicitly setting classloader for current thread.  I'll attach fix, that should use system class loader if getContextClassLoader will return null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (TIKA-441) Sometimes, tika not working (crashed) because of null classloader

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TIKA-441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved TIKA-441.
--------------------------------

      Assignee: Jukka Zitting
    Resolution: Fixed

Good point, fixed in revision 955348.

I used a slightly modified version of your patch. Instead of directly falling back to ClassLoader.getSystemClassLoader(), I'm first trying TikaConfig.class.getClassLoader() as that's probably more accurate in many cases. Only if neither the thread context class loader nor the TikaConfig class loader are available, do we opt for the system class loader. And finally, if none of these is available, Tika will simply just not load any Parser implementations by default.

PS. I noticed you updated also the MimeTypesReader.read(String) method in your patch. This package-private method is actually not used anywhere, so I simply removed it entirely.

> Sometimes, tika not working (crashed) because of null classloader
> -----------------------------------------------------------------
>
>                 Key: TIKA-441
>                 URL: https://issues.apache.org/jira/browse/TIKA-441
>             Project: Tika
>          Issue Type: Bug
>          Components: general
>         Environment: MS Windows with tika running under Apache Commons Daemon (procrun)
>            Reporter: Alex Ott
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: classloader-fix.diff
>
>
> I used Tika inside application, that should run as MS Windows service via Apache Commons Daemon - procrun (http://commons.apache.org/daemon/procrun.html). When it was running under procrun, then Thread.currentThread().getContextClassLoader() returned null instead ClassLoader's instance. I made a workaround in my app by explicitly setting classloader for current thread.  I'll attach fix, that should use system class loader if getContextClassLoader will return null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.