Announcement Announcement Module
Collapse
No announcement yet.
Error occured while running server Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error occured while running server

    Dear helps,

    I try to run my spring project by using STS. It ran at the first time! After I changed my code and ran again, errors occur. Could you please tell me if you know about this kind of error?

    Thanks!

    The error as below:

    ERROR org.springframework.web.context.ContextLoader - Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManagerFactory' defined in file [user\workspace\.metadata\.plugins\org.eclipse.wst. server.core\tmp0\wtpwebapps\vnbus\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: persistenceUnit] Unable to build EntityManagerFactory
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1486)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 95)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:223)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:292 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:1117)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:922)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:479)
    at org.springframework.web.context.ContextLoader.conf igureAndRefreshWebApplicationContext(ContextLoader .java:383)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 112)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4887)
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContext.java:5381)
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: javax.persistence.PersistenceException: [PersistenceUnit: persistenceUnit] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:915)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:890)
    at org.hibernate.ejb.HibernatePersistence.createConta inerEntityManagerFactory(HibernatePersistence.java :74)
    at org.springframework.orm.jpa.LocalContainerEntityMa nagerFactoryBean.createNativeEntityManagerFactory( LocalContainerEntityManagerFactoryBean.java:286)
    at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:310)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1483)
    ... 22 more
    Caused by: org.hibernate.HibernateException: Wrong column type in vnbus.country for column Continent. Found: enum, expected: varchar(10)
    at org.hibernate.mapping.Table.validateColumns(Table. java:376)
    at org.hibernate.cfg.Configuration.validateSchema(Con figuration.java:1275)
    at org.hibernate.tool.hbm2ddl.SchemaValidator.validat e(SchemaValidator.java:155)
    at org.hibernate.internal.SessionFactoryImpl.<init>(S essionFactoryImpl.java:506)
    at org.hibernate.cfg.Configuration.buildSessionFactor y(Configuration.java:1750)
    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>( EntityManagerFactoryImpl.java:94)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:905)
    ... 28 more

  • #2
    Looks like there is a type mismatch between the database schema and the Java object model. Looks like you should Java has an enum for Continent, but the DB is using a varchar.

    Comment


    • #3
      No Andrew! In my database column type in vnbus.country for column Continent is Enum, not varchar!

      Comment


      • #4
        Well, that's not what the error message says. I'm not too familiar with this, so I'd recommend asking somewhere else. Perhaps you can ask this question on stackoverflow.com. You may be able to get a better response there.

        Comment

        Working...
        X