Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Erro 500

Bom dia!

Estou tentando http://localhost:8080/contas/tabelas e o sistema apresenta o seguindo erro no console.


09:16:13,619  INFO DispatcherServlet:479 - FrameworkServlet 'spring mvc': initialization started
09:16:13,668  INFO XmlWebApplicationContext:513 - Refreshing WebApplicationContext for namespace 'spring mvc-servlet': startup date [Fri Oct 02 09:16:13 BRT 2020]; root of context hierarchy
09:16:13,949  INFO XmlBeanDefinitionReader:316 - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-context.xml]
09:16:15,024  INFO RequestMappingHandlerMapping:197 - Mapped "{[/tabelas],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String br.com.caelum.contas.controller.InfraController.criaBanco() throws java.sql.SQLException
09:16:15,094 ERROR DispatcherServlet:492 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1240)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1184)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:847)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:165)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1201)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:654)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:319)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

O servidor inicializa se sem erros mas parece que esta faltando alguma coisa, nem o olá mundo funciona, ja tentei trocar para o mysql e nada, alguém poderia me ajudar, por favor?

2 respostas
solução!
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

Esse erro é por conta da versão do Java na sua máquina. A partir do Java 9 entrou um novo sistema do módulos em que o JaxB vem junto com o JRE mas não é carregado automaticamente.

Se você quiser saber mais detalhes sobre esse erro e sobre como resolver, recomendo esse post no blog da Caelum: http://blog.caelum.com.br/erros-com-jaxb-no-java-9/

Baixei a versão para o Java7 e consegui rodar o projeto. Obrigado Otávio!!