Hi, the problem might be because you have forgotten to import certain jar that should contain
SystemUtil class.

From: manoj sinha <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
To: user@struts.apache.org
Subject: Interceptor to Autheticate User
Date: Fri, 16 Feb 2007 06:17:32 -0800 (PST)

Hi,
Wiil appreciate if some one come with Solution!!
I am writing customized Authentication Interceptor.It Checks username & password from database by calling EJBs.
Code is Here:
public class AuthenticationInterceptor extends LoginSupport implements Interceptor {

    public void destroy() {
        }

    public void init() {
        }

public String intercept(ActionInvocation actionInvocation) throws Exception {

        InitialContext jndiContext =SystemUtil.getIntialcontext();
        Object ref = jndiContext.lookup("Login");
        Authentication auth =null;
        Encryption encrypt = new Encryption();
        String encryptPassword = encrypt.encryptString(getPassword());
auth = (Authentication) new AuthenticationFactory().getAuthenticat(Constants.AUTHENTICATION_MODE); Vector loginVector =auth.doAuthenticate(getUsername(),getPassword());


        if(loginVector!=null){
            if(((String)loginVector.elementAt(0)).equals("success")){
            return actionInvocation.invoke();
        }
            return Action.ERROR;
        }
        return Action.INPUT;
    }
    }

Here LoginSupport class contains getter/setter methods.
I hace defined Interceptor Stack that is like
<interceptor name="userAuthentication" class="com.....AuthenticationInterceptor"/>
<interceptor-stack name="login">
              <interceptor-ref name="userAuthentication"/>
              <interceptor-ref name="defaultStack"/>
          </interceptor-stack>
But Error is :
[[default]] Servlet.service() for servlet default threw exception
java.lang.NoClassDefFoundError: com/...../...../util/SystemUtil
at com......AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:26) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200) at org.apache.struts2.impl.StrutsActionProxy$1.call(StrutsActionProxy.java:27) at org.apache.struts2.impl.StrutsActionProxy$1.call(StrutsActionProxy.java:26)
 Will be Obliged if suggestion comes...
Thanks
Manoj


---------------------------------
8:00? 8:25? 8:40?  Find a flick in no time
 with theYahoo! Search movie showtime shortcut.

_________________________________________________________________
Find singles online in your area with MSN Dating and Match.com! http://cp.intl.match.com/eng/msn/msnsg/wbc/wbc.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to