5 Replies Latest reply on Mar 5, 2007 1:36 AM by y_zl

    Upgrading from 1.1.5 to 1.2

    nekstrom

      Is there a list of what changes need to be made in the security configuration when upgrading from 1.1.5 to 1.2? I tried to just do a library upgrade using seam-gen but when I tried to use my Authenticator it threw an error saying that it couldn't find the function. The stack trace is:

      23:53:43,396 ERROR [SeamLoginModule] Error invoking login method
      javax.faces.el.EvaluationException: Exception while invoking expression #{authenticator.authenticate}
      at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:165)
      at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
      at
      ...
      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(Thread.java:619)
      Caused by: java.lang.NoSuchMethodException: edu.byu.cs.csl.dogma.server.Authenticator$$EnhancerByCGLIB$$f577284d.authenticate()
      at java.lang.Class.getMethod(Class.java:1605)
      at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:118)
      ... 58 more

      I remember seeing that there were some API changes between 1.5 and 1.6 but I didn't have the time to figure them out and now I can't find what they are. Thanks for you help. Also thanks for a great system. Any idea of when WS will be integrated?

      --nathan


        • 1. Re: Upgrading from 1.1.5 to 1.2
          shane.bryzak

          The new authenticate method should not accept any parameters. Instead it can read the username/password from Identity (identity.getUsername() etc) and add roles via the identity api also (identity.addRole("admin")).

          • 2. Re: Upgrading from 1.1.5 to 1.2
            nekstrom

            Thanks for your help. I changed that function to be correct but I still get that error. Any ideas? Are there compatability issues with using Java 6.0? I think the jars are all compiled with 5.0. My program is compiled with 6.0. I don't think it should be an issue but if some one knows different let me know.

            • 3. Re: Upgrading from 1.1.5 to 1.2
              nekstrom

              Here is my Authenticator Class:

              package edu.byu.cs.csl.dogma.server;
              
              import java.util.List;
              import java.util.Set;
              
              import javax.persistence.EntityManager;
              
              import org.jboss.seam.annotations.In;
              import org.jboss.seam.annotations.Logger;
              import org.jboss.seam.annotations.Name;
              import org.jboss.seam.log.Log;
              import org.jboss.seam.security.Identity;
              
              import edu.byu.cs.csl.dogma.server.model.Permission;
              import edu.byu.cs.csl.dogma.server.model.Users;
              
              @Name("authenticator")
              public class Authenticator {
               @Logger
               private Log log;
              
               @In(value="entityManager") EntityManager em;
              
               @SuppressWarnings("unchecked")
               public boolean authenticate() {
               log.info("authenticating #0", Identity.instance().getUsername());
               if(em == null){log.error("Could not authenticate because EntityManager null."); return false;}
               List<Users> users = em.createQuery("select u from Users u where username=:username and password=:password")
               .setParameter("username", Identity.instance().getUsername())
               .setParameter("password", Identity.instance().getPassword())
               .getResultList();
               if(users.size() == 0) {
               return false;
               } else {
               Users user = users.get(0);
               Set<Permission> permissions = user.getPermissions();
               for(Permission perm: permissions) {
               Identity.instance().addRole(perm.getDescription());
               }
               }
               return true;
               }
              }
              

              And here is my 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:drools="http://jboss.com/products/seam/drools"
               xmlns:security="http://jboss.com/products/seam/security"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
               http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.2.xsd
               http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd
               http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
              
               <core:init debug="true" jndi-pattern="@jndiPattern@" />
              
               <core:manager concurrent-request-timeout="500"
               conversation-timeout="120000" conversation-id-parameter="cid"
               conversation-is-long-running-parameter="clr" />
              
               <core:pages no-conversation-view-id="/home.xhtml" />
              
               <core:managed-persistence-context name="entityManager"
               auto-create="true"
               persistence-unit-jndi-name="java:/dogma-serverEntityManagerFactory" />
              
               <!-- <core:ejb installed="@embeddedEjb@"/> -->
              
               <drools:rule-base name="securityRules">
               <drools:rule-files>
               <value>/security.drl</value>
               </drools:rule-files>
               </drools:rule-base>
              
               <security:identity
               authenticate-method="#{authenticator.authenticate}" />
              
               <!-- For use with jBPM pageflow or process management -->
               <!--
               <core:jbpm>
               <core:process-definitions></core:process-definitions>
               <core:pageflow-definitions></core:pageflow-definitions>
               </core:jbpm>
               -->
              
              </components>
              

              Does any one see something wrong? I recompiled the Seam jars with java 6 and am now using them so that isn't the issue. Were there configuration file changes that would account for this?


              • 4. Re: Upgrading from 1.1.5 to 1.2
                shane.bryzak

                I use Java 6.0 and have no issues. Looking at your code it all seems fine, so I'm not sure what's causing the exception. All I can suggest is you compare your files with the Seam examples, which definitely all work.

                • 5. Re: Upgrading from 1.1.5 to 1.2
                  y_zl

                  I also got the exception.



                  
                  javax.faces.el.EvaluationException: Exception while invoking expression #{authenticator.authenticate}
                   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:165)
                   at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
                   at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
                   at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:106)
                   at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:104)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
                   at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
                   at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
                   at java.security.AccessController.doPrivileged(Native Method)
                   at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
                   at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
                   at org.jboss.seam.security.Identity.authenticate(Identity.java:249)
                   at org.jboss.seam.security.Identity.authenticate(Identity.java:242)
                   at org.jboss.seam.security.Identity.login(Identity.java:172)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
                   at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
                   at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                   at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
                   at javax.faces.component.UICommand.broadcast(UICommand.java:106)
                   at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
                   at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
                   at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
                   at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
                   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:53)
                   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                   at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                   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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                   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(Thread.java:595)
                  Caused by: javax.faces.el.PropertyNotFoundException: Base is null: authenticator
                   at org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:460)
                   at org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindingImpl.java:180)
                   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:114)
                   ... 63 more