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

Erro java.lang.RuntimeException:

Depois de usar o CDI no projeto começaram a aparecer alguns erros na stacktrace.

Lendo aqui ví que tem algo a ver com o beans.xml e o validation.xml, mas tenho todos eles na pasta META-INF.

Vou colocar abaixo os códigos e a stacktrace.

STACKTRACE:

abr 26, 2017 4:22:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:alura-horas' did not find a matching property.
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version:        Apache Tomcat/9.0.0.M17
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built:          Jan 10 2017 20:59:20 UTC
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number:         9.0.0.0
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name:               Windows 10
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version:            10.0
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture:          amd64
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home:             C:\Program Files\Java\jre1.8.0_73
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version:           1.8.0_73-b02
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor:            Oracle Corporation
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE:         C:\Users\Math\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME:         C:\Users\Math\Desktop\apache-tomcat-9.0.0.M17
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\Users\Math\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\Users\Math\Desktop\apache-tomcat-9.0.0.M17
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\Users\Math\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\Users\Math\Desktop\apache-tomcat-9.0.0.M17\endorsed
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
abr 26, 2017 4:22:24 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_73\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_73/bin/server;C:/Program Files/Java/jre1.8.0_73/bin;C:/Program Files/Java/jre1.8.0_73/lib/amd64;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\MATLAB\MATLAB Production Server\R2015a\runtime\win64;C:\Program Files\MATLAB\MATLAB Production Server\R2015a\bin;C:\Program Files\MATLAB\MATLAB Production Server\R2015a\polyspace\bin;C:\Program Files (x86)\Brackets\command;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files (x86)\Skype\Phone\;C:\Users\Math\workspace\apache-maven-3.3.9\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\qt\bin;C:\Users\Math\AppData\Local\Microsoft\WindowsApps;;C:\Users\Math\Desktop;;.
abr 26, 2017 4:22:24 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-nio-8080"]
abr 26, 2017 4:22:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
abr 26, 2017 4:22:24 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-nio-8009"]
abr 26, 2017 4:22:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
abr 26, 2017 4:22:24 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 885 ms
abr 26, 2017 4:22:24 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
abr 26, 2017 4:22:24 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/9.0.0.M17
abr 26, 2017 4:22:27 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
abr 26, 2017 4:22:27 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.1.2 (Final)
abr 26, 2017 4:22:27 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
abr 26, 2017 4:22:28 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 5.4.1.Final
abr 26, 2017 4:22:28 PM org.hibernate.validator.internal.xml.ValidationXmlParser unmarshal
INFO: HV000007: META-INF/validation.xml found. Parsing XML based configuration.
abr 26, 2017 4:22:28 PM org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
java.lang.RuntimeException: Error instantiating class org.hibernate.validator.internal.cdi.ValidationExtension
    at org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:245)
    at org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:214)
    at org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:182)
    at org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:153)
    at org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:297)
    at org.jboss.weld.bootstrap.ExtensionBeanDeployer.addExtensions(ExtensionBeanDeployer.java:109)
    at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:312)
    at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:73)
    at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:140)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4717)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.validation.ValidationException: HV000100: Unable to parse META-INF/validation.xml.
    at org.hibernate.validator.internal.xml.ValidationXmlParser.unmarshal(ValidationXmlParser.java:141)
    at org.hibernate.validator.internal.xml.ValidationXmlParser.parseValidationXml(ValidationXmlParser.java:92)
    at org.hibernate.validator.internal.engine.ConfigurationImpl.getBootstrapConfiguration(ConfigurationImpl.java:393)
    at org.hibernate.validator.internal.cdi.ValidationExtension.<init>(ValidationExtension.java:110)
    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.util.ServiceLoader.prepareInstance(ServiceLoader.java:240)
    ... 17 more
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 45; cvc-elt.1: Não pode localizar a declaração do elemento 'beans'.]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
    at org.hibernate.validator.internal.util.privilegedactions.Unmarshal.run(Unmarshal.java:38)
    at org.hibernate.validator.internal.util.privilegedactions.Unmarshal.run(Unmarshal.java:20)
    at org.hibernate.validator.internal.xml.ValidationXmlParser.run(ValidationXmlParser.java:223)
    at org.hibernate.validator.internal.xml.ValidationXmlParser.unmarshal(ValidationXmlParser.java:137)
    ... 25 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 45; cvc-elt.1: Não pode localizar a declaração do elemento 'beans'.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.handleStartElement(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(Unknown Source)
    ... 31 more

abr 26, 2017 4:22:28 PM org.apache.catalina.core.StandardContext startInternal
GRAVE: One or more listeners failed to start. Full details will be found in the appropriate container log file
abr 26, 2017 4:22:29 PM org.apache.catalina.core.StandardContext startInternal
GRAVE: Context [/alura-horas] startup failed due to previous errors
abr 26, 2017 4:22:29 PM org.apache.catalina.core.StandardContext listenerStop
GRAVE: Exception sending context destroyed event to listener instance of class org.jboss.weld.environment.servlet.Listener
java.lang.NullPointerException
    at org.jboss.weld.servlet.WeldInitialListener.contextDestroyed(WeldInitialListener.java:120)
    at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.contextDestroyed(ForwardingServletListener.java:30)
    at org.jboss.weld.environment.servlet.Listener.contextDestroyed(Listener.java:85)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4764)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5401)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

abr 26, 2017 4:22:29 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler [http-nio-8080]
abr 26, 2017 4:22:29 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler [ajp-nio-8009]
abr 26, 2017 4:22:29 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 4250 ms
abr 26, 2017 4:22:39 PM org.apache.catalina.core.StandardServer await
INFORMAÇÕES: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
abr 26, 2017 4:22:39 PM org.apache.coyote.AbstractProtocol pause
INFORMAÇÕES: Pausing ProtocolHandler ["http-nio-8080"]
abr 26, 2017 4:22:39 PM org.apache.coyote.AbstractProtocol pause
INFORMAÇÕES: Pausing ProtocolHandler ["ajp-nio-8009"]
abr 26, 2017 4:22:40 PM org.apache.catalina.core.StandardService stopInternal
INFORMAÇÕES: Stopping service Catalina
abr 26, 2017 4:22:40 PM org.apache.coyote.AbstractProtocol stop
INFORMAÇÕES: Stopping ProtocolHandler ["http-nio-8080"]
abr 26, 2017 4:22:40 PM org.apache.coyote.AbstractProtocol stop
INFORMAÇÕES: Stopping ProtocolHandler ["ajp-nio-8009"]
abr 26, 2017 4:22:40 PM org.apache.coyote.AbstractProtocol destroy
INFORMAÇÕES: Destroying ProtocolHandler ["http-nio-8080"]
abr 26, 2017 4:22:40 PM org.apache.coyote.AbstractProtocol destroy
INFORMAÇÕES: Destroying ProtocolHandler ["ajp-nio-8009"]

beans.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans     xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                            http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
        version="1.1" bean-discovery-mode="all">

</beans>

validation.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
    version="1.1" bean-discovery-mode="all">
</beans>
2 respostas
solução!

Olá Matheus,

onde você pegou este código do validation.xml? Porque em teoria este xml começa com a tag validation-config. Aqui um link com a documentação do vraptor sobre as configurações do CDI

Verifiquei o código reparei que na maior desatenção coloquei o código do beans.xml no validation.xml, peguei todo o código do site do vraptor mesmo mas troquei os valores, atualizei aqui e funcionou certinho.

Muito obrigado pela ajuda.