1 Reply Latest reply on Feb 29, 2012 1:43 PM by kblurry

    jboss 7 "error creating bean"

    kblurry

      I'm having errors upon deployment. It says something about beans not being created. I am running hibernate 3.3 anyway,

      Anyone know of a workaround?

       

      Error output:

       


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965) [spring-bea

      ns-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911) [spring-

      beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) [spring-beans-

      3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.

      0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

      ject(AbstractBeanFactory.java:293) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

      y.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.6.RELEAS

      E.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe

      an(AbstractBeanFactory.java:290) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

      (AbstractBeanFactory.java:192) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.BeanDefinitionValueResolver

      .resolveReference(BeanDefinitionValueResolver.java:322) [spring-beans-3.0.6.RELE

      ASE.jar:]


      ... 49 more

      Caused by: org.springframework.beans.BeanInstantiationException: Could not insta

      ntiate bean class [com.

      project.test.prices

      ]: Constructor threw exception; nested exception is org.springframework.

      beans.factory.BeanCreationException: Error creating bean with name 'pricesCont

      roller': Injection of autowired dependencies failed; nested exception is org.spr

      ingframework.beans.factory.BeanCreationException: Could not autowire field: priv

      ate com.project.test.prices com.project.test.prices

      Controller.pricesDao; nested exception is org.springframework.beans.factory.Be

      anCreationException: Error creating bean with name 'pricesDao': Injection of p

      ersistence dependencies failed; nested exception is org.springframework.beans.fa

      ctory.BeanCreationException: Error creating bean with name 'emf' defined in URL

      [vfs:/C:/jboss-as-7.1.0.CR1b/bin/content/prices.war/WEB-INF/classes/spri

      ng-servlet.xml]: Invocation of init method failed; nested exception is javax.per

      sistence.PersistenceException: [PersistenceUnit: PricestPU] Unable to bui

      ld EntityManagerFactory


      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1

      41) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.SimpleInstantiationStrategy

      .instantiate(SimpleInstantiationStrategy.java:74) [spring-beans-3.0.6.RELEASE.ja

      r:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958) [spring-bea

      ns-3.0.6.RELEASE.jar:]


      ... 57 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creati

      ng bean with name 'pricesController': Injection of autowired dependencies fail

      ed; nested exception is org.springframework.beans.factory.BeanCreationException:

      Could not autowire field: private com.project.test.prices; nested exception is org.s

      pringframework.beans.factory.BeanCreationException: Error creating bean with nam

      e 'pricesDao': Injection of persistence dependencies failed; nested exception

      is org.springframework.beans.factory.BeanCreationException: Error creating bean

      with name 'emf' defined in URL [vfs:/C:/jboss-as-7.1.0.CR1b/bin/content/

      prices.war/WEB-INF/classes/spring-servlet.xml]: Invocation of init method failed

      ; nested exception is javax.persistence.PersistenceException: [PersistenceUnit:

      PricestPU] Unable to build EntityManagerFactory


      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP

      ostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java

      :288) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) [spring-beans

      -3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-

      3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.

      0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

      ject(AbstractBeanFactory.java:293) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

      y.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.6.RELEAS

      E.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe

      an(AbstractBeanFactory.java:290) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

      (AbstractBeanFactory.java:192) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.DefaultListableBeanFactory.

      preInstantiateSingletons(DefaultListableBeanFactory.java:585) [spring-beans-3.0.

      6.RELEASE.jar:]


      at org.springframework.context.support.AbstractApplicationContext.finish

      BeanFactoryInitialization(AbstractApplicationContext.java:895) [spring-context-3

      .0.6.RELEASE.jar:]


      at org.springframework.context.support.AbstractApplicationContext.refres

      h(AbstractApplicationContext.java:425) [spring-context-3.0.6.RELEASE.jar:]


      at org.springframework.context.support.FileSystemXmlApplicationContext.<

      init>(FileSystemXmlApplicationContext.java:140) [spring-context-3.0.6.RELEASE.ja

      r:]


      at org.springframework.context.support.FileSystemXmlApplicationContext.<

      init>(FileSystemXmlApplicationContext.java:84) [spring-context-3.0.6.RELEASE.jar

      :]


      at com.project.security.AuthenticationSuccessHandlerImpl

      .<init>(AuthenticationSuccessHandlerImpl.java:30) [classes:]


      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      [:1.7.0_03]


      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

      [:1.7.0_03]


      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou

      rce) [:1.7.0_03]


      at java.lang.reflect.Constructor.newInstance(Unknown Source) [:1.7.0_03]

       


      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1

      26) [spring-beans-3.0.6.RELEASE.jar:]


      ... 59 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Could not au

      towire field: private com.project.test.prices com.project.test.prices.pricesDao; nested exception is org.springframewor

      k.beans.factory.BeanCreationException: Error creating bean with name 'pricesDa

      o': Injection of persistence dependencies failed; nested exception is org.spring

      framework.beans.factory.BeanCreationException: Error creating bean with name 'em

      f' defined in URL [vfs:/C:/jboss-as-7.1.0.CR1b/bin/content/prices.war/WE

      B-INF/classes/spring-servlet.xml]: Invocation of init method failed; nested exce

      ption is javax.persistence.PersistenceException: [PersistenceUnit:

      PricesPU] Unable to build EntityManagerFactory


      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP

      ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j

      ava:508) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.annotation.InjectionMetadata.inject

      (InjectionMetadata.java:84) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP

      ostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java

      :285) [spring-beans-3.0.6.RELEASE.jar:]


      ... 77 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creati

      ng bean with name 'pricesDao': Injection of persistence dependencies failed; n

      ested exception is org.springframework.beans.factory.BeanCreationException: Erro

      r creating bean with name 'emf' defined in URL [vfs:/C:/jboss-as-7.1.0.CR1b/bin/

      content/prices.war/WEB-INF/classes/spring-servlet.xml]: Invocation of in

      it method failed; nested exception is javax.persistence.PersistenceException: [P

      ersistenceUnit: PricesPU] Unable to build EntityManagerFactory


      at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc

      essor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:341)

      [spring-orm-3.0.5.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) [spring-beans

      -3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-

      3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.

      0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

      ject(AbstractBeanFactory.java:293) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

      y.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.6.RELEAS

      E.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe

      an(AbstractBeanFactory.java:290) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

      (AbstractBeanFactory.java:192) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.DefaultListableBeanFactory.

      findAutowireCandidates(DefaultListableBeanFactory.java:848) [spring-beans-3.0.6.

      RELEASE.jar:]


      at org.springframework.beans.factory.support.DefaultListableBeanFactory.

      doResolveDependency(DefaultListableBeanFactory.java:790) [spring-beans-3.0.6.REL

      EASE.jar:]


      at org.springframework.beans.factory.support.DefaultListableBeanFactory.

      resolveDependency(DefaultListableBeanFactory.java:707) [spring-beans-3.0.6.RELEA

      SE.jar:]


      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP

      ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j

      ava:480) [spring-beans-3.0.6.RELEASE.jar:]


      ... 79 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creati

      ng bean with name 'emf' defined in URL [vfs:/C:/jboss-as-7.1.0.CR1b/bin/content/

      Pricest.war/WEB-INF/classes/spring-servlet.xml]: Invocation of init metho

      d failed; nested exception is javax.persistence.PersistenceException: [Persisten

      ceUnit: PricestPU] Unable to build EntityManagerFactory


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) [spring-bea

      ns-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-

      3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.

      0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

      ject(AbstractBeanFactory.java:293) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

      y.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.6.RELEAS

      E.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe

      an(AbstractBeanFactory.java:290) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

      (AbstractBeanFactory.java:192) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.orm.jpa.EntityManagerFactoryUtils.findEntityManag

      erFactory(EntityManagerFactoryUtils.java:98) [spring-orm-3.0.5.RELEASE.jar:]


      at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc

      essor.findNamedEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:

      510) [spring-orm-3.0.5.RELEASE.jar:]


      at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc

      essor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:492)

      [spring-orm-3.0.5.RELEASE.jar:]


      at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc

      essor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProce

      ssor.java:656) [spring-orm-3.0.5.RELEASE.jar:]


      at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc

      essor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProces

      sor.java:629) [spring-orm-3.0.5.RELEASE.jar:]


      at org.springframework.beans.factory.annotation.InjectionMetadata$Inject

      edElement.inject(InjectionMetadata.java:147) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.annotation.InjectionMetadata.inject

      (InjectionMetadata.java:84) [spring-beans-3.0.6.RELEASE.jar:]


      at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc

      essor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:338)

      [spring-orm-3.0.5.RELEASE.jar:]


      ... 90 more

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit:

      PricesPU] Unable to build EntityManagerFactory


      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con

      figuration.java:914) [hibernate-entitymanager-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con

      figuration.java:890) [hibernate-entitymanager-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa

      ctory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.0.Final.jar:4.0

      .0.Final]


      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.cr

      eateNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)

      [spring-orm-3.0.5.RELEASE.jar:]


      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPro

      pertiesSet(AbstractEntityManagerFactoryBean.java:308) [spring-orm-3.0.5.RELEASE.

      jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [spring-

      beans-3.0.6.RELEASE.jar:]


      at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [spring-bea

      ns-3.0.6.RELEASE.jar:]


      ... 104 more

      Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.cat

      alyst.Prices.TeamProjects.projects references an unknown entity: com.cat

      alyst.Prices.Projects


      at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.ja

      va:109) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.cfg.Configuration.processEndOfQueue(Configuration.java:

      1514) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.cfg.Configuration.processFkSecondPassInOrder(Configurat

      ion.java:1437) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:

      1355) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav

      a:1724) [hibernate-core-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactor

      yImpl.java:76) [hibernate-entitymanager-4.0.0.Final.jar:4.0.0.Final]


      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con

      figuration.java:905) [hibernate-entitymanager-4.0.0.Final.jar:4.0.0.Final]


      ... 110 more

       

      09:13:14,602 ERROR [org.apache.catalina.core.StandardContext] (MSC service threa

      d 1-3) Error listenerStart

      09:13:14,603 ERROR [org.apache.catalina.core.StandardContext] (MSC service threa

      d 1-3) Context [/Prices] startup failed due to previous errors

      09:13:14,617 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-

      host].[/Prices]] (MSC service thread 1-3) Closing Spring root WebApplica

      tionContext

      09:13:14,620 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC0000

      1: Failed to start service jboss.web.deployment.default-host./Prices: or

      g.jboss.msc.service.StartException in service jboss.web.deployment.default-host.

      /Prices: failed to start context


      at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS

      ervice.java:82)


      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se

      rviceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]


      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont

      rollerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]


      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [:1

      .7.0_03]


      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:

      1.7.0_03]


      at java.lang.Thread.run(Unknown Source) [:1.7.0_03]

       

      09:13:14,845 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015

      856: Undeploy of deployment "prices.war" was rolled back with failure me

      ssage {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./Tea

      mAssessment" => "org.jboss.msc.service.StartException in service jboss.web.deplo

      yment.default-host./Prices: failed to start context"}}

      09:13:14,872 INFO  [org.jboss.jpa] (MSC service thread 1-1) JBAS011403: Stopping

      Persistence Unit Service 'prices.war#PricesPU'

      09:13:15,017 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Sto

      pped deployment Prices.war in 171ms

      09:13:15,019 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBA

      S014774: Service status report

      JBAS014777:   Services which failed to start:  service jboss.web.deployment.

      default-host./Prices: org.jboss.msc.service.StartException in service jb

      oss.web.deployment.default-host./Prices: failed to start context

       

      09:13:15,023 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-t

      hreads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps

      that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jbos

      s.web.deployment.default-host./Prices" => "org.jboss.msc.service.StartEx

      ception in service jboss.web.deployment.default-host./Prices: failed to

      start context"}}}}

        • 1. Re: jboss 7 "error creating bean"
          kblurry

          i got it fixed, just have to add these in persistence.xml

           

          <property name="hibernate.show_sql" value="false" />

                      <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />