ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravi Krishnamurthy <ra...@savvion.com>
Subject Re: classLoaders
Date Mon, 24 Oct 2005 18:31:59 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks Jeff for your reply.<br>
The custom classloader cannot be avoided :(<br>
<br>
Yes as you have suggested, I have tried the setDefaultClassLoader
approach and it worked fine.<br>
<br>
But as I have asked in my previous email, why is the classloader that
is used to load the resources.java is not used as the defaultLoader
before using the Thread.contextClassLoader. <br>
<br>
Thanks,<br>
Ravi<br>
<br>
Jeff Butler wrote:
<blockquote
 cite="midc593b8750510241108u666cb7cbw79489bca4c91a83@mail.gmail.com"
 type="cite">
  <div>Simple solution - get rid of the custom classloader.&nbsp; The custom
classloader is likely to&nbsp;end up introducing hidden application server
dependencies into your code - because it is not safe to assume that all
application servers structure their classloaders the same way.
  </div>
  <div>&nbsp;</div>
  <div>If there is some compelling reason to have a custom classloader
(do tell), then maybe this would help:</div>
  <div>&nbsp;</div>
  <div>Resources.setDefaultClassLoader(yourCustomClassloader)</div>
  <div>&nbsp;</div>
  <div>Jeff Butler</div>
  <div><br>
&nbsp;</div>
  <div><span class="gmail_quote">On 10/24/05, <b
 class="gmail_sendername">Ravi Krishnamurthy</b> &lt;<a
 href="mailto:ravik@savvion.com">ravik@savvion.com</a>&gt; wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left:
1ex;">Hello:<br>
I have a custom classloader that has the ejbclassloader as the parent.<br>
The custom classloader loads all the ibatis classes but the thread
    <br>
context classloader is the ejbclassloader. So when the ibatis is trying<br>
to load the resource, I get resource not found for the sql...dtd files.<br>
On lookig at the source code looks like in the Resources.java of
ibatis,
    <br>
the getClassLoader first check the default Classloader and then the<br>
Thread.contextClassloader. Looks like in my case, the defaultClassLoader<br>
is null and so the context classloader (ejbclassloader) is used to<br>
search for the resources and so things file.<br>
    <br>
Could someone give me some pointers on how to resolve this problem.<br>
    <br>
But wondering why the getClassLoader does not use the classloader that<br>
loaded the Resources.java to search for the resources.<br>
    <br>
Please note that the ibatis classes are only visible to the<br>
cutomclassloader and not to the ejbclassloader.<br>
    <br>
Thanks for your time,<br>
    <br>
Regards,<br>
Ravi<br>
    <br>
  </blockquote>
  </div>
  <br>
</blockquote>
<br>
</body>
</html>


Mime
View raw message