13 Replies Latest reply on Mar 22, 2008 9:02 PM by msystems

    SeamLoginModule No authentication method defined

    clatimer

      I am trying to build my first SEAM application, and am encountering a frustrating problem.  I have followed the SEAM examples pretty closely, but my authenticate method is not recognized by SEAM.  When I authenticate, I get this message:




      ERROR [SeamLoginModule] No authentication method defined - please define authenticate-method for <security:identity/> in components.xml


      I have written a simple JSF login form that culminates in the commandButton tag:


      <h:commandButton action="#{identity.login}"         value="#{messages.loginSubmitLabel}"/>


      Inside components.xml, I have configured my security:identity like this:


      <security:identity authenticate-method="#{authenticator.authenticate}"/>


      The components.xml is located in the WEB-INF directory of my WAR file.


      I have archived the application's ejb components into their own JAR file.  Note: I do not have any entity beans yet, so I do not have a persistence.xml.


      Here is the source for my authenticator stateless session bean:


      @Stateless
      @Name("authenticator")
      public class AuthenticatorAction implements AuthenticatorActionLocal
      {
          @In Identity identity;
          
          public boolean authenticate()
          {
              System.out.println("authenticating...");
              Identity.instance().addRole("Role1");
              return true;
          }
      }



      My EAR file is structured as follows:


      META-INF
        -application.xml
        -jboss-app.xml
      webapp.war
      ejbapp.jar
      jboss-seam.jar
      



      I would be extremely grateful if someone could help me get over this hurdle. If seeing the contents of other files in my application would be helpful please let me know.  I'll keep trying to solve this one today and post the solution if I find it.


      Chris Latimer

        • 1. Re: SeamLoginModule No authentication method defined
          msystems

          Is seam.properties included in the ejbapp.jar file?

          • 3. Re: SeamLoginModule No authentication method defined
            clatimer

            Kenneth,


            I do have a blank file named seam.properties in the root of my ejb.jar file.


            Chris Latimer

            • 4. Re: SeamLoginModule No authentication method defined
              clatimer

              I just noticed something.  When I deploy the dvd store example from the SEAM distribution, the initialization contains this message:




              [org.jboss.seam.init.Initialization] Namespace: http://jboss.com/products/seam/security, package: org.jboss.seam.security, prefix: org.jboss.seam.security


              However, when I deploy my application, I get this message:




              WARN  [Initialization] namespace declared in components.xml does not resolve to a package annotated @Namespace: http://jboss.com/products/seam/security


              Maybe I'm missing a JAR in my configuration?  I thought they were pretty much in agreement with the dvd example, but looks like I need to double check.  Still trying to get to the bottom of this, if anyone has ideas please let me know.


              Thanks,


              Chris Latimer

              • 5. Re: SeamLoginModule No authentication method defined
                msystems

                Okay, I need some more information, e.g. JBoss AS startup log.

                • 6. Re: SeamLoginModule No authentication method defined
                  msystems

                  Please show me the components.xml content.

                  • 7. Re: SeamLoginModule No authentication method defined
                    msystems

                    What version of Seam are you using?

                    • 8. Re: SeamLoginModule No authentication method defined
                      clatimer

                      Here is the components.xml:


                      <?xml version="1.0" encoding="UTF-8"?>
                      <components xmlns="http://jboss.com/products/seam/components"
                                  xmlns:core="http://jboss.com/products/seam/core"
                                  xmlns:security="http://jboss.com/products/seam/security"
                                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                  xsi:schemaLocation=
                                      "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd 
                                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                                       http://jboss.com/products/seam/components http://joss.com/products/seam/components-2.0.xsd">
                                  
                           <core:init debug="true" jndi-pattern="vsapp/#{ejbName}/local"/>
                           <security:identity authenticate-method="#{authenticator.authenticate}"/>
                           <persistence:managed-persistence-context name="entityManager"
                                                    auto-create="true"
                                             persistence-unit-jndi-name="java:/vestorwebEntityManagerFactory" />
                      </components>
                      



                      Since my original post, I've added a persistence.xml and the peristence: tag to my components.xml to rule that out as the problem.


                      I just realized I had jboss-seam.jar both in my WEB-INF/lib of the WAR as well as in the root of the EAR.  I had written my ant script to exclude the jboss-seam.jar during the war task, but I apparently made a mistake because when I looked inside the WAR, it was still there.  Now when I deploy my application, the namespace resolves appropriately, but I'm getting a:


                      NoClassDefFoundError: org/jboss/el/lang/FunctionMapperImpl
                      



                      even though I have jboss-el.jar in my WEB-INF/lib.  I'm going to need to see what's causing that.  I'm getting this exception when I load my first *.seam url, which is earlier than I was previously getting the message about the authenticate method not being mapped.  So the namespace message has gone away, but I have to figure out this NoClassDefFoundError before I know if that was the root of the problem.  If you see anything incorrect in the components.xml please let me know.


                      Thanks for looking at this.


                      Chris Latimer

                      • 9. Re: SeamLoginModule No authentication method defined
                        clatimer

                        Version 2.0.1.GA on JBoss 4.2.2

                        • 10. Re: SeamLoginModule No authentication method defined
                          msystems

                          You need to include the jboss-el.jar in <ear-file>/lib and not in WEB-INF/lib.

                          • 11. Re: SeamLoginModule No authentication method defined
                            clatimer

                            Scratch that.  I thought I was using version 2.0.1GA, but upon closer examination, I am using 2.1.0.A1.  When I downloaded SEAM, I clicked on version 2.0.1.GA, but SourceForge brings up a list of all versions, with 2.1.0.A1 expanded.  I must have downloaded that version by mistake.  I'm downloading 2.0.1.GA now to see if it makes any difference using that version.


                            Chris Latimer

                            • 12. Re: SeamLoginModule No authentication method defined
                              clatimer

                              You my friend are a genius!!  It works now!!!

                              • 13. Re: SeamLoginModule No authentication method defined
                                msystems

                                Great - and thank you for all the 'stars' :-)