org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MCT' defined in com.myproject.JpaConfig: Invocation of init method failed; nested exception is org.hibernate.MappingException: Foreign key (FK2e496501ee5lgk3viylwiicsa:MANAGED_APP_TO_CON_TO_STRUCT [MANAGED_APP_TO_CONTACT_ID])) must have same number of columns as the referenced primary key (MANAGED_APPLICATION_TO_CONTACT [CONTACT_ID,MANAGED_APPLICATION_ID])

Stack Overflow | Andrew Mairose | 2 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Hibernate referencing a primary key that does not exist

    Stack Overflow | 2 months ago | Andrew Mairose
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MCT' defined in com.myproject.JpaConfig: Invocation of init method failed; nested exception is org.hibernate.MappingException: Foreign key (FK2e496501ee5lgk3viylwiicsa:MANAGED_APP_TO_CON_TO_STRUCT [MANAGED_APP_TO_CONTACT_ID])) must have same number of columns as the referenced primary key (MANAGED_APPLICATION_TO_CONTACT [CONTACT_ID,MANAGED_APPLICATION_ID])
  2. 0

    HTTP Status 500 - Servlet.init() for servlet spring threw exception. Error creating bean with name 'sessionFactory' defined in ServletContext resource - scriptscoop.com

    iswwwup.com | 1 year ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to load class declared as <mapping class="net.viralpatel.contact.form.Contact"/> in the configuration:
  3. 0

    HTTP status 500 error when deploying new spring 4 application | java - android - spring - spring-mvc

    solutionscore.com | 2 years ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to load class declared as <mapping class="net.viralpatel.contact.form.Contact"/> in the configuration:
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    HTTP Status 500 - Servlet.init() for servlet spring threw exception. Error creating bean with name 'sessionFactory' defined in ServletContext resource

    tagwith.com | 1 year ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to load class declared as <mapping class="net.viralpatel.contact.form.Contact"/> in the configuration:
  6. 0

    HTTP Status 500 - Servlet.init() for servlet spring threw exception. Error creating bean with name 'sessionFactory' defined in ServletContext resource

    Stack Overflow | 2 years ago | Tan Nguyen
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to load class declared as &lt;mapping class="net.viralpatel.contact.form.Contact"/&gt; in the configuration:

  1. tvrmsmith 4 times, last 6 months ago
  2. dafman 2 times, last 6 months ago
  3. Tahir 49 times, last 8 months ago
  4. Malcshour 8 times, last 10 months ago
  5. schoetty 6 times, last 11 months ago
14 more registered users
81 unregistered visitors
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. org.springframework.beans.factory.BeanCreationException

    Error creating bean with name 'MCT' defined in com.myproject.JpaConfig: Invocation of init method failed; nested exception is org.hibernate.MappingException: Foreign key (FK2e496501ee5lgk3viylwiicsa:MANAGED_APP_TO_CON_TO_STRUCT [MANAGED_APP_TO_CONTACT_ID])) must have same number of columns as the referenced primary key (MANAGED_APPLICATION_TO_CONTACT [CONTACT_ID,MANAGED_APPLICATION_ID])

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean()
  2. Spring Beans
    AbstractBeanFactory.getBean
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    4. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    5. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    6. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    7. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    7 frames
  3. Spring Context
    AbstractApplicationContext.refresh
    1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
    2. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829)
    3. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    3 frames
  4. Spring
    ContextLoaderListener.contextInitialized
    1. org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
    2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
    3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    3 frames
  5. Glassfish Core
    HostConfig.manageApp
    1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4990)
    2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
    3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    4. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    5. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    6. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    7. org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1763)
    7 frames
  6. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:483)
    4 frames
  7. Embedded GlassFish Web
    BaseModelMBean.invoke
    1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
    1 frame
  8. Java RT
    JmxMBeanServer.invoke
    1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    2. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    2 frames
  9. Embedded GlassFish Web
    MBeanFactory.createStandardContext
    1. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618)
    2. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565)
    2 frames
  10. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:483)
    4 frames
  11. Embedded GlassFish Web
    BaseModelMBean.invoke
    1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
    1 frame
  12. Java RT
    TCPTransport$ConnectionHandler.lambda$run$240
    1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    2. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    3. javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
    4. javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    5. javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
    6. javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
    7. javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)
    8. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    9. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    10. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    11. java.lang.reflect.Method.invoke(Method.java:483)
    12. sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
    13. sun.rmi.transport.Transport$1.run(Transport.java:200)
    14. sun.rmi.transport.Transport$1.run(Transport.java:197)
    15. java.security.AccessController.doPrivileged(Native Method)
    16. sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    17. sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
    18. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    19. sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$240(TCPTransport.java:683)
    19 frames