Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

What is the proper location for custom realm and principle classes?

Page, Steve C.

2007-03-02

Replies:

All-

I have this working, but I want to make sure I am following best practices.

I created customer realm and principle classes.

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.

Copying catalina.jar to common/lib (a bad practice), I had logger class problems.

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.

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.

I tried an interface for the principal class in common/classes, but this did not help the situation.

Finally, I just used java.security.Principal in the application, and that worked, but I don't have access to any of the extra features of my principal class. My app functions fine, but I don't like two things:

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

2. I have to modify server/classes.

My question is, what could I do better?

Thanks, Steve

Steve Page
Contract Systems Analyst/Developer
BFDP Information Technology
(317) 818-8685
PageSteve@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.