You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sebastien Sahuc <ss...@imediation.com> on 2000/08/29 11:28:42 UTC
[C2] ClassLoader issues
Hello,
While debugging inside Cocoon2 with the lastest snapshot from CVS, I
realized that there was some Class loader issues :
in the Coccon.getClass() method, the instrcution
'this.getClass().getClassLoader().loadClaa(className)' gave me a NPE due
to the fact that claa.getClassLoader() can return null (from JDK 1.2
Javadoc ).
So I would rather use the new (since 1.2)
Thread.currentThread.getContextClassLoader() instead, since it's the
container's role to set the correct ClassLoader that's been used by the
servlet application.
What do you think ?
All the best,
Sebastien
Re: [C2] ClassLoader issues
Posted by do...@mad.scientist.com.
On Tue, 29 Aug 2000, Niclas Hedhman wrote:
> > in the Coccon.getClass() method, the instrcution
> > 'this.getClass().getClassLoader().loadClaa(className)' gave me a NPE due
> > to the fact that claa.getClassLoader() can return null (from JDK 1.2
> > Javadoc ).
>
> NPE is only returned for in getClassLoader for classes loaded by the Boot
> strap classloader, i.e classes located in the rt.jar. There should not be
> any other cases. Please specify the details of your problem.
Actually it is any time that the class has been loaded by
primordial classloader which includes classes loaded via
classpath variable.
Cheers,
Pete
*--------------------------------------------------*
| Latrobe University, | Does the name 'Pavlov' |
| Bundoora, Australia | ring a bell ? |
*--------------------------------------------------*
Re: [C2] ClassLoader issues
Posted by Niclas Hedhman <ni...@f1.bali.ac>.
Sebastien Sahuc wrote:
> Hello,
>
> While debugging inside Cocoon2 with the lastest snapshot from CVS, I
> realized that there was some Class loader issues :
>
> in the Coccon.getClass() method, the instrcution
> 'this.getClass().getClassLoader().loadClaa(className)' gave me a NPE due
> to the fact that claa.getClassLoader() can return null (from JDK 1.2
> Javadoc ).
NPE is only returned for in getClassLoader for classes loaded by the Boot
strap classloader, i.e classes located in the rt.jar. There should not be
any other cases. Please specify the details of your problem.
> So I would rather use the new (since 1.2)
> Thread.currentThread.getContextClassLoader() instead, since it's the
> container's role to set the correct ClassLoader that's been used by the
> servlet application.
This should be the case for other reasons than above.
Niclas
Re: [C2] ClassLoader issues
Posted by "Pier P. Fumagalli" <pi...@apache.org>.
Stefano Mazzocchi wrote:
>
> "Pier P. Fumagalli" wrote:
> >
> > Sebastien Sahuc wrote:
> > >
> > > Hello,
> > >
> > > While debugging inside Cocoon2 with the lastest snapshot from CVS, I
> > > realized that there was some Class loader issues :
> > >
> > > in the Coccon.getClass() method, the instrcution
> > > 'this.getClass().getClassLoader().loadClaa(className)' gave me a NPE due
> > > to the fact that claa.getClassLoader() can return null (from JDK 1.2
> > > Javadoc ).
> > >
> > > So I would rather use the new (since 1.2)
> > > Thread.currentThread.getContextClassLoader() instead, since it's the
> > > container's role to set the correct ClassLoader that's been used by the
> > > servlet application.
> > >
> > > What do you think ?
> > >
> > > All the best,
> >
> > That was my first implementation... But I was shot because I was
> > breaking JDK 1.1 compatibility :) :)
> >
> > BLAH! to all those who voted -1 on using the context class loader at
> > that time :) :) :)
>
> Yeah, but while you were not here we decided not to care about 1.1
> anymore so, I'm +1 on the change.
I've seen that... And, BTW, I believe that in post 1.1 JDKs
Class.forName() simply uses the context class loader for getting
classes...
Pier
Re: [C2] ClassLoader issues
Posted by Stefano Mazzocchi <st...@apache.org>.
"Pier P. Fumagalli" wrote:
>
> Sebastien Sahuc wrote:
> >
> > Hello,
> >
> > While debugging inside Cocoon2 with the lastest snapshot from CVS, I
> > realized that there was some Class loader issues :
> >
> > in the Coccon.getClass() method, the instrcution
> > 'this.getClass().getClassLoader().loadClaa(className)' gave me a NPE due
> > to the fact that claa.getClassLoader() can return null (from JDK 1.2
> > Javadoc ).
> >
> > So I would rather use the new (since 1.2)
> > Thread.currentThread.getContextClassLoader() instead, since it's the
> > container's role to set the correct ClassLoader that's been used by the
> > servlet application.
> >
> > What do you think ?
> >
> > All the best,
>
> That was my first implementation... But I was shot because I was
> breaking JDK 1.1 compatibility :) :)
>
> BLAH! to all those who voted -1 on using the context class loader at
> that time :) :) :)
Yeah, but while you were not here we decided not to care about 1.1
anymore so, I'm +1 on the change.
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------
Re: [C2] ClassLoader issues
Posted by "Pier P. Fumagalli" <pi...@apache.org>.
Sebastien Sahuc wrote:
>
> Hello,
>
> While debugging inside Cocoon2 with the lastest snapshot from CVS, I
> realized that there was some Class loader issues :
>
> in the Coccon.getClass() method, the instrcution
> 'this.getClass().getClassLoader().loadClaa(className)' gave me a NPE due
> to the fact that claa.getClassLoader() can return null (from JDK 1.2
> Javadoc ).
>
> So I would rather use the new (since 1.2)
> Thread.currentThread.getContextClassLoader() instead, since it's the
> container's role to set the correct ClassLoader that's been used by the
> servlet application.
>
> What do you think ?
>
> All the best,
That was my first implementation... But I was shot because I was
breaking JDK 1.1 compatibility :) :)
BLAH! to all those who voted -1 on using the context class loader at
that time :) :) :)
Pier