You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Ganyo <sc...@etapestry.com> on 2001/12/04 23:06:41 UTC

Custom Realm & ClassLoader issues?

Hi all,

I've written a custom Realm that I'm attempting to use for
authentication under Tomcat 4.0.  Within that class I'm using JavaSpaces
to do the messaging to the authentication service that I wrote.  Each
piece works independantly, but together they are failing.  What happens
is this:

1. Realm: Posts authentication Message to Space.
2. Auth Service: Retrieves Message, performs authentication
3. Auth Service: Posts auth response Message to Space
4. Realm: Retrieves Message

The trouble is that at the point when the Realm retrieves the Entry from
the Space (4), I get a ClassCastException when I attempt to cast it to a
Message.  I know it is a Message, though, as I can print it out and
verify it.  Thus, it seems like it is a ClassLoader issue...?

BTW: I put all Jini jars in the server/lib and my classes in the
server/classes directory so that my Realm has access to the appropriate
classes.  Would this be related?  Is there a better way?

Thanks for any suggestions,

Scott



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Custom Realm & ClassLoader issues?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On 4 Dec 2001, Scott Ganyo wrote:

> Date: 04 Dec 2001 17:06:41 -0500
> From: Scott Ganyo <sc...@etapestry.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Custom Realm & ClassLoader issues?
>
> Hi all,
>
> I've written a custom Realm that I'm attempting to use for
> authentication under Tomcat 4.0.  Within that class I'm using JavaSpaces
> to do the messaging to the authentication service that I wrote.  Each
> piece works independantly, but together they are failing.  What happens
> is this:
>
> 1. Realm: Posts authentication Message to Space.
> 2. Auth Service: Retrieves Message, performs authentication
> 3. Auth Service: Posts auth response Message to Space
> 4. Realm: Retrieves Message
>
> The trouble is that at the point when the Realm retrieves the Entry from
> the Space (4), I get a ClassCastException when I attempt to cast it to a
> Message.  I know it is a Message, though, as I can print it out and
> verify it.  Thus, it seems like it is a ClassLoader issue...?
>

I don't know JavaSpaces at all, but I've seen similar things happen with
RMI programming when you did not have ALL the Jar files you need in the
right class path.  Can you write a stand-alone Java application that
simulates what the Realm does, and have it work correctly?  If so, the
classpath required to make it work might give you some hints about what
has to go into server/lib.

> BTW: I put all Jini jars in the server/lib and my classes in the
> server/classes directory so that my Realm has access to the appropriate
> classes.  Would this be related?  Is there a better way?
>
That's the right way to do things.  (You could also JAR your files from
server/classes into a JAR file in server/lib, but that is essentially
equivalent.)

> Thanks for any suggestions,
>
> Scott
>

Craig


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>