listenerStart Error with struts example

Sam S
2009-12-11
2013-05-08
  • Sam S
    Sam S
    2009-12-11

    Hello,
    I am trying to test the  jguard-struts example with tomcat server as mentioned in quick start instructions. 

    Here is environment::-
    Fedora 7 /
    java version "1.6.0_03" /
    jguard-struts-example-1.0.4.war

    as par the instructions I have copied   jguard-struts-example-1.0.4.war file to   
    /var/lib/tomcat5/webapps   directory.  and restarted tomcat5 . 

    Initially it failied with following error:

    10-Dec-09 7:16:48 PM net.sf.jguard.ext.util.XMLUtils read
    SEVERE: read(String) : org.dom4j.DocumentException: /usr/share/tomcat5/webapps/jguard-struts-example-1.0.4WEB-INF/conf/jGuard/jGuardUsersPrincipals.xml (No such file or directory) Nested exception: /usr/share/tomcat5/webapps/jguard-struts-example-1.0.4WEB-INF/conf/jGuard/jGuardUsersPrincipals.xml (No such file or directory)

    I have fixed missing  /  by updating  following xml files
    jguard-struts-example-1.0.4/WEB-INF/conf/jGuard/jGuardAuthentication.xml
    jguard-struts-example-1.0.4/WEB-INF/conf/jGuard/jGuardAuthorization.xml
    jguard-struts-example-1.0.4/WEB-INF/conf/jGuard/jGuardAuthentication.DatabaseOnAuthenticationAndAuthorization.xml

    after fixing missing / error  it's failing with listenerStart Error , Here is stack trace

    10-Dec-09 7:23:20 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class net.sf.jguard.jee.listeners.ContextListener
    java.lang.NullPointerException
       at net.sf.jguard.core.authorization.policy.JGuardPolicy.loadDefaultPolicy(JGuardPolicy.java:109)
       at net.sf.jguard.core.authorization.policy.AbstractMultipleAppPolicy.<init>(AbstractMultipleAppPolicy.java:76)
       at net.sf.jguard.core.authorization.policy.MultipleAppPolicy.<init>(MultipleAppPolicy.java:44)
       at net.sf.jguard.jee.listeners.ContextListener.initAuthorization(ContextListener.java:153)
       at net.sf.jguard.jee.listeners.ContextListener.contextInitialized(ContextListener.java:105)
       at org.apache.catalina.core.StandardContext.listenerStart(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.StandardContext.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.ContainerBase.addChildInternal(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.ContainerBase.addChild(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.StandardHost.addChild(catalina-5.5.26.jar.so)
       at org.apache.catalina.startup.HostConfig.deployWAR(catalina-5.5.26.jar.so)
       at org.apache.catalina.startup.HostConfig.deployWARs(catalina-5.5.26.jar.so)
       at org.apache.catalina.startup.HostConfig.deployApps(catalina-5.5.26.jar.so)
       at org.apache.catalina.startup.HostConfig.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.startup.HostConfig.lifecycleEvent(catalina-5.5.26.jar.so)
       at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.ContainerBase.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.StandardHost.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.ContainerBase.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.StandardEngine.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.StandardService.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.core.StandardServer.start(catalina-5.5.26.jar.so)
       at org.apache.catalina.startup.Catalina.start(catalina-5.5.26.jar.so)
       at java.lang.reflect.Method.invoke(libgcj.so.8rh)
       at org.apache.catalina.startup.Bootstrap.start(bootstrap.jar.so)
       at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
    10-Dec-09 7:23:20 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    10-Dec-09 7:23:20 PM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    10-Dec-09 7:23:20 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    10-Dec-09 7:23:20 PM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    10-Dec-09 7:23:20 PM org.apache.catalina.core.ApplicationContext log
    INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: , , ]


    Can you please advise what is wrong with my  configuration/setup?

    Thanks,
    Sam

     
  • Sam S
    Sam S
    2009-12-11

    catalina.log

    10-Dec-09 7:23:18 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent

    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/gcj-4.1.2

    10-Dec-09 7:23:18 PM org.apache.coyote.http11.Http11BaseProtocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    10-Dec-09 7:23:18 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 663 ms

    10-Dec-09 7:23:18 PM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina

    10-Dec-09 7:23:18 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.26

    10-Dec-09 7:23:18 PM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled

    10-Dec-09 7:23:19 PM org.apache.catalina.startup.HostConfig deployWAR

    INFO: Deploying web application archive jguard-struts-example-1.0.4.war

    10-Dec-09 7:23:19 PM net.sf.jguard.jee.listeners.ContextListener initAuthentication
    INFO:  authentication scope = local

    10-Dec-09 7:23:19 PM net.sf.jguard.jee.listeners.ContextListener initAuthentication
    INFO:  authentication scope = local

    10-Dec-09 7:23:19 PM net.sf.jguard.ext.authentication.manager.AuthenticationManagerFactory createAuthenticationManager
    INFO: authenticationManagerImpl=net.sf.jguard.ext.authentication.manager.XmlAuthenticationManager

    10-Dec-09 7:23:19 PM net.sf.jguard.jee.listeners.ContextListener initAuthorization
    INFO:  authorization scope = local

    10-Dec-09 7:23:19 PM net.sf.jguard.core.authorization.permissions.PermissionUtils createCaches

    INFO: Creating caches for permissions evaluations
    10-Dec-09 7:23:20 PM net.sf.jguard.core.authorization.policy.AbstractMultipleAppPolicy <init>
    INFO: #######   loading jGuardPolicy 1.0.4 ###########

    10-Dec-09 7:23:20 PM org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart

    10-Dec-09 7:23:20 PM org.apache.catalina.core.StandardContext start
    SEVERE: Context  startup failed due to previous errors

    10-Dec-09 7:23:20 PM org.apache.coyote.http11.Http11BaseProtocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080

    10-Dec-09 7:23:20 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009

    10-Dec-09 7:23:20 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/22  config=null

    10-Dec-09 7:23:20 PM org.apache.catalina.storeconfig.StoreLoader load
    INFO: Find registry server-registry.xml at classpath resource

    10-Dec-09 7:23:21 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 2919 ms
    -----------------                           

     
  • Hi Sam,
    I must confess that I checked the loadDefaultPolicy method and I can't find out a reason to throw a NullPointerException. Can you configure the logging level to catch the CONFIG level that is used inside this method? So we can have a better view about what happen inside the method before the exception. If you are familiar with debug you can attach the source code to you IDE and follow the execution.

    's
    Vinícius Pitta Lima de Araújo

     
  • Sam S
    Sam S
    2009-12-14

    Hi vinipitta,
    Thanks for the reply, it looks jguard  not working with fedora default jvm, it started working once i set tomcat JAVA_HOME to  sun jdk160.   But there are some other issues with struts example, it looks jguard quite complex to use.  Anyway thank you very much for you reply.
    Sam

     
  • Sam,

    I understand you point but I really think jGuard is a developer-friendly framework since you have some knowledge about the JAAS and JEE. There is a lack of a documentation exploring the commons errors and something more practical.

    Once you understand the way jGuard works, its very easy to implement a full featured access control in your webapp. When I need a very simple access control, with static users and permissions, I get it in less than 10min with jGuard. If I want something more sophisticated I guess don't need more then 30min to 1h considering the pages customization.

    Be sure that we will be here anytime you need help to use jGuard.

    's

    Vinícius Pitta Lima de Araújo
    http://www.viniciusaraujo.net