java.lang.reflect.InvocationTargetException

Hibernate JIRA | Steve Cannon | 3 years ago
  1. 0

    I have the following subset of a much larger entity. I'm am running this in JBoss Developer Studio. When I start the server on my localhost, I get an error by the Hibernate Validator. However, my application seems to run fine and the cast is working. Note near the bottom of the included stack trace the following line: Caused by: java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column After numerous Google searches, there appears to be issues with casting inside the @Formula annotation. @Entity @Table(name = "PA_EPA_ID_LOG") @SequenceGenerator(name = "PA_EPA_ID_LOG_SEQ", sequenceName = "PA_EPA_ID_LOG_SEQ") public class PaEpaIdLog { private String regionCd; @Column(name = "REGION_CD", length = 2) @Length(max = 2) @Formula("cast(REGION_CD as NUMBER(2,0))") public String getRegionCd() { return this.regionCd; } public void setRegionCd(String regionCd) { this.regionCd = regionCd; } } 07:30:02,573 INFO [Version] Hibernate Validator 3.1.0.GA 07:30:02,949 WARN [AnnotationConfiguration] Unable to apply constraints on DDL for gov.state.tceq.paris.entity.beans.PaEpaIdLog java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor299.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:385) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1333) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165) at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79) 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.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.callCreateMethod(Component.java:2172) at org.jboss.seam.Component.newInstance(Component.java:2132) at org.jboss.seam.Component.getInstance(Component.java:2021) at org.jboss.seam.Component.getInstance(Component.java:1983) at org.jboss.seam.Component.getInstance(Component.java:1977) at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55) at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50) at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148) at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54) at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44) at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112) at org.jboss.seam.persistence.ManagedHibernateSession.getSessionFactoryFromJndiOrValueBinding(ManagedHibernateSession.java:233) at org.jboss.seam.persistence.ManagedHibernateSession.initSession(ManagedHibernateSession.java:82) at org.jboss.seam.persistence.ManagedHibernateSession.getSession(ManagedHibernateSession.java:118) 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.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.unwrap(Component.java:2275) at org.jboss.seam.Component.getInstance(Component.java:2041) at org.jboss.seam.Component.getInstance(Component.java:1983) at org.jboss.seam.Component.getInstance(Component.java:1977) at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2349) at org.jboss.seam.Component.getValueToInject(Component.java:2301) at org.jboss.seam.Component.injectAttributes(Component.java:1736) at org.jboss.seam.Component.inject(Component.java:1554) at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) at gov.state.tceq.paris.reference.data.ReferenceDataManager_$$_javassist_seam_4.init(ReferenceDataManager_$$_javassist_seam_4.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 org.jboss.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.callCreateMethod(Component.java:2172) at org.jboss.seam.Component.newInstance(Component.java:2132) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:305) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:297) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:297) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:297) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:279) at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:115) at org.jboss.seam.init.Initialization.init(Initialization.java:740) at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142) at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) at org.jboss.web.deployers.WebModule.start(WebModule.java:97) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668) at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) at com.sun.proxy.$Proxy38.start(Unknown Source) at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42) at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.system.ServiceController.doChange(ServiceController.java:688) at org.jboss.system.ServiceController.start(ServiceController.java:460) at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46) at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1179) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1211) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70) at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53) at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540) at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256) at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461) at org.jboss.Main.boot(Main.java:221) at org.jboss.Main$1.run(Main.java:556) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column at org.hibernate.validator.LengthValidator.apply(LengthValidator.java:32) at org.hibernate.validator.ClassValidator.apply(ClassValidator.java:652) ... 141 more

    Hibernate JIRA | 3 years ago | Steve Cannon
    java.lang.reflect.InvocationTargetException
  2. 0

    I have the following subset of a much larger entity. I'm am running this in JBoss Developer Studio. When I start the server on my localhost, I get an error by the Hibernate Validator. However, my application seems to run fine and the cast is working. Note near the bottom of the included stack trace the following line: Caused by: java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column After numerous Google searches, there appears to be issues with casting inside the @Formula annotation. @Entity @Table(name = "PA_EPA_ID_LOG") @SequenceGenerator(name = "PA_EPA_ID_LOG_SEQ", sequenceName = "PA_EPA_ID_LOG_SEQ") public class PaEpaIdLog { private String regionCd; @Column(name = "REGION_CD", length = 2) @Length(max = 2) @Formula("cast(REGION_CD as NUMBER(2,0))") public String getRegionCd() { return this.regionCd; } public void setRegionCd(String regionCd) { this.regionCd = regionCd; } } 07:30:02,573 INFO [Version] Hibernate Validator 3.1.0.GA 07:30:02,949 WARN [AnnotationConfiguration] Unable to apply constraints on DDL for gov.state.tceq.paris.entity.beans.PaEpaIdLog java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor299.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:385) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1333) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165) at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79) 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.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.callCreateMethod(Component.java:2172) at org.jboss.seam.Component.newInstance(Component.java:2132) at org.jboss.seam.Component.getInstance(Component.java:2021) at org.jboss.seam.Component.getInstance(Component.java:1983) at org.jboss.seam.Component.getInstance(Component.java:1977) at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55) at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50) at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148) at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54) at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44) at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112) at org.jboss.seam.persistence.ManagedHibernateSession.getSessionFactoryFromJndiOrValueBinding(ManagedHibernateSession.java:233) at org.jboss.seam.persistence.ManagedHibernateSession.initSession(ManagedHibernateSession.java:82) at org.jboss.seam.persistence.ManagedHibernateSession.getSession(ManagedHibernateSession.java:118) 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.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.unwrap(Component.java:2275) at org.jboss.seam.Component.getInstance(Component.java:2041) at org.jboss.seam.Component.getInstance(Component.java:1983) at org.jboss.seam.Component.getInstance(Component.java:1977) at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2349) at org.jboss.seam.Component.getValueToInject(Component.java:2301) at org.jboss.seam.Component.injectAttributes(Component.java:1736) at org.jboss.seam.Component.inject(Component.java:1554) at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) at gov.state.tceq.paris.reference.data.ReferenceDataManager_$$_javassist_seam_4.init(ReferenceDataManager_$$_javassist_seam_4.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 org.jboss.seam.util.Reflections.invoke(Reflections.java:22) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) at org.jboss.seam.Component.callComponentMethod(Component.java:2249) at org.jboss.seam.Component.callCreateMethod(Component.java:2172) at org.jboss.seam.Component.newInstance(Component.java:2132) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:305) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:297) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:297) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:297) at org.jboss.seam.contexts.Contexts.startup(Contexts.java:279) at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:115) at org.jboss.seam.init.Initialization.init(Initialization.java:740) at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142) at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) at org.jboss.web.deployers.WebModule.start(WebModule.java:97) 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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668) at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) at com.sun.proxy.$Proxy38.start(Unknown Source) at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42) at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.system.ServiceController.doChange(ServiceController.java:688) at org.jboss.system.ServiceController.start(ServiceController.java:460) at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46) at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1179) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1211) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70) at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53) at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540) at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256) at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461) at org.jboss.Main.boot(Main.java:221) at org.jboss.Main$1.run(Main.java:556) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column at org.hibernate.validator.LengthValidator.apply(LengthValidator.java:32) at org.hibernate.validator.ClassValidator.apply(ClassValidator.java:652) ... 141 more

    Hibernate JIRA | 3 years ago | Steve Cannon
    java.lang.reflect.InvocationTargetException
  3. 0

    Hibernate @Formula annotation causes a Hibernate Validator warning and stack trace

    Stack Overflow | 3 years ago | Trippy
    java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Given a mapping like {code} @ManyToOne(fetch=FetchType.EAGER, optional=false) @JoinColumnsOrFormulas({ @JoinColumnOrFormula(formula=@JoinFormula(value=Titel.DOMAIN_FORMULA, referencedColumnName="rv_domain")), @JoinColumnOrFormula(column=@JoinColumn(name="titel", referencedColumnName="rv_low_value")) }) @Fetch(FetchMode.JOIN) @NotNull private Titel titel; {code} where Titel is a subtype of a DomainValue: {code} @Entity @DiscriminatorValue(Titel.DOMAIN) public class Titel extends DomainValue { private static final long serialVersionUID = 5804243997732685958L; public final static String DOMAIN = "TITEL"; public final static String DOMAIN_FORMULA = "'" + DOMAIN + "'"; } {code} base class DomainValue {code} @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @Cacheable(true) @Cache(usage=CacheConcurrencyStrategy.READ_ONLY) @Immutable @Table(name="cg_ref_codes") @IdClass(DomainValue.PrimaryKey.class) @DiscriminatorColumn(name="rv_domain") public class DomainValue implements Serializable { ... } {code} the @NotNull leads to a class cast exception while starting the persistence unit: {code} java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyNotNull(TypeSafeActivator.java:314) ~[hibernate-core-4.1.11.Final.jar:4.1.11.Final] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyConstraints(TypeSafeActivator.java:247) ~[hibernate-core-4.1.11.Final.jar:4.1.11.Final] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:209) ~[hibernate-core-4.1.11.Final.jar:4.1.11.Final] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyRelationalConstraints(TypeSafeActivator.java:186) ~[hibernate-core-4.1.11.Final.jar:4.1.11.Final] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyRelationalConstraints(TypeSafeActivator.java:158) ~[hibernate-core-4.1.11.Final.jar:4.1.11.Final] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.activate(TypeSafeActivator.java:110) ~[hibernate-core-4.1.11.Final.jar:4.1.11.Final] {code} Mapping seams to work, though. But i guess the validation isnt't in place.

    Hibernate JIRA | 4 years ago | Michael Simons
    java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column

      at org.hibernate.validator.LengthValidator.apply()
    2. Hibernate Validator Engine
      ClassValidator.apply
      1. org.hibernate.validator.LengthValidator.apply(LengthValidator.java:32)
      2. org.hibernate.validator.ClassValidator.apply(ClassValidator.java:652)
      2 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor299.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:597)
      3 frames
    4. Hibernate
      AnnotationConfiguration.buildSessionFactory
      1. org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:385)
      2. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1333)
      3. org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
      3 frames
    5. org.jboss.seam
      HibernateSessionFactory.startup
      1. org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165)
      2. org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79)
      2 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    7. org.jboss.seam
      SeamELResolver.getValue
      1. org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
      2. org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
      3. org.jboss.seam.Component.callComponentMethod(Component.java:2249)
      4. org.jboss.seam.Component.callCreateMethod(Component.java:2172)
      5. org.jboss.seam.Component.newInstance(Component.java:2132)
      6. org.jboss.seam.Component.getInstance(Component.java:2021)
      7. org.jboss.seam.Component.getInstance(Component.java:1983)
      8. org.jboss.seam.Component.getInstance(Component.java:1977)
      9. org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
      10. org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
      11. org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
      12. org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
      12 frames
    8. EL
      CompositeELResolver.getValue
      1. javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
      1 frame
    9. org.jboss.el
      ValueExpressionImpl.getValue
      1. org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
      2. org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      2 frames
    10. org.jboss.seam
      ManagedHibernateSession.getSession
      1. org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
      2. org.jboss.seam.persistence.ManagedHibernateSession.getSessionFactoryFromJndiOrValueBinding(ManagedHibernateSession.java:233)
      3. org.jboss.seam.persistence.ManagedHibernateSession.initSession(ManagedHibernateSession.java:82)
      4. org.jboss.seam.persistence.ManagedHibernateSession.getSession(ManagedHibernateSession.java:118)
      4 frames
    11. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    12. org.jboss.seam
      JavaBeanInterceptor.invoke
      1. org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
      2. org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
      3. org.jboss.seam.Component.callComponentMethod(Component.java:2249)
      4. org.jboss.seam.Component.unwrap(Component.java:2275)
      5. org.jboss.seam.Component.getInstance(Component.java:2041)
      6. org.jboss.seam.Component.getInstance(Component.java:1983)
      7. org.jboss.seam.Component.getInstance(Component.java:1977)
      8. org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2349)
      9. org.jboss.seam.Component.getValueToInject(Component.java:2301)
      10. org.jboss.seam.Component.injectAttributes(Component.java:1736)
      11. org.jboss.seam.Component.inject(Component.java:1554)
      12. org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61)
      13. org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      14. org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
      15. org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      16. org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
      17. org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
      18. org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
      18 frames
    13. gov.state.tceq
      ReferenceDataManager_$$_javassist_seam_4.init
      1. gov.state.tceq.paris.reference.data.ReferenceDataManager_$$_javassist_seam_4.init(ReferenceDataManager_$$_javassist_seam_4.java)
      1 frame
    14. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    15. org.jboss.seam
      SeamListener.contextInitialized
      1. org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
      2. org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
      3. org.jboss.seam.Component.callComponentMethod(Component.java:2249)
      4. org.jboss.seam.Component.callCreateMethod(Component.java:2172)
      5. org.jboss.seam.Component.newInstance(Component.java:2132)
      6. org.jboss.seam.contexts.Contexts.startup(Contexts.java:305)
      7. org.jboss.seam.contexts.Contexts.startup(Contexts.java:297)
      8. org.jboss.seam.contexts.Contexts.startup(Contexts.java:297)
      9. org.jboss.seam.contexts.Contexts.startup(Contexts.java:297)
      10. org.jboss.seam.contexts.Contexts.startup(Contexts.java:279)
      11. org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:115)
      12. org.jboss.seam.init.Initialization.init(Initialization.java:740)
      13. org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
      13 frames
    16. Glassfish Core
      StandardContext.start
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
      2. org.apache.catalina.core.StandardContext.start(StandardContext.java:4389)
      2 frames
    17. JBoss Application Server Tomcat
      TomcatDeployment.performDeploy
      1. org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
      2. org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
      2 frames
    18. JBoss Application Server Server
      WebModule.start
      1. org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
      2. org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
      3. org.jboss.web.deployers.WebModule.start(WebModule.java:97)
      3 frames
    19. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    20. org.jboss.mx
      ReflectedDispatcher.invoke
      1. org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
      1 frame
    21. JBoss Application Server J2SE
      MBeanServerImpl.invoke
      1. org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
      2. org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      3. org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      4. org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
      4 frames
    22. org.jboss.system
      ServiceProxy.invoke
      1. org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
      1 frame
    23. com.sun.proxy
      $Proxy38.start
      1. com.sun.proxy.$Proxy38.start(Unknown Source)
      1 frame
    24. org.jboss.system
      StartStopLifecycleAction.installAction
      1. org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
      2. org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
      2 frames
    25. JBoss Microcontainer Dependency
      AbstractControllerContext.install
      1. org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
      2. org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
      3. org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
      4. org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      4 frames
    26. org.jboss.system
      ServiceControllerContext.install
      1. org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)
      1 frame
    27. JBoss Microcontainer Dependency
      AbstractController.change
      1. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
      2. org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
      3. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
      4. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
      5. org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)
      6. org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      6 frames
    28. JBoss Application Server System
      ServiceDeployer.deploy
      1. org.jboss.system.ServiceController.doChange(ServiceController.java:688)
      2. org.jboss.system.ServiceController.start(ServiceController.java:460)
      3. org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
      4. org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
      5. org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
      5 frames
    29. JBoss Deployers SPI
      AbstractRealDeployer.deploy
      1. org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
      2. org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
      2 frames
    30. JBoss Deployers Impl
      DeployersImpl.install
      1. org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
      2. org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440)
      3. org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158)
      4. org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1179)
      5. org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1211)
      6. org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099)
      6 frames
    31. JBoss Microcontainer Dependency
      AbstractController.change
      1. org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      2. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
      3. org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
      4. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
      5. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
      6. org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)
      7. org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      7 frames
    32. JBoss Deployers Impl
      MainDeployerImpl.process
      1. org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782)
      2. org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
      2 frames
    33. JBoss Application Server System
      AbstractProfileService.install
      1. org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
      2. org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
      3. org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
      4. org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
      4 frames
    34. JBoss Microcontainer Dependency
      AbstractController.install
      1. org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      2. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
      3. org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
      4. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
      5. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
      6. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
      7. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
      7 frames
    35. JBoss Application Server System
      AbstractProfileService.registerProfile
      1. org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
      1 frame
    36. org.jboss.system
      ProfileServiceBootstrap.start
      1. org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
      1 frame
    37. org.jboss.bootstrap
      AbstractServerImpl.start
      1. org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
      1 frame
    38. JBoss Application Server Server
      Main$1.run
      1. org.jboss.Main.boot(Main.java:221)
      2. org.jboss.Main$1.run(Main.java:556)
      2 frames
    39. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:662)
      1 frame