4 Replies Latest reply on Jun 15, 2011 9:54 AM by ramy Hassan

    NullPointerException while integration of Richfaces 4 with JSF 2 using tomcat 6

    ramy Hassan Novice

      Hello,

       

      I just started to use Richfaces 4 with JSF 2.

       

      - I added below jars to my project classpath:

       

      1- richfaces-components-api-4.0.0.Final.jar

      2- richfaces-components-ui-4.0.0.Final.jar

      3- richfaces-core-api-4.0.0.Final.jar

      4- richfaces-core-impl-4.0.0.Final.jar

       

      - Then I tried to deploy the web application to tomcat 6, I got the following exception:

       

       

      INFO: Unsanitized stacktrace from failed start...

      com.sun.faces.config.ConfigurationException:

        Source Document: jar:file:/C:/Users/Ramy/Documents/NetBeansProjects/Richfaces4/build/web/WEB-INF/lib/richfaces-core-impl-4.0.0.Final.jar!/META-INF/faces-config.xml

        Cause: Unable to create a new instance of 'org.richfaces.resource.ResourceHandlerImpl': java.lang.reflect.InvocationTargetException

      at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:295)

      at com.sun.faces.config.processor.ApplicationConfigProcessor.setResourceHandler(ApplicationConfigProcessor.java:752)

      at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:310)

      at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114)

      at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116)

      at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114)

      at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:223)

      at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:335)

      at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)

      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)

      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)

      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:525)

      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)

      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)

      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)

      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:597)

      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)

      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)

      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)

      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)

      at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:824)

      at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:350)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

      at java.lang.Thread.run(Thread.java:619)

      Caused by: java.lang.reflect.InvocationTargetException

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

      at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:265)

      ... 41 more

      Caused by: java.lang.NoClassDefFoundError: com/google/common/base/Function

      at org.richfaces.resource.ResourceHandlerImpl.<init>(ResourceHandlerImpl.java:66)

       

       

      - Then I searched for the reason of java.lang.NoClassDefFoundError: com/google/common/base/Function Exception.

       

      - I figured out that if I put google-collect-1.0-rc1.jar in my class path, will solve the problem.

       

      - After adding the previous lib to my class path, I got NullPointerException as below :

       

       

      SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime

      java.lang.NullPointerException

      at org.richfaces.application.CacheProvider.release(CacheProvider.java:86)

      at org.richfaces.application.ServicesFactoryImpl.release(ServicesFactoryImpl.java:19)

      at org.richfaces.application.ServiceTracker.release(ServiceTracker.java:100)

      at org.richfaces.application.InitializationListener.onStop(InitializationListener.java:144)

      at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:154)

      at javax.faces.event.SystemEvent.processListener(SystemEvent.java:102)

      at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:1993)

      at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:1969)

      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:299)

      at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:313)

      at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3882)

      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4523)

      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4387)

      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:525)

      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)

      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)

      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)

      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:597)

      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)

      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)

      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)

      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)

      at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:824)

      at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:350)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

      at java.lang.Thread.run(Thread.java:619)

       

       

      So do I miss something in configuring  richfaces 4 ?!