Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
BIRT Designer Pro Viewer class loaders problem
amozharovskyi
<p>I have 2 simple projects. The first one contains report, the second one java classes. I need java classes because of Scripted Data Source, to fetch data from my server's REST API. As a REST client i use RestEasy. All required jars added to report project's classpath.</p>
<p> </p>
<p>When i run report in debug mode (Run -> Debug Report) everything works fine. </p>
<p>When i run report within Web Viewer (Run -> View Report -> In Web Viewer) - have an exception. Exception is in the RestEasy class.</p>
<p>I investigated the problem and now can see that RestEasy uses "Thread.currentThread().getContextClassLoader()" classloader to load classes lazily, but received in this way classloader is different than loader used to load classes from .jars (by default when report starts running).</p>
<p> </p>
<p>Also in my situation class SSLSocketFactory (apache http client class loaded from jar, required for RestEasy) loaded with classloader which is neither "Thread.currentThread().getContextClassLoader()" nor jars classloader. Jar file containing this class is in the same folder as other jars and in the same classpath.</p>
<p> </p>
<p>Because of these classes cannot be cast, methods cannot be called, etc...</p>
<p> </p>
<p>Why classes loaded with different class loaders within BIRT Designer Pro Viewer?</p>
<p>May be i can read somewhere about report running process in details?</p>
<p> </p>
<p>Thanks, </p>
<p>Andrii</p>
Find more posts tagged with
Comments
amozharovskyi
<p>Workaround is "<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Thread.currentThread().</span><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">setContextClassLoader("Previously loaded class".getClassLoader())</span>".</p>