EJB + Hibernate + Glassfish

Galera, pesquisei um bocado na internet, tentei as poucas coisas que encontrei, e até agora nada. Meu problema é o seguinte. Sou novo com EJB, e com servidores de aplicação(no meu caso, GlassFish).
Tenho uma classe que contem um anotação com um validador meu. A aplicação loga, roda, mas quando eu vou salvar um registro, ele da o seguinte erro:

javax.validation.ValidationException: Call to TraversableResolver.isReachable() threw an exception

e um segundo erro no stacktrace que segue é esse

java.lang.ClassCastException: net.metha.registroDiarioJSF.model.tinyType.DiaMesEAno cannot be cast to org.eclipse.persistence.queries.FetchGroupTracker

Alguém tem alguma idéia do que pode ser?

Olá Lucas,

que o problema foi um cast que o sistema não conseguiu fazer, isto tá escrito no erro, mas você poderia postar o método onde acontece o erro e postar também o stack do inteiro do erro. Assim fica mais facil pra identificar.

Falow

Na verdade, não é um método, e sim um Tiny Type que eu uso para data, ja que ela tava em String ja no banco… o stack Trace segue abaixo

javax.ejb.EJBException
	at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5119)
	at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5017)
	at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4805)
	at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2004)
	at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:198)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
	at $Proxy174.incluir(Unknown Source)
	at net.metha.registroDiarioJSF.business.__EJB31_Generated__TempoDiarioRepositorio__Intf____Bean__.incluir(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
	at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
	at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127)
	at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
	at net.metha.registroDiarioJSF.business.TempoDiarioRepositorio_$$_javassist_33.incluir(TempoDiarioRepositorio_$$_javassist_33.java)
	at net.metha.registroDiarioJSF.controller.TempoDiarioController.salvarTempoDiario(TempoDiarioController.java:222)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
	at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
	at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
	at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
	at net.metha.registroDiarioJSF.controller.TempoDiarioController_$$_javassist_50.salvarTempoDiario(TempoDiarioController_$$_javassist_50.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
	at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
	at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:72)
	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
	at javax.faces.component.UICommand.broadcast(UICommand.java:315)
	at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
	at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
	at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
	at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
	at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
	at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.validation.ValidationException: Call to TraversableResolver.isReachable() threw an exception
	at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:773)
	at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:331)
	at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:278)
	at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:260)
	at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:213)
	at org.hibernate.validator.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:466)
	at org.hibernate.validator.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:372)
	at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:219)
	at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.validateOnCallbackEvent(BeanValidationListener.java:84)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.prePersist(BeanValidationListener.java:62)
	at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyListener(DescriptorEventManager.java:670)
	at org.eclipse.persistence.descriptors.DescriptorEventManager.notifyEJB30Listeners(DescriptorEventManager.java:613)
	at org.eclipse.persistence.descriptors.DescriptorEventManager.executeEvent(DescriptorEventManager.java:200)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectClone(UnitOfWorkImpl.java:4231)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:4208)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:424)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4148)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:368)
	at com.sun.enterprise.container.common.impl.EntityManagerWrapper.persist(EntityManagerWrapper.java:258)
	at net.metha.registroDiarioJSF.business.TempoDiarioRepositorio.incluir(TempoDiarioRepositorio.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
	at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
	at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
	at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
	at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
	at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
	at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:47)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
	at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
	at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
	at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
	at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
	at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5264)
	at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
	at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
	... 79 more
Caused by: java.lang.ClassCastException: net.metha.registroDiarioJSF.model.tinyType.DiaMesEAno cannot be cast to org.eclipse.persistence.queries.FetchGroupTracker
	at org.eclipse.persistence.descriptors.FetchGroupManager.isAttributeFetched(FetchGroupManager.java:321)
	at org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener$AutomaticLifeCycleValidationTraversableResolver.isReachable(BeanValidationListener.java:137)
	at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
	at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:764)
	... 129 more

Classe

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Embeddable;

import net.metha.registroDiarioJSF.model.constraint.IDiaMesEAnoValidator;

@Embeddable
@IDiaMesEAnoValidator
public class DiaMesEAno implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String dia;

	private String mes;

	private String ano;

	public String getDia() {
		return dia;
	}

	public void setDia(String dia) {

		if (dia.length() == 1) {
			this.dia = "0" + dia;
		} else {
			this.dia = dia;
		}
	}

	public String getMes() {
		return mes;
	}

	public void setMes(String mes) {
		if (mes.length() == 1) {
			this.mes = "0" + mes;
		} else {
			this.mes = mes;
		}
	}

	public String getAno() {
		return ano;
	}

	public void setAno(String ano) {
		this.ano = ano;
	}
	
	public void setData(Date data){
		
		this.dia = new SimpleDateFormat("dd").format(data);
		this.setDia(this.dia);
		this.mes = new SimpleDateFormat("MM").format(data);
		this.setMes(this.mes);
		this.ano = new SimpleDateFormat("yyyy").format(data);
		this.setAno(this.ano);
	}

}

Ela está sendo chamada como atributo em uma classe minha. Quando eu tento salvar, ele dá pau…

posta a classe que tem o método que persiste esse dado o/*