1 Reply Latest reply on Nov 2, 2016 4:12 AM by Tomas Remes

    Error initialising ApplicationScope bean in Wildfly10.1.Final

    Himaz Nazim Newbie

      All.

       

      I am getting a deployment error when initialising an ApplicationScope bean in my project. Could someone kindly point me towards what I am doing wrong here or if there is a bug in the new release. I tried different combination like making it a singleton, @javax.enterprise.context.ApplicationScoped and @javax.faces.bean.ApplicationScoped etc with no success.

       

      I have attached the wildfly server log file for more information on my environment. if you need any more information please let me know.

       

      Your help is much appreciated.

       

      2016-11-02 07:20:08,740 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 340) Critical error during deployment: : com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: dbteam.com.jsf.starter.data.LookupRepository.

          at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:191)

          at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:100)

          at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)

          at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)

          at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:256)

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

          at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)

          at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:200)

          at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)

          at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)

          at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)

          at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)

          at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)

          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

          at java.util.concurrent.FutureTask.run(FutureTask.java:266)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

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

          at org.jboss.threads.JBossThread.run(JBossThread.java:320)

      Caused by: java.lang.NullPointerException

          at dbteam.com.jsf.starter.data.LookupRepository.<init>(LookupRepository.java:44)

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

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

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

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

          at java.lang.Class.newInstance(Class.java:442)

          at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:186)

          ... 25 more

       

      2016-11-02 07:20:08,772 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 340) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: dbteam.com.jsf.starter.data.LookupRepository.

          at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)

          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

          at java.util.concurrent.FutureTask.run(FutureTask.java:266)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

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

          at org.jboss.threads.JBossThread.run(JBossThread.java:320)

      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: dbteam.com.jsf.starter.data.LookupRepository.

          at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:236)

          at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)

          at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)

          ... 6 more

      Caused by: java.lang.RuntimeException: com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: dbteam.com.jsf.starter.data.LookupRepository.

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

          at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)

          at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:200)

          at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)

          at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)

          at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

          at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)

          ... 8 more

      Caused by: com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: dbteam.com.jsf.starter.data.LookupRepository.

          at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:191)

          at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:100)

          at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)

          at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)

          at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:256)

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

          ... 20 more

      Caused by: java.lang.NullPointerException

          at dbteam.com.jsf.starter.data.LookupRepository.<init>(LookupRepository.java:44)

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

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

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

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

          at java.lang.Class.newInstance(Class.java:442)

          at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:186)

          ... 25 more

        • 1. Re: Error initialising ApplicationScope bean in Wildfly10.1.Final
          Tomas Remes Expert

          Hi,

          From CDI point of view LookupRepository is currently Dependent scope bean and to be honest I am not sure how JSF handle or define lifecycle callbacks like PostConstruct. So if you want to use CDI - did you try to use just @javax.enterprise.context.ApplicationScoped + optionally @javax.inject.Named?

          On the other hand if this worked with previous WF release it could be really bug. I guess JSF bug. It would be helpful if you can attach deployable reproducer.