how to make join between "JAR file and JSF"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • isra123
    New Member
    • Dec 2008
    • 5

    how to make join between "JAR file and JSF"

    Dear All,

    Hope every one is feeling good, and happy new year .

    Can any one help me on this?
    I built an Alfreasco code and it works on eclipse, now on eclipse I made in the "main class" username and password (desktop application) and when I send the username and password it returns true , but on web Application when I take tha Jar file and use JSF code on netbeans and then enter the username and password it gives me an error like this:

    Null pointer exception :
    on Get Authuntication error
    and on Registry service

    So How I mada a "login page on jsf and connect it to the jar file?
  • isra123
    New Member
    • Dec 2008
    • 5

    #2
    Originally posted by isra123
    Dear All,

    Hope every one is feeling good, and happy new year .

    Can any one help me on this?
    I built an Alfreasco code and it works on eclipse, now on eclipse I made in the "main class" username and password (desktop application) and when I send the username and password it returns true , but on web Application when I take tha Jar file and use JSF code on netbeans and then enter the username and password it gives me an error like this:

    Null pointer exception :
    on Get Authuntication error
    and on Registry service

    So How I mada a "login page on jsf and connect it to the jar file?
    ah by the way the error I got is:

    og4j:WARN No appenders could be found for logger (org.apache.com mons.digester.D igester.sax). log4j:WARN Please initialize the log4j system properly. Dec 31, 2008 1:43:57 PM org.apache.cata lina.core.Stand ardContext start INFO: Container org.apache.cata lina.core.Conta inerBase.[Catalina].[localhost].[/Login] has already been started java.lang.NullP ointerException at CRC.AlfrescoSer vices.getServic eRegistry(Alfre scoServices.jav a:52) at CRC.AlfrescoSer vices.getAuthen ticationService (AlfrescoServic es.java:36) at CRC.AlfUserServ ices.login(AlfU serServices.jav a:28) at CRC.CrcLogin.Ch eck_Valid


    **************
    This is the my code which has the problem :
    package CRC;
    import java.io.Seriali zable;
    import java.beans.Even tHandler;
    import java.util.Date;
    import javax.faces.con text.FacesConte xt;
    import javax.servlet.h ttp.HttpSession ;
    /*
    * CrcLogin.java
    *
    * Created on November 30, 2008, 12:30 PM
    *
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    */

    /**
    *
    * @author SPAREWNMAN
    */
    public class CrcLogin {

    /** Creates a new instance of CrcLogin */
    public CrcLogin() {
    }

    private String UserName;
    private String PassWord;

    public String Check_Validate( )
    {

    AlfUserServices alfUserServices =new AlfUserServices ();

    System.out.prin tln(alfUserServ ices.login(getU serName(),getPa ssWord()));

    System.out.prin tln(getUserName ()+" : "+getPassWord() );
    FacesContext context =FacesContext.g etCurrentInstan ce();
    HttpSession session=(HttpSe ssion) context.getExte rnalContext().g etSession(true) ;
    System.out.prin tln(session);

    System.out.prin tln(UserName + " has logged in at " + new Date());

    System.out.prin tln(alfUserServ ices.login(getU serName(),getPa ssWord()));
    return"success" ;
    }







    /*else
    System.out.prin tln(getUserName ()+" : "+getPassWord() );
    System.out.prin tln("Invalide User");

    return"failed"; */



    public String getUserName() {
    return UserName;
    }

    public void setUserName(Str ing UserName) {
    this.UserName = UserName;
    }

    public void setPassWord(Str ing PassWord) {
    this.PassWord = PassWord;
    }

    public String getPassWord() {
    return PassWord;
    }
    }
    =============== =============== =============== =============== =============== =============== ===
    =============== =============== =============== =============== =============== =============== ===


    package CRC;

    import org.springframe work.beans.Bean sException;
    import org.springframe work.context.Ap plicationContex t;
    import org.springframe work.context.Ap plicationContex tAware;

    /**
    *
    * @author SPAREWNMAN
    */


    public class ContextAwareCla ss implements ApplicationCont extAware {

    private static ApplicationCont ext ctx;

    public void setApplicationC ontext(Applicat ionContext applicationCont ext)
    throws BeansException {
    ctx = applicationCont ext;
    }

    public static void displayAppConte xt() {
    System.out.prin tln(ctx);
    }

    public static ApplicationCont ext getAppContext() {
    return ctx;

    }




    /** Creates a new instance of ContextAwareCla ss */
    public ContextAwareCla ss() {
    }

    }

    =============== =============== =============== =============== =============== =============== ===
    =============== =============== =============== =============== =============== =============== ===



    package CRC;

    import org.alfresco.se rvice.ServiceRe gistry;
    import org.alfresco.se rvice.cmr.secur ity.Authenticat ionService;
    import org.springframe work.context.Ap plicationContex t;


    /**
    *
    * @author SPAREWNMAN
    */
    public class AlfrescoService s {

    private ServiceRegistry serviceRegistry ;
    private AuthenticationS ervice authenticationS ervice;
    /** Creates a new instance of AlfrescoService s */
    public AlfrescoService s() {
    }

    protected void setAuthenticati onService(
    AuthenticationS ervice authenticationS ervice) {
    this.authentica tionService = authenticationS ervice;
    }

    protected AuthenticationS ervice getAuthenticati onService() {
    if (authentication Service == null)
    authenticationS ervice = getServiceRegis try()
    .getAuthenticat ionService();
    return authenticationS ervice;
    }

    protected void setServiceRegst ry(ServiceRegis try serviceRegstry) {
    this.serviceReg istry = serviceRegstry;
    }

    protected ServiceRegistry getServiceRegis try() {
    if (serviceRegistr y == null) {
    ApplicationCont ext ctx = ContextAwareCla ss.getAppContex t();

    //ApplicationCont ext ctx = ApplicationCont extHelper
    //.getApplication Context();

    serviceRegistry = (ServiceRegistr y) ctx
    .getBean(Servic eRegistry.SERVI CE_REGISTRY);
    }

    return serviceRegistry ;


    }
    }

    =============== =============== =============== =============== =============== =============== ===
    =============== =============== =============== =============== =============== =============== ===


    package CRC;

    import org.alfresco.se rvice.cmr.secur ity.Authenticat ionService;
    import java.util.Hasht able;
    import java.util.Map;
    import org.alfresco.mo del.ContentMode l;
    /**
    *
    * @author SPAREWNMAN
    */
    public class AlfUserServices extends AlfrescoService s {

    /** Creates a new instance of AlfUserServices */
    public AlfUserServices () {
    }

    public boolean login(String username,String password){
    try{
    AuthenticationS ervice authenticationS ervice = getAuthenticati onService();
    authenticationS ervice.authenti cate(username, password.toChar Array());
    }
    catch(Exception e){e.printStack Trace();

    return false;}
    return true;
    }

    }
    =============== =============== =============== =============== =============== =============== ===
    =============== =============== =============== =============== =============== =============== ===

    Comment

    Working...