Fiz a configuração do CDI de acordo com as aulas, mas estou retornando um erro quando entro na página livro.xhtml, que executa o método dao.quantidadeDeElementos. Segue o erro:
out 12, 2017 8:53:18 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
GRAVE: Error Rendering View[/livro.xhtml]
java.lang.NullPointerException
at br.com.caelum.livraria.modelo.LivroDataModel.<init>(LivroDataModel.java:22)
at br.com.caelum.livraria.bean.LivroBean.<init>(LivroBean.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:119)
at org.jboss.weld.injection.ConstructorInjectionPoint.invokeAroundConstructCallbacks(ConstructorInjectionPoint.java:92)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:78)
at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28)
at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:116)
at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:180)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158)
Existe um outro erro também, se ajudar...
Outro erro:
out 12, 2017 8:53:18 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/jsf-livraria-cdi] threw exception [null] with root cause
java.lang.NullPointerException
at br.com.caelum.livraria.modelo.LivroDataModel.<init>(LivroDataModel.java:22)
at br.com.caelum.livraria.bean.LivroBean.<init>(LivroBean.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:119)
at org.jboss.weld.injection.ConstructorInjectionPoint.invokeAroundConstructCallbacks(ConstructorInjectionPoint.java:92)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:78)
Ambos estão dizendo que o dao.quantidadeDeElementos() retorna nulo, e não sei o motivo pelo qual ele está retornando nulo.
Por gentileza, quem conseguir me ajudar.