1 Reply Latest reply on Jun 13, 2006 4:50 AM by Hagen Schink

    login-page with <auth-method>FORM</auth-method> and struts

    Hagen Schink Newbie

      Hi, I updated to

      JBoss Eclipse IDE 1.6.0 GA
      JBoss Seam 1.0.0 CR3
      Apache myFaces Core 1.1.3
      Apache myFaces Tomahawk 1.1.2

      and I've got following problem. I want to use a form-login, but when I start my app I got this error-message:

      2006-06-06 10:32:45,512 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/x:/kam.ear
      2006-06-06 10:32:50,589 DEBUG [org.jboss.seam.contexts.Lifecycle]
      Session started
      2006-06-06 10:32:50,649 DEBUG [org.jboss.web.tomcat.tc5.jasper.TagLibCache] Scanning for tlds in: file:/D:/ApplicationServer/jboss-4.0.4.GA/server/default/deploy/jbossweb-tomcat55.sar/jsf-libs/myfaces-impl.jar
      2006-06-06 10:32:50,829 DEBUG [org.jboss.web.tomcat.tc5.jasper.TagLibCache] Scanning for tlds in: file:/D:/ApplicationServer/jboss-4.0.4.GA/server/default/deploy/jbossweb-tomcat55.sar/jsf-libs/tomahawk.jar
      2006-06-06 10:32:51,550 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/amt].[jsp]] Servlet.service() for servlet jsp threw exception
      javax.servlet.jsp.JspException: Can't get definitions factory from context.
       at org.apache.struts.taglib.tiles.InsertTag.processDefinitionName(InsertTag.java:577)
       at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:476)
       at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:438)
       at org.apache.jsp.pages.login.login_jsp._jspx_meth_tiles_insert_0(login_jsp.java:85)
       at org.apache.jsp.pages.login.login_jsp._jspService(login_jsp.java:59)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:315)
       at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:243)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       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:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      2006-06-06 10:32:51,940 WARN [org.apache.catalina.authenticator.FormAuthenticator] Unexpected error forwarding to login page
      org.apache.jasper.JasperException: Exception in JSP: /pages/login/login.jsp:3
      
      1: <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
      2:
      3: <tiles:insert definition="login.tiles"/>
      4:
      
      
      Stacktrace:
       at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:315)
       at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:243)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       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:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      


      Here are my config-files:

      1. web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
       <!-- Tiles -->
       <context-param>
       <param-name>tiles-definitions</param-name>
       <param-value>/WEB-INF/tiles.xml</param-value>
       </context-param>
      
       <!-- Global JNDI name pattern for JBoss EJB3 (change for other servers) -->
       <context-param>
       <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
       <param-value>kam/#{ejbName}/local</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.jboss.seam.core.init.debug</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <!-- security requirement -->
       <security-constraint>
       <web-resource-collection>
       <web-resource-name>AMT</web-resource-name>
       <!-- URL-Filter -->
       <!--url-pattern>/pages/administration/*</url-pattern>
       <url-pattern>/pages/home/*</url-pattern>
       <url-pattern>/pages/requesthandling/*</url-pattern>
       <url-pattern>/pages/tendering/*</url-pattern-->
       <url-pattern>/pages/*</url-pattern>
       </web-resource-collection>
      
       <auth-constraint>
       <role-name>login</role-name>
       </auth-constraint>
      
       <!-- type of data security: NONE, INTERGAL, CONFIDENTIAL -->
       <user-data-constraint>
       <transport-guarantee>CONFIDENTIAL</transport-guarantee>
       </user-data-constraint>
       </security-constraint>
      
       <!-- Authentifizierung -->
       <login-config>
       <auth-method>FORM</auth-method>
       <realm-name>kamEntityManager</realm-name>
       <form-login-config>
       <form-login-page>/pages/login/login.jsp</form-login-page>
       <form-error-page>/pages/login/error.jsp</form-error-page>
       </form-login-config>
       </login-config>
      
       <security-role>
       <description>Authorized to see all webpages</description>
       <role-name>login</role-name>
       </security-role>
      
       <!-- Seam -->
      
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <filter>
       <filter-name>Seam Exception Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Exception Filter</filter-name>
       <url-pattern>*.jsf</url-pattern>
       </filter-mapping>
      
       <context-param>
       <param-name>org.jboss.seam.core.init.myFacesLifecycleBug</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <!-- Seam managed persistence context -->
      
       <context-param>
       <param-name>org.jboss.seam.core.init.managedPersistenceContexts</param-name>
       <param-value>entityManager</param-value>
       </context-param>
      
       <context-param>
       <param-name>entityManager.persistenceUnitJndiName</param-name>
       <param-value>java:/issuesEntityManagerFactory</param-value>
       </context-param>
      
       <!-- 120 second conversation timeout -->
      
       <!--context-param>
       <param-name>org.jboss.seam.core.manager.conversationTimeout</param-name>
       <param-value>120000</param-value>
       </context-param-->
      
       <!-- Tomahawk -->
      
       <filter>
       <filter-name>MyFacesExtensionsFilter</filter-name>
       <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
       <init-param>
       <param-name>maxFileSize</param-name>
       <param-value>20m</param-value>
       <description>Set the size limit for uploaded files.
       Format: 10 - 10 bytes
       10k - 10 KB
       10m - 10 MB
       1g - 1 GB
       </description>
       </init-param>
       </filter>
      
       <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
       <filter-mapping>
       <filter-name>MyFacesExtensionsFilter</filter-name>
       <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
       </filter-mapping>
      
       <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
       <filter-mapping>
       <filter-name>MyFacesExtensionsFilter</filter-name>
       <url-pattern>*.jsf</url-pattern>
       </filter-mapping>
      
       <!-- Welcome files -->
       <welcome-file-list>
       <welcome-file>index.jsp</welcome-file>
       </welcome-file-list>
      
       <!-- MyFaces -->
      
       <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
       </listener>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
       <param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.jsp</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
      </web-app>
      


      2. login-service.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <server>
       <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
       name="kam:service=DynamicLoginConfig">
       <attribute name="AuthConfig">kam-login-config.xml</attribute>
       <depends optional-attribute-name="LoginConfigService">
       jboss.security:service=XMLLoginConfig
       </depends>
       <depends optional-attribute-name="SecurityManagerService">
       jboss.security:service=JaasSecurityManager
       </depends>
       </mbean>
      </server>
      


      3. login-config.xml

      <?xml version='1.0'?>
      <!DOCTYPE policy PUBLIC
       "-//JBoss//DTD JBOSS Security Config 3.0//EN"
       "http://www.jboss.org/j2ee/dtd/security_config.dtd">
      <policy>
       <application-policy name="kamEntityManager">
       <authentication>
       <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
       flag="required">
      
       <module-option name="unauthenticatedIdentity">guest</module-option>
       <module-option name="dsJndiName">java:/KAMDS</module-option>
       <module-option name="principalsQuery">
       select password from userdata where username=?
       </module-option>
       <module-option name="rolesQuery">
       <!-- select userRoles, 'Roles' from userRoles where username=? -->
       select privshortname,'Roles' from userdata,groups,groups_privileges,privileges where userdata.username=? and userdata.fk_groupid=groups.groupid and groups.groupid=groups_privileges.groups_groupid and groups_privileges.privileges_privid=privileges.privid
       </module-option>
       <module-option name="hashAlgorithm">MD5</module-option>
       <module-option name="hashEncoding">BASE64</module-option>
       </login-module>
       </authentication>
       </application-policy>
      </policy>
      


      When I change the config to basic-login it works fine. I think it's a simple config error but I can't find any solution in the web.

        • 1. Re: login-page with <auth-method>FORM</auth-method> and stru
          Hagen Schink Newbie

          Ok, now I've solved the problem. There were several mistakes in my web.xml, so it couldn't work.

          Here are the important changes in my web.xml:

          <login-config>
           <auth-method>FORM</auth-method>
           <realm-name>kamEntityManager</realm-name>
           <form-login-config>
           <form-login-page>/pages/login/login.jsf</form-login-page>
           <form-error-page>/pages/login/error.jsf</form-error-page>
           </form-login-config>
           </login-config>
          
           <security-role>
           <description>Authorized to see all webpages</description>
           <role-name>login</role-name>
           </security-role>
          


          and

          <context-param>
           <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
           <param-value>false</param-value>
           </context-param>
          


          If somebody can't follow my solution I'll post the whole web.xml.