tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Tedone" <>
Subject Problems with custom Realm and class loading (long)
Date Tue, 24 Jan 2006 12:25:15 GMT
Hi, I hope someone will help with this. 

I'm running Tomcat 5.5 on the front-end and Jboss 4.0.3 in the back end,
running with Java 5.

We designed our security module, so I wrote a custom Realm by extending
RealmBase. I put the Realm under server/lib. The realm uses a Business
Delegate, which in turn uses a Service Locator to get the reference to a
remote EJB home interface. Since the Business Delegates and Service
Locator are in common utility libraries, I had to put also those under
server/lib, otherwise at startup Tomcat said it couldn't find the
classes the Realm was dependent on. The realm started fine and I must seemed to work fine.

Until the delegate performs a PortableRemoteObject.narrow() on the EJB
remote home proxy received by Jboss (Please note! The lookup on Jboss
from the Service Locator goes fine, it returns a proxy). Here I get a

Now the funny part.

I applied the custom Realm also the the Tomcat admin application, which
you know is deployed under server. The same Realm, the same Service
Locator and Delegates this time work fine, the EJB remote home is
narrowed without problems and I can create a Session Bean component

The same classes containing Service Locator and Business Delegates are
deployed also within our web apps, in the WEB-INF/lib folder. So we have
got those classes under server/lib and under the WEB-INF/lib of all our
web apps.

I suspect that there may be a classloading issues. But I can't move the
realm classes in the shared/lib folder, since Tomcat complains at
startup that the realm classes must be in the server/lib folder, so the
same classes must be deployed under server/lib and WEB-INF/lib (or
shared/lib) of our web apps.

How could I solve this problem? Why does the admin app run fine, whereas
(note that the realm gets invoked for our web-apps, it's the service
locator which generates the ClassCastException) another web-app (under
the /webapps folder) doesn't? Is there a way to tell Tomcat that the
Realm classes should be searched in another folder than server/lib?
(This way I could put the classes in shared/lib and probably I could
solve the problem).

Thank you for any help.

Marco Tedone

Amplefuture Ltd, 

Amplefuture House, The Quadrant, 135 Salusbury Road, London NW6 6RJ

Switchboard 0870 333 0 777 


The contents of this e-mail are for the named addressee only. It contains information which
may be confidential and which may also be privileged. If you are not the named addressee of
this e-mail, you may not copy or use it, or forward or otherwise disclose it to anyone else.
If you have received this e-mail in error, please e-mail the sender by replying to this message
and then fully delete it from your system. 

Anything in this e-mail, which does not relate to the official business of Amplefuture Group,
is neither given nor endorsed by the Group. Any views or opinions presented are solely those
of the author and do not necessarily represent those of the Group.

E-mails are not secure and cannot be guaranteed to be error free as they may be intercepted,
amended, lost, destroyed or they may contain viruses. Anyone who communicates with us by e-mail
is taken to accept these risks. Amplefuture Group reserves the right to monitor e-mail communications
from both external and internal sources for the purposes of ensuring correct and appropriate
use of our communication equipment.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message