Chuck- 

Thanks so much. I read that doc some time ago, but I couldn't find it
again (what a dope). I also read right past the "put it in server/lib"
part. I'll try moving the principal class to common and see if that
works.

Thanks, Steve
 
Steve Page 
Contract Systems Analyst/Developer 
BFDP Information Technology 
(317) 818-8685
[EMAIL PROTECTED] 


-----Original Message-----
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 02, 2007 5:46 PM
To: Tomcat Users List
Subject: RE: What is the proper location for custom realm and principle
classes?

> From: Page, Steve C. [mailto:[EMAIL PROTECTED]
> Subject: What is the proper location for custom realm and principle 
> classes?

The doc is pretty clear for both 5.5 and 6.0.  Since you're dealing with
principals, the closest model is the JAAS Realm.

> If I left the classes in WEB-INF/classes, I received a 
> ClassNotFoundException on the realm class.
> If I put the classes in common/classes, I received a 
> ClassNotFoundException on RealmBase, which is in catalina.jar.

As you should, since the doc explicitly states:
"Place your compiled realm in $CATALINA_HOME/server/lib"

> Copying catalina.jar to common/lib (a bad practice)

Agreed that this is a really, really bad idea.  You definitely don't
want to muck around with the location of Tomcat's own classes.

> Moving just the realm class to server/classes led to 
> ClassNotFoundException on the principal class.
> 
> Finally, I moved both classes to system/classes, and Tomcat started 
> successfully.

Again from the doc, discussing where to put the Principal classes:
"Place the compiled classes on Tomcat's classpath"

> However, I then ran into problems between the system classloader and 
> the application class loader both loading the principal class; the 
> classes were not the same and led to cast exceptions.

This means you placed the same class in two different locations, not
just one.  Sounds like you failed to remove it from WEB-INF/classes.

> 1. I have to kludge my application to reproduce logic in my custom 
> principal.

Not necessary if you put the classes where they're documented to go.

> 2. I have to modify server/classes.

Some addition to Tomcat's environment is unavoidable, since you're
extending the capabilities of the server.  If you want Tomcat's server
classloader to look in additional locations, modify the settings in the
conf/catalina.properties file.

By the way, unless you're very careful, you will probably need two
Principal classes, one for users, another for roles.  This is also
mentioned in the doc.
http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html
http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to