[ 
https://issues.apache.org/jira/browse/STANBOL-970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rupert Westenthaler reopened STANBOL-970:
-----------------------------------------


Looks like that updating the ContextClassloader results in a SecurityException 
under Ubuntu. Mac and Debian do now seam to cause this.

Exception taken from Jenkins build 1324

java.security.AccessControlException: access denied 
(java.lang.RuntimePermission getClassLoader)
        at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
        at 
java.security.AccessController.checkPermission(AccessController.java:546)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at java.lang.Thread.getContextClassLoader(Thread.java:1364)
        at 
org.apache.stanbol.enhancer.engines.tika.TikaEngine.updateContextClassLoader(TikaEngine.java:402)
        at 
org.apache.stanbol.enhancer.engines.tika.TikaEngine.computeEnhancements(TikaEngine.java:270)
        at 
org.apache.stanbol.enhancer.jobmanager.event.impl.EnhancementJobHandler.processEvent(EnhancementJobHandler.java:271)
        at 
org.apache.stanbol.enhancer.jobmanager.event.impl.EnhancementJobHandler.handleEvent(EnhancementJobHandler.java:189)
        at 
org.apache.felix.eventadmin.impl.tasks.HandlerTaskImpl.execute(HandlerTaskImpl.java:88)
        at 
org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:221)
        at 
org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks$TaskExecuter.run(AsyncDeliverTasks.java:110)
        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown 
Source)
        at java.lang.Thread.run(Thread.java:662)

moving the updating of the ContextClassloader into the doPrivileged(..) Block 
should solve this
                
> TikaEngine may fail if XML framewoks are present in the Context ClassLoader
> ---------------------------------------------------------------------------
>
>                 Key: STANBOL-970
>                 URL: https://issues.apache.org/jira/browse/STANBOL-970
>             Project: Stanbol
>          Issue Type: Bug
>          Components: Engine - Tika
>    Affects Versions: enhancement-engines-0.10.0
>         Environment: Should only affect usages where Stanbol runs within an 
> Embedded OSGI environment and the host application uses XML framewoks
>            Reporter: Rupert Westenthaler
>            Assignee: Rupert Westenthaler
>            Priority: Minor
>
> This is caused if the context ClassLoader (Thread#getContextClassLoader) 
> provides Implementations of XML frameworks. 
> Most Java XML libs prefer to load implementations by using the 
> Thread#getContextClassLoader(). However OSGI has no control over this 
> ClassLoader. Because of that there can be situations where Interfaces are 
> loaded via the Bundle Classloader and the implementations are taken from the 
> context Classloader. 
> Reported Exception can be very manifold. Typically one would expect 
> ClassCastException mentioning the same class two time. However more often 
> Errors such as ExceptionInInitializerError are reported, as loading of 
> implementations is often done by static members (or static blocks) and the 
> JVM can not report the real exception in such cases.
> The only workaround for this problem is resetting the context ClassLoader 
> with the bundle ClassLoader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to