directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Possible NPE when shutting down server??
Date Thu, 19 Jul 2007 18:32:15 GMT
I'm trying to resuscitate and update the geronimo-apacheds  
integration and have run into some behavior I don't understand.  Due  
to lack of internet access when I started I'm using up to date trunk  
with my xbean-spring mods, but they don't affect this situation  
compared to regular trunk.

In a unit test I'm starting the server with

new InitialDirectoryContext(env); which appears to be working ok

and stopping it with

new InitialDirectoryContext(env) from a shutdown config which is  
getting an NPE which seems less than appropriate.

The code gets into AbstractContextFactory.getInitialContext and on  
line 115 the server is shut down setting the  
DefaultDirectoryService.startupConfiguration to null, as seems  
appropriate.

Then on line 146 of AbstractContextFactory we call  
service.getJndiContext which first does this:

         checkSecuritySettings( principal, credential, authentication );

         if ( !started )
         {
             return new DeadContext();
         }

and checkSecuritySettings uses startupConfiguration on line 437, thus  
throwing the NPE.

So, this doesn't seem quite right to me.

1. The server has already been shut down by the time we are trying to  
get the context, so either returning a DeadContext() from  
AbstractContextFactory after shutting down the server or from  
DefaultDirectoryService.getJndiContext before checking the security  
settings seems reasonable.  This would fix my immediate problem

2.  Why is DefaultDirectoryService checking security settings at  
all?  It's not checking authentication or authorization, just doing  
some minimal consistency checks, so why not rely on whatever is  
checking those?  This seems to me like a big separation of concerns  
problem.

3. Have I missed something or is the usual way to start and stop the  
server through these new IniitialDirectoryContext() calls?  Is there  
a reason it isn't started more directly through spring?  I don't see  
how your'e going to fire up a new jvm through a new  
InitialDirectoryContext() call, so starting a server is in vm anyway,  
and allowing remote stopping seems.... like something you might not  
want to make too easy.

thanks
david jencks

Mime
View raw message