does anybody implement jGuard with jsf?

xRod
2010-10-25
2013-05-08
  • xRod
    xRod
    2010-10-25

    Hi all,

    I tried implement jGuard using the example called "jguard-jsf-example-1.1.0-beta-4.war", downloaded from sourceforge site. But I made some adaptation based on the struts example.

    In the loggin's form, I define the "loggonProcess" action. This "loggonProcess" I declared in the jguardfilter.xml on the property loggonProcessURI. I'm dealing with xmlauthenticationmanager.

    Then, when I try to loggin the server launch an exception like:
    "ResourceRequested (loggonProcess) is not available"

    What is wrong here?. Does Anybody has an example?. I'm using tomcat 6.0.20, jee5 and jsf 1.2 with facelets.

    thanks in advance.

    Rod

     
  • Charles Lescot
    Charles Lescot
    2010-10-26

    Hi,
    the jguard-sjsf-example contains an example of authentication.
    you should use the code "as is" to authenticate.
    with this jsf authentication, can you publish your stack trace or traces contained in your log file, with the net.sf.jguard log4j level enabled to debug?

    cheers,
    Charles.

     
  • xRod
    xRod
    2010-10-26

    Hi Charles, thank you for your quick reply.

    I made some modification to the code for deploy. And, we those modifications I got this error from apache:

    State: HTTP 404 - /jguard-jsf-example-1.1.0-beta-4/logonProcess.jsp
    type: State's report
    message: /jguard-jsf-example-1.1.0-beta-4/logonProcess.jsp
    description: Resource requested (/jguard-jsf-example-1.1.0-beta-4/logonProcess.jsp) is not available.

    If I use the code "as is" the stack is the next:

    INFO: El escuchador "org.apache.myfaces.webapp.
    StartupServletContextListener" ya está configurado para este contexto. La definición duplicada ha sido ignorada.
    26-oct-2010 9:52:00 net.sf.jguard.core.authentication.manager.AuthenticationManagerFactory createAuthenticationManager
    INFO: authenticationManagerImpl=net.sf.jguard.ext.authentication.manager.HibernateAuthenticationManager
    26-oct-2010 9:52:01 org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    GRAVE: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase net.sf.jguard.jee.listeners.ContextListener
    java.lang.NoClassDefFoundError: org/hibernate/Session
            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
            at java.lang.Class.getConstructor0(Class.java:2699)
            at java.lang.Class.getConstructor(Class.java:1657)
            at net.sf.jguard.core.authentication.manager.AuthenticationManagerFactory.createAuthenticationManager(AuthenticationManagerFactory.java:78)
            at net.sf.jguard.core.authentication.manager.AuthenticationHelper.initAuthentication(AuthenticationHelper.java:76)
            at net.sf.jguard.core.authentication.configuration.JGuardConfiguration$1.run(JGuardConfiguration.java:239)
            at java.security.AccessController.doPrivileged(Native Method)
            at net.sf.jguard.core.authentication.configuration.JGuardConfiguration.loadConfigDataAndAuthenticationManager(JGuardConfiguration.java:220)
            at net.sf.jguard.core.authentication.configuration.JGuardConfiguration.<init>(JGuardConfiguration.java:108)
            at net.sf.jguard.jee.listeners.ContextListener.initAuthentication(ContextListener.java:190)
            at net.sf.jguard.jee.listeners.ContextListener.contextInitialized(ContextListener.java:106)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
            at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
            at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
            at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
            at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
            at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
            at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
            at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassNotFoundException: org.hibernate.Session
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
            … 28 more
    26-oct-2010 9:52:01 org.apache.catalina.core.StandardContext start
    GRAVE: Falló en arranque del Contexto  debido a errores previos

    I hope this is what you asked for.

    thanks,

    Rod

     
  • Charles Lescot
    Charles Lescot
    2010-10-27

    Hi,
    this part of trace:
    "java.lang.NoClassDefFoundError: org/hibernate/Session"
    implies that you've configured an HibernateAuthenticationManager, but you've not put in your web-inf/lib an hibernate jar.
    you should put all the libraries present in the example in your web-inf/lib directory, to solve your issue.

    best regards,

    Charles.

     
  • xRod
    xRod
    2010-10-29

    Hi Charles,
    Thank you for your comment. The jsf-example is working.
    Now, I have to implement in my project. Do you have any advice to do?, or what is the "best practices" in jGuard implementation. Is this question looks so general, I'll post again when something wrong happent.

    b. regards,

    Rod