Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

HTTP Status 500 - Could not initialize class br.com.caelum.livraria.dao.JPAUtil

Estou refazendo a aula 3 e me apareceu esse erro quando uso a view de livro.

xception

javax.servlet.ServletException: Could not initialize class br.com.caelum.livraria.dao.JPAUtil
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.lang.NoClassDefFoundError: Could not initialize class br.com.caelum.livraria.dao.JPAUtil
    br.com.caelum.livraria.dao.DAO.listaTodos(DAO.java:55)
    br.com.caelum.livraria.bean.LivroBean.getAutores(LivroBean.java:45)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:498)
    javax.el.BeanELResolver.getValue(BeanELResolver.java:99)
    com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    org.apache.el.parser.AstValue.getValue(AstValue.java:184)
    org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
    javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
    javax.faces.component.UISelectItems.getValue(UISelectItems.java:129)
    com.sun.faces.renderkit.SelectItemsIterator.initializeItems(SelectItemsIterator.java:202)
    com.sun.faces.renderkit.SelectItemsIterator.hasNext(SelectItemsIterator.java:135)
    com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:761)
    com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:843)
    com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:297)
    javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
    javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:437)
    com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
1 resposta
solução!

Fechei o eclipse e abri de novo ai a mágica aconteceu e voltou a funcionar :)