Mark Woon wrote:
> 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); > } > }
How are you adding your realm? It seems the code under container==null
should be executed when the realm is added via JMX using full object
name only. It's using its own object name to figure out its container
and calls setRealm to its container.
I'm not sure what you mean by "adding your realm" exactly, but I just defined it in server.xml. I've tried putting the <Realm> element as a child of <Engine>, <Host> and <Context>, and all have produced the same exception.
When oname==null, the realm should already have its container...
Exactly. What is responsible for providing the container to the Realm?
-Mark