1 Reply Latest reply on Nov 13, 2002 1:02 PM by Adrian Brock

    URLClassLoader3 not finding/loading users/roles.properties

    pranab Newbie

      Hi,
      I am trying to use an unsecured servlet do an explicit LoginContext.login() and then call a secured Stateless Session Bean. Same as the ClientLoginServlet.java example in Jboss source Code. I am using UsersRolesLoginModule to perform the authentication. I have included the user/roles.properties in WEB-INF/classes path so they can be loaded by the classloader.The WebApp login scenario where a secured servlet calling a secured Bean works OK.
      When JAAS LoginContext.login() is called from an unsecured servlet the WebAppClassLoader from Catalina is able to find the resource files. After that I proceed to call the Session Bean expecting the SecurityAssociation to be complete after the successful login.
      When the SecurityInterceptors try authenticate and in that process use the UserRolesLoginModule to load the property files.The Classloader in use is shown in this debug stack trace below.
      The URLClassLoader returns Null for the requested resource.and also adds the null URL to the cache for future searches. The server log file show the exception log about missing property files.
      I think the UnifiedClassLoader3 should be able to find the property files.I would like to know if my assumption is right or wrong.

      Thread [HttpProcessor[8080][2]] (Suspended)
      org.jboss.mx.loading.UnifiedClassLoader3(org.jboss.mx.loading.UnifiedClassLoader).getResourceLocally(java.lang.String) line: 255
      org.jboss.mx.loading.UnifiedLoaderRepository3.getResourceFromClassLoader(java.lang.String, java.lang.ClassLoader) line: 319
      org.jboss.mx.loading.UnifiedLoaderRepository3.getResource(java.lang.String, java.lang.ClassLoader) line: 276
      org.jboss.mx.loading.LoadMgr.getResource(java.lang.String, org.jboss.mx.loading.UnifiedClassLoader3, org.jboss.mx.loading.UnifiedLoaderRepository3) line: 307
      org.jboss.mx.loading.UnifiedClassLoader3.getResource(java.lang.String) line: 201
      org.jboss.web.WebClassLoader(java.lang.ClassLoader).getResource(java.lang.String) line: 782 [local variables unavailable]
      java.net.URLClassLoader(java.lang.ClassLoader).getResource(java.lang.String) line: 782 [local variables unavailable]
      org.jboss.security.auth.spi.UsersRolesLoginModule.loadProperties(java.lang.String) line: 210
      org.jboss.security.auth.spi.UsersRolesLoginModule.loadUsers() line: 193
      org.jboss.security.auth.spi.UsersRolesLoginModule.initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map) line: 95
      sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) line: not available [native method]
      sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 39 [local variables unavailable]
      sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 25 [local variables unavailable]
      java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) line: 324 [local variables unavailable]
      javax.security.auth.login.LoginContext.invoke(java.lang.String) line: 651 [local variables unavailable]
      javax.security.auth.login.LoginContext.access$000(javax.security.auth.login.LoginContext, java.lang.String) line: 129 [local variables unavailable]
      javax.security.auth.login.LoginContext$4.run() line: 599 [local variables unavailable]
      java.security.AccessController.doPrivileged(java.security.PrivilegedExceptionAction) line: not available [native method]
      javax.security.auth.login.LoginContext.invokeModule(java.lang.String) line: 596 [local variables unavailable]
      javax.security.auth.login.LoginContext.login() line: 523 [local variables unavailable]
      org.jboss.security.plugins.JaasSecurityManager.defaultLogin(java.security.Principal, java.lang.Object) line: 436
      org.jboss.security.plugins.JaasSecurityManager.authenticate(java.security.Principal, java.lang.Object) line: 402
      org.jboss.security.plugins.JaasSecurityManager.isValid(java.security.Principal, java.lang.Object, javax.security.auth.Subject) line: 229
      org.jboss.security.plugins.JaasSecurityManager.isValid(java.security.Principal, java.lang.Object) line: 204
      org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(org.jboss.invocation.Invocation) line: 169
      org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(org.jboss.invocation.Invocation) line: 94
      org.jboss.ejb.plugins.LogInterceptor.invokeHome(org.jboss.invocation.Invocation) line: 129
      org.jboss.ejb.StatelessSessionContainer.invokeHome(org.jboss.invocation.Invocation) line: 300
      org.jboss.ejb.StatelessSessionContainer(org.jboss.ejb.Container).invoke(java.lang.String, java.lang.Object[], java.lang.String[]) line: 730
      org.jboss.mx.server.MBeanServerImpl.invoke(javax.management.ObjectName, java.lang.String, java.lang.Object[], java.lang.String[]) line: 517
      org.jboss.invocation.local.LocalInvoker.invoke(org.jboss.invocation.Invocation) line: 98
      org.jboss.invocation.InvokerInterceptor.invoke(org.jboss.invocation.Invocation) line: 102
      org.jboss.proxy.TransactionInterceptor.invoke(org.jboss.invocation.Invocation) line: 77
      org.jboss.proxy.SecurityInterceptor.invoke(org.jboss.invocation.Invocation) line: 80
      org.jboss.proxy.ejb.HomeInterceptor.invoke(org.jboss.invocation.Invocation) line: 198
      org.jboss.proxy.ClientContainer.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) line: 76
      $Proxy54.create() line: not available [local variables unavailable]
      com.ids.delegates.InstanceConfigSvcDelegate.() line: 53
      com.ids.servlet.common.idsconfServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 178
      com.ids.servlet.common.idsconfServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 740
      com.ids.servlet.common.idsconfServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 853
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 247
      org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 193
      org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 260
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 643
      org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 480
      org.apache.catalina.core.StandardWrapper(org.apache.catalina.core.ContainerBase).invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 995
      org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 191
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 643
      org.apache.catalina.authenticator.FormAuthenticator(org.apache.catalina.authenticator.AuthenticatorBase).invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 471
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 641
      org.apache.catalina.valves.CertificatesValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 246
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 641
      org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 480
      org.apache.catalina.core.StandardContext(org.apache.catalina.core.ContainerBase).invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 995
      org.apache.catalina.core.StandardContext.invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 2396
      org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 180
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 643
      org.apache.catalina.valves.ErrorDispatcherValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 170
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 641
      org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 172
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 641
      org.apache.catalina.valves.AccessLogValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 469
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 641
      org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 480
      org.apache.catalina.core.StandardHost(org.apache.catalina.core.ContainerBase).invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 995
      org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) line: 174
      org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) line: 643
      org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 480
      org.apache.catalina.core.StandardEngine(org.apache.catalina.core.ContainerBase).invoke(org.apache.catalina.Request, org.apache.catalina.Response) line: 995
      org.apache.catalina.connector.http.HttpProcessor.process(java.net.Socket) line: 1040
      org.apache.catalina.connector.http.HttpProcessor.run() line: 1151
      java.lang.Thread.run() line: 536 [local variables unavailable]

      Exception Log
      00:17:51,447 ERROR [UsersRolesLoginModule] Failed to load users/passwords/role files
      java.io.IOException: Properties file users.properties not found
      at org.jboss.security.auth.spi.UsersRolesLoginModule.loadProperties(UsersRolesLoginModule.java:212
      at org.jboss.security.auth.spi.UsersRolesLoginModule.loadUsers(UsersRolesLoginModule.java:193)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.initialize(UsersRolesLoginModule.java:95)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      Any leads is appreciated.

      Regards,

      Pranab