2
I have a class annotated with @Managedbean with correct import and the error occurs below, as the log shows. How do I solve this problem? This happens when I call a controller method in the view.
Controller:
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@ManagedBean
@ViewScoped
public class MinhaClasseController {
public String painel() {
return "painel.xhtml";
}
public String gerenciar() {
return "sort.xhtml";
}
public String gerar() {
return "gerar.xhtml";
}
}
Log:
02:09:22,704 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost/127.0.0.1:8080-1) Error Rendering View[/index.xhtml]: javax.el.ELException: /top_bar.xhtml: Não é possível criar instância para·a classe: br.com.ararazul.view.TesteController. at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:96) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1] at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:439) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_75] Caused by: com.sun.faces.mgbean.ManagedBeanCreationException: Não é possível criar instância para·a classe: br.com.ararazul.view.MinhaClasseController. at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:193) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:408) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:268) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.el.parser.AstValue.getValue(AstValue.java:144) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:217) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:89) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] ... 25 more Caused by: java.lang.NullPointerException at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:115) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1230) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:178) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.EntityManagerImpl.(EntityManagerImpl.java:89) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:193) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:188) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at br.com.ararazul.util.AraraUtil.getEntityManager(AraraUtil.java:20) [classes:] at br.com.ararazul.model.persistence.mega.DAO.(DAO.java:16) [classes:] at br.com.ararazul.model.business.mega.Business.(Business.java:15) [classes:] at br.com.ararazul.view.MinhaClasseController.(MinhaClasseController.java:13) [classes:] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_75] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75] at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.7.0_75] at java.lang.Class.newInstance(Unknown Source) [rt.jar:1.7.0_75] at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] ... 37 more > 02:09:22,751 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ararazul].[Faces Servlet]] (http-localhost/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception: java.lang.NullPointerException at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:115) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149) [hibernate-core-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1230) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:178) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.EntityManagerImpl.(EntityManagerImpl.java:89) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:193) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:188) [hibernate-entitymanager-4.2.7.SP1-redhat-3.jar:4.2.7.SP1-redhat-3] at br.com.ararazul.util.AraraUtil.getEntityManager(AraraUtil.java:20) [classes:] at br.com.ararazul.model.persistence.mega.DAO.(DAO.java:16) [classes:] at br.com.ararazul.model.business.mega.Business.(Business.java:15) [classes:] at br.com.ararazul.view.MinhaClasseController.(MinhaClasseController.java:13) [classes:] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_75] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75] at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.7.0_75] at java.lang.Class.newInstance(Unknown Source) [rt.jar:1.7.0_75] at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:408) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:268) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.el.parser.AstValue.getValue(AstValue.java:144) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:217) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:89) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1] at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:439) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.19-redhat-2.jar:2.1.19-redhat-2] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_75]