Hi all,

I have a custom Realm implementation that extends org.apache.catalina.realm.RealmBase. It used to work in 4.x, but in 5.0.16, I'm getting the following exception on startup:

21:17:29,719 ERROR RealmBase:1092 - Can't register null
java.lang.NullPointerException
at org.apache.catalina.realm.RealmBase.init(RealmBase.java:1088)
at org.apache.catalina.realm.RealmBase.start(RealmBase.java:769)
at org.pharmgen.webapp.tomcat.PharmGenRealmAdapter.setRealm(PharmGenRealmAdapter.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.securityfilter.config.SecurityConfig.addRealm(SecurityConfig.java:216)
[snip]



I've taken a look at the source, and as far as I can tell, it's because the container is null. What is responsible for providing the Realm the container it's in? Is there some new bit of configuration I need to do in Tomcat 5? I'm also surprised that there's this bit of code in RealmBase.init():


if( container== null ) {
// do some stuff, and don't set container or oname
}
if( oname==null ) {
try {
ContainerBase cb=(ContainerBase)container;
// >>> NPE HAPPENS HERE <<<
oname=new ObjectName(cb.getDomain()+":type=Realm" + cb.getContainerSuffix());
// some other stuff
} catch (Throwable e) {
log.error( "Can't register " + oname, e);
}
}


I don't have any experience with JMX, so maybe it's doing something behind the scenes, but if not, that bit of code looks wrong. While this seems to be an error that can be safely ignored if I'm not using JMX, it's still a little distressing.

Any help would be appreciated.

Thanks,
-Mark




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to