Re: troubles using JAASRealm with SecurityFilter
Christopher Schultz <chris-Nf+wZpSdgwfUvtVhod0YCwZWvwf/[email protected]> Wed, 30 Jul 2008 16:10:59 -0400
| Newsgroups | gmane.comp.java.securityfilter.user |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============1679922593== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCF76172421EFA1E9E897F544" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCF76172421EFA1E9E897F544 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Matthew, Matthew Hixson wrote: > I have a webapp running in Tomcat 6.0.16 [...] > I have added the servlet and servlet-mapping to my web.xml and =20 > moved all of the security related stuff from web.xml into =20 > securityfilter-config.xml. Here's a trimmed down version of that file.= Your sf.xml looks good. > <realm =20 > className=3D"org.securityfilter.realm.catalina.CatalinaRealmAdapter" />= >=20 > <realm className=3D"org.apache.catalina.realm.JAASRealm"> > <realm-param name=3D"appName" value=3D"MyCustomLoginModule"/> > <realm-param name=3D"userClassNames" =20 > value=3D"com.company.authentication.User"/> > <realm-param name=3D"roleClassNames" =20 > value=3D"com.company.authentication.Role"/> > </realm> >=20 > Right when I start up Tomcat I get the following exception. Anyone =20 > know what I'm doing wrong or know of a workaround? [snip] > java.lang.NullPointerException > at org.apache.catalina.realm.RealmBase.init(RealmBase.java:1370) > at org.apache.catalina.realm.RealmBase.start(RealmBase.java:1034) > at org.apache.catalina.realm.JAASRealm.start(JAASRealm.java:549) The first time I used sf, I found the same problem: you have to put=20 catalina.jar into your webapp's lib directory in order to make the Realm = classes available to your application, but then RealmBase (and other=20 classes) come from your webapp's ClassLoader instead of Tomcat's=20 ClassLoader. Since your JAASRealm is not being properly configured by Tomcat (because = sf instantiates it for you), you get a RealmBase object with no=20 associated Container, which causes the NPE. In my case, I just wrote my own DataSourceRealm from scratch and threw=20 out Tomcat's implementation altogether. With JAASRealm, I suppose that=20 could be kind of a pain in the neck. Did you put catalina.jar into your webapp's WEB-INF/lib directory? IF=20 so, try removing it and seeing if that works. I haven't worked with=20 Tomcat 6.x, yet, but I think they unified the container lib directories=20 and so loading JAASRealm from the container's ClassLoader might make a=20 difference. If you get a ClassNotFoundException when you do that, let me know where=20 catalina.jar lives in the Tomcat distribution. Sorry.. .I don't have a ton of knowledge about the way Tomcat Realms=20 plug into sf. I'll have to look into that some more. -chris --------------enigCF76172421EFA1E9E897F544 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkiQytMACgkQ9CaO5/Lv0PBiQQCfZ5qnkpH3o4QU8kqtN7coagon mlwAoLKnVtz+WQ5klh9Zh9ri/qulqlgq =8Oyq -----END PGP SIGNATURE----- --------------enigCF76172421EFA1E9E897F544-- --===============1679922593== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ --===============1679922593== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ securityfilter-user mailing list securityfilter-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/securityfilter-user --===============1679922593==--