Dear Developers, # I'm new to this list and I'm Japanese. So please forgive me my broken English.
I'm using tomcat 5.5 bundled in JBoss-4.0.3SP1. And I tried using org.apache.catalina.realm.DataSourceRealm for container managed authorization. But it didn't work as I expected. Then I made a workaround, let me report this. I followed an instruction on http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html#DataSourceRealm, it didn't work on my environment, which throws an exception as follows, ------------------------------------------------------------------------- 006-03-22 00:06:12,423 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web]] Exception performing authentication java.lang.NullPointerException at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:401) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java: 282) at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthent icator.java:256) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase .java:391) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java: 59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126 ) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105 ) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav a:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThre ad.java:112) at java.lang.Thread.run(Thread.java:595) ------------------------------------------------------------------------- As I read source codes around DataSourceRealm.java and watched behavior, I found that StandardServer.getGlobalNamingContext() always returns null on my environment. And there're no lines which put any instance of NamingContext into the attribute StandardServer.globalNamingContext as far as I trace a behavior of DataSourceRealm object. I don't know whether this is a bug of the StandardServer object or a bug of cooperation with JBoss. Anyways, I modified DataSourceRealm.open() as follows, ------------------------------------------------------------------------- protected Connection open() { try { Context context = null; if (localDataSource) { context = ContextBindings.getClassLoader(); context = (Context) context.lookup("comp/env"); } else { StandardServer server = (StandardServer) ServerFactory.getServer(); context = server.getGlobalNamingContext(); } //added by hiro from here if( context == null ){ context = new javax.naming.InitialContext(); context = (Context)context.lookup("java:/"); } // added by hiro till here DataSource dataSource = (DataSource)context.lookup(dataSourceName); <<snip..>> ------------------------------------------------------------------------- I think this workaround is not an essential one but it works as I expect. It's my pleasure if this workaround helps you. Sincerely, --igarashi Hiro IGARASHI TEL: +81.3.3595.2900 FAX: +81.3.3595.2903 SimDesk Technologies, Inc. Senior Engineer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]