Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing |
Summary: | Current thread context class loader on UNO callback threads | ||
---|---|---|---|
Product: | General | Reporter: | uga <yegor.jbanov> |
Component: | code | Assignee: | AOO issues mailing list <issues> |
Status: | UNCONFIRMED --- | QA Contact: | |
Severity: | Trivial | ||
Priority: | P3 | CC: | elish, issues, stephan.bergmann.secondary |
Version: | OOo 2.4.0 | Keywords: | needhelp |
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Latest Confirmation in: | --- |
Developer Difficulty: | --- |
Description
uga
2008-09-11 00:01:51 UTC
TM->JL: please have a look. . @uga: The only solution that works well is to have the extension code explicitly set the context class loader where necessary. The UNO framework cannot (easily) do this automatically (set the extension's class loader as context class loader around every call into the extension's code), as calls into extension code can be direct Java-to-Java calls (we would need to introduce additional proxy objects, which would come at a non-negligible cost). . Hi sb, I agree that it may be hard to implement, although I think the affected code will be confined to UNO jars only (unoil.jar, ridl.jar, jurt.jar, jug.jar). However, let's point out that there is one OpenOffice.org and there are potentially hundreds of extensions for it written in Java. By not providing it in OpenOffice.org we introduce a major road-block to extension developers. I am confident that a majority will abandon their project blaming it on bugs in OpenOffice.org even before you get a chance to explain that they have to add the line Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); to every method in every listener and every callback class such as XAsyncJob. I am lucky to be paid for writing OpenOffice.org extensions, so I'm not going anywhere :) So, let's not rush marking this issue RESOLVED (WONTFIX) and make an attempt to fix it. It was an unintended side-effect or the new class loader architecture (which is otherwise simply fantastic!) and deserves some attention. I have gone through several mail threads where people hit this problem but everyone has their own explanation, which indicates that the issue is not obvious and developers get confused. I myself spent hours in Eclipse debugger to narrow down the problem. It is not documented (or at least not indexed by google) and due to misunderstanding from developers I keep finding wrong solutions, such as adding dependent libraries to the root classpath or changing the way I load resources which is not possible when I use 3rd party libraries, such as Spring. Relevant mail threads: http://extensions.openoffice.org/servlets/ReadMsg?list=dev&msgNo=912 http://www.mail-archive.com/dev@api.openoffice.org/msg07637.html http://www.openoffice.org/issues/show_bug.cgi?id=75767 http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=19584 Reset assignee on issues not touched by assignee in more than 1000 days. |