Thanks for all,

I make an interface for MyPrincipal and put all classes in /common/lib
And now it works fine.

Nicolas

-----Message d'origine-----
De : Randy Layman [mailto:[EMAIL PROTECTED]]
Envoy� : lundi 4 f�vrier 2002 12:56
� : 'Tomcat Users List'
Objet : RE: Principal Cast Exception



        The problem does have to do with the class loaders.  From what you
are trying, I guess that you have a copy of the Principal in the
lib/container jar and in lib/apps or WEB-INF.  The problem is that classes
loaded by two different class loaders are not equal and the same class from
two different class loaders are incompatible (not cast-able).

        I think you can do this:
        Create an interface with the extended information that you need to
use in lib/commons.  Then put your Principal in lib/container.  You should
now be able to cast things to the interface in commons.

        Randy

> -----Original Message-----
> From: Nicolas PERIDONT [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 02, 2002 10:52 AM
> To: Tomcat-User
> Subject: Principal Cast Exception
>
>
> Hi,
>
> I have make my own Principal class name MyPrincipal that extends from
> java.scurity.Principal
> I make my own Realm and i can log with it.
> But when i get the Principal object whith the
> request.getUserPrincipal()
> method i cant cast this object in (MyPrincipal).
> I get a classCastException when i try to to this
> (MyPrincipal)request.getUserPrincipal().
> But the most strange is that i get a MyPrincipal response when i try a
> request.getUserPrincipal().getclass().getName().
>
> Have some idea why i can't make a cast on it ?
> Does it come from the diference of classLoader between the
> JSP environement
> and the Server environement ?
>
> Thanks in advance for your help
>
> Nicolas PERIDONT
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to