0 Replies Latest reply: Nov 27, 2008 11:58 AM by Matthias Hueller RSS

    Security roles in jboss-web.xml and web.xml

    Matthias Hueller Novice

      Hi,

      when trying to deploy my EAR file at JBoss 4.2.1 (Java 1.6) I'm getting following exception:

      Failed to parse WEB-INF/jboss-web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: Security role 'userpreferencesservicerole' defined in jboss-web.xml is not defined in web.xml)

      However, the security role "userpreferencesservicerole" is defined in both jboss-web.xml AND web.xml, so what is going wrong here?

      jboss-web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      <jboss-web>
       <security-role>
       <role-name>userpreferencesservicerole</role-name>
       <principal-name>UserPreferencesServiceUsers</principal-name>
       </security-role>
      
       <context-root></context-root>
       <security-domain>java:/jaas/postboxjaas</security-domain>
      </jboss-web>


      web.xml
      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
       <display-name>UserPreferencesService</display-name>
       <session-config>
       <session-timeout>60</session-timeout>
       </session-config>
       <security-constraint>
       <web-resource-collection>
       <web-resource-name>UserPreferencesService</web-resource-name>
       <url-pattern>/UserPreferencesService/*</url-pattern>
       <http-method>GET</http-method>
       <http-method>POST</http-method>
       </web-resource-collection>
       <auth-constraint>
       <role-name>userpreferencesservicerole</role-name>
       </auth-constraint>
       <user-data-constraint>
       <transport-guarantee>NONE</transport-guarantee>
       </user-data-constraint>
       </security-constraint>
       <login-config>
       <auth-method>BASIC</auth-method>
       </login-config>
       <security-role>
       <role-name>userpreferencesservicerole</role-name>
       </security-role>
      </web-app>


      Exception stacktrace
      org.jboss.deployment.DeploymentException: Failed to parse WEB-INF/jboss-web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: Security role 'userpreferencesservicerole' defined in jboss-web.xml is not defined in web.xml)
       at org.jboss.web.AbstractWebContainer.parseMetaData(AbstractWebContainer.java:768)
       at org.jboss.web.AbstractWebContainer.init(AbstractWebContainer.java:356)
       at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
       at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
       at org.jboss.deployment.SubDeployerInterceptorSupport.init(SubDeployerInterceptorSupport.java:119)
       at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.init(SubDeployerInterceptorSupport.java:172)
       at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:87)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy45.init(Unknown Source)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:872)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:895)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:809)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
       at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy9.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
      Caused by: org.jboss.deployment.DeploymentException: Security role 'userpreferencesservicerole' defined in jboss-web.xml is not defined in web.xml
       at org.jboss.metadata.WebMetaData.importJBossWebXml(WebMetaData.java:1091)
       at org.jboss.metadata.WebMetaData.importXml(WebMetaData.java:770)
       at org.jboss.web.AbstractWebContainer.parseMetaData(AbstractWebContainer.java:763)
       ... 41 more


      Thank you very much!!!!

      altes-kind