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

HTTP Status 500 - Exception when trying to instantiate Target

Boa tarde pessoal!

Ao tentar gravar um cadastro está gerando o erro acima citado, alguém conhece esse erro ?

No browser:

HTTP Status 500 - Exception when trying to instantiate Target(name=representante, type=class br.com.ebf.modelo.Representante)

type Exception report

message Exception when trying to instantiate Target(name=representante, type=class br.com.ebf.modelo.Representante)

description The server encountered an internal error that prevented it from fulfilling this request.

exception

br.com.caelum.vraptor.http.InvalidParameterException: Exception when trying to instantiate Target(name=representante, type=class br.com.ebf.modelo.Representante)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.handleException(VRaptorInstantiator.java:124)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.handleException(VRaptorInstantiator.java:126)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.instantiate(VRaptorInstantiator.java:118)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.instantiate(VRaptorInstantiator.java:110)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator$Proxy$_$$_WeldClientProxy.instantiate(Unknown Source)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider.instantiateOrAddError(IogiParametersProvider.java:87)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider.instantiateParameters(IogiParametersProvider.java:80)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider.getParametersFor(IogiParametersProvider.java:72)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider$Proxy$_$$_WeldClientProxy.getParametersFor(Unknown Source)
    br.com.caelum.vraptor.observer.ParametersInstantiator.getParametersForCurrentMethod(ParametersInstantiator.java:149)
    br.com.caelum.vraptor.observer.ParametersInstantiator.instantiate(ParametersInstantiator.java:89)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)
    org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165)
    org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119)
    org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112)
    org.jboss.weld.event.EventImpl.fire(EventImpl.java:83)
    br.com.caelum.vraptor.core.DefaultInterceptorStack.start(DefaultInterceptorStack.java:90)
    br.com.caelum.vraptor.core.DefaultInterceptorStack$Proxy$_$$_WeldClientProxy.start(Unknown Source)
    br.com.caelum.vraptor.observer.RequestHandlerObserver.handle(RequestHandlerObserver.java:93)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)
    org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165)
    org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119)
    org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112)
    org.jboss.weld.event.EventImpl.fire(EventImpl.java:83)
    br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:123)
root cause

java.lang.IllegalArgumentException
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)
    net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)
    br.com.caelum.iogi.reflection.NewObject$Setter.set(NewObject.java:87)
    br.com.caelum.iogi.reflection.NewObject.setProperty(NewObject.java:59)
    br.com.caelum.iogi.reflection.NewObject.populateProperties(NewObject.java:52)
    br.com.caelum.iogi.reflection.NewObject.valueWithPropertiesSet(NewObject.java:42)
    br.com.caelum.iogi.ObjectInstantiator.instantiate(ObjectInstantiator.java:30)
    br.com.caelum.iogi.MultiInstantiator.instantiate(MultiInstantiator.java:20)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.instantiate(VRaptorInstantiator.java:116)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.instantiate(VRaptorInstantiator.java:110)
    br.com.caelum.vraptor.http.iogi.VRaptorInstantiator$Proxy$_$$_WeldClientProxy.instantiate(Unknown Source)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider.instantiateOrAddError(IogiParametersProvider.java:87)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider.instantiateParameters(IogiParametersProvider.java:80)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider.getParametersFor(IogiParametersProvider.java:72)
    br.com.caelum.vraptor.http.iogi.IogiParametersProvider$Proxy$_$$_WeldClientProxy.getParametersFor(Unknown Source)
    br.com.caelum.vraptor.observer.ParametersInstantiator.getParametersForCurrentMethod(ParametersInstantiator.java:149)
    br.com.caelum.vraptor.observer.ParametersInstantiator.instantiate(ParametersInstantiator.java:89)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)
    org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165)
    org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119)
    org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112)
    org.jboss.weld.event.EventImpl.fire(EventImpl.java:83)
    br.com.caelum.vraptor.core.DefaultInterceptorStack.start(DefaultInterceptorStack.java:90)
    br.com.caelum.vraptor.core.DefaultInterceptorStack$Proxy$_$$_WeldClientProxy.start(Unknown Source)
    br.com.caelum.vraptor.observer.RequestHandlerObserver.handle(RequestHandlerObserver.java:93)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266)
    org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)
    org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169)
    org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165)
    org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119)
    org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112)
    org.jboss.weld.event.EventImpl.fire(EventImpl.java:83)
    br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:123)
note The full stack trace of the root cause is available in the Apache Tomcat/8.5.8 logs.

Apache Tomcat/8.5.8

E no console:

nov 22, 2016 1:22:57 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [default] in context with path [/ebfvaz-admin] threw exception
br.com.caelum.vraptor.http.InvalidParameterException: Exception when trying to instantiate Target(name=representante, type=class br.com.ebf.modelo.Representante)
    at br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.handleException(VRaptorInstantiator.java:124)
    at br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.handleException(VRaptorInstantiator.java:126)
    at br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.instantiate(VRaptorInstantiator.java:118)
    at br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.instantiate(VRaptorInstantiator.java:110)
    at br.com.caelum.vraptor.http.iogi.VRaptorInstantiator$Proxy$_$$_WeldClientProxy.instantiate(Unknown Source)
    at br.com.caelum.vraptor.http.iogi.IogiParametersProvider.instantiateOrAddError(IogiParametersProvider.java:87)
    at br.com.caelum.vraptor.http.iogi.IogiParametersProvider.instantiateParameters(IogiParametersProvider.java:80)
    at br.com.caelum.vraptor.http.iogi.IogiParametersProvider.getParametersFor(IogiParametersProvider.java:72)
    at br.com.caelum.vraptor.http.iogi.IogiParametersProvider$Proxy$_$$_WeldClientProxy.getParametersFor(Unknown Source)
    at br.com.caelum.vraptor.observer.ParametersInstantiator.getParametersForCurrentMethod(ParametersInstantiator.java:149)
    at br.com.caelum.vraptor.observer.ParametersInstantiator.instantiate(ParametersInstantiator.java:89)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)
    at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232)
    at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169)
    at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165)
    at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119)
    at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112)
    at org.jboss.weld.event.EventImpl.fire(EventImpl.java:83)
    at br.com.caelum.vraptor.core.DefaultInterceptorStack.start(DefaultInterceptorStack.java:90)
    at br.com.caelum.vraptor.core.DefaultInterceptorStack$Proxy$_$$_WeldClientProxy.start(Unknown Source)
    at br.com.caelum.vraptor.observer.RequestHandlerObserver.handle(RequestHandlerObserver.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)
    at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232)
    at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169)
    at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165)
    at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119)
    at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112)
    at org.jboss.weld.event.EventImpl.fire(EventImpl.java:83)
    at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:123)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)
    at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)
    at br.com.caelum.iogi.reflection.NewObject$Setter.set(NewObject.java:87)
    at br.com.caelum.iogi.reflection.NewObject.setProperty(NewObject.java:59)
    at br.com.caelum.iogi.reflection.NewObject.populateProperties(NewObject.java:52)
    at br.com.caelum.iogi.reflection.NewObject.valueWithPropertiesSet(NewObject.java:42)
    at br.com.caelum.iogi.ObjectInstantiator.instantiate(ObjectInstantiator.java:30)
    at br.com.caelum.iogi.MultiInstantiator.instantiate(MultiInstantiator.java:20)
    at br.com.caelum.vraptor.http.iogi.VRaptorInstantiator.instantiate(VRaptorInstantiator.java:116)
    ... 57 more

nov 22, 2016 1:25:28 PM org.apache.catalina.loader.WebappClassLoaderBase modified
INFORMAÇÕES: One or more JARs have been added to the web application [/alura-horas]
nov 22, 2016 1:25:28 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/alura-horas] has started
nov 22, 2016 1:25:29 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.
13:25:30,019  INFO [Version             ] WELD-000900: 2.1.2 (Final)
13:25:30,210  INFO [Bootstrap           ] WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
13:25:30,506  INFO [Version             ] HV000001: Hibernate Validator 5.1.1.Final
13:25:33,387  INFO [Tomcat7Container    ] Tomcat 7+ detected, CDI injection will be available in Servlets and Filters. Injection into Listeners is not supported
13:25:33,871  INFO [DefaultConverters   ] Registering bundled converters
13:25:33,882  INFO [DefaultConverters   ] Registering bundled converters
13:25:33,928  INFO [DefaultRouteBuilder ] /usuario/lista                                    [ALL] -> public void br.com.alura.horas.controllers.UsuarioController.lista()
13:25:33,933  INFO [DefaultRouteBuilder ] /usuario/adiciona                                 [ALL] -> public void br.com.alura.horas.controllers.UsuarioController.adiciona(br.com.alura.horas.modelos.Usuario)
13:25:33,934  INFO [DefaultRouteBuilder ] /usuario/formulario                               [ALL] -> public void br.com.alura.horas.controllers.UsuarioController.formulario()
13:25:33,935  INFO [DefaultRouteBuilder ] /                                                 [ALL] -> public void br.com.alura.horas.controllers.IndexController.index()
13:25:33,949  INFO [VRaptor             ] VRaptor 4.2.0-RC3 successfuly initialized
nov 22, 2016 1:25:33 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/alura-horas] is completed
3 respostas
solução!

Acho q descobri o problema...

Caso não consiga solucionar, abro outro post...

Obrigado!!

Oi Ewerton!

Parece que o VRaptor está com problemas para instanciar um objeto do tipo Representante sua classe Representante possui setters para todos os atributos? Ela tem um construtor vazio?

Consegue colocar pra a gente aqui como está sua classe e o código do formulário?

Abraços!

Boa tarde Philippe!

Abri um novo post...

=> https://cursos.alura.com.br/forum/topico-http-status-500-exception-when-trying-to-instantiate-target-27399

Obrigado!!

Um abraço!