1 Reply Latest reply on Feb 5, 2015 4:25 PM by Rich DiCroce

    System property "eclipselink.archive.factory" has no effect.

    Mehdi Raza Newbie

      Hi All

       

      In my wildfly+eclipse configuration, the provider "org.eclipse.persistence.jpa.PersistenceProvider" is picked up by Wildfly 8.2.0.Final properly, but as mentioned in JPA Reference Guide - WildFly 8 - Project Documentation Editor the system property "eclipselink.archive.factory" has no effect. Hence I am getting exception when my spring JPA repositories is initialized (autowired) having reference to JPA Entities without mentioning it in persistence.xml.

       

      However when I add class manually in persistence.xml using <class>[class name]</class> it works.

       

      The wildfly installation location "modules/system/layers/base/org/eclipse/persistence/main/module.xml" contains the following:

       

          <resources>

              <resource-root path="jipijapa-eclipselink-1.0.1.Final.jar"/>

             <resource-root path="org.eclipse.persistence.antlr-2.4.2.jar"/>

             <resource-root path="org.eclipse.persistence.asm-2.4.2.jar"/>

             <resource-root path="org.eclipse.persistence.core-2.4.2.jar"/>

             <resource-root path="org.eclipse.persistence.jpa.jpql-2.4.2.jar"/>

             <resource-root path="org.eclipse.persistence.jpa-2.4.2.jar"/>

          </resources>

       

      Here is logs when my application starts:

       

      03:38:34,159 WARN  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (MSC service thread 1-6) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.erp365.repositories.gl.account.AccountRepository com.erp365.services.gl.account.AccountServiceImpl.accountDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.erp365.model.gl.Account] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.erp365.model.gl.Account</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:301) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1186) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762) [spring-context-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) [spring-context-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) [spring-web-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) [spring-web-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:193) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)

        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]

        at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

      Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.erp365.repositories.gl.account.AccountRepository com.erp365.services.gl.account.AccountServiceImpl.accountDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.erp365.model.gl.Account] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.erp365.model.gl.Account</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:522) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:298) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        ... 22 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.erp365.model.gl.Account] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.erp365.model.gl.Account</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1021) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:964) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:862) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:494) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        ... 24 more

      Caused by: java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.erp365.model.gl.Account] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.erp365.model.gl.Account</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.

        at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entityEmbeddableManagedTypeNotFound(MetamodelImpl.java:174) [org.eclipse.persistence.jpa-2.4.2.jar:2.4.2]

        at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:489) [org.eclipse.persistence.jpa-2.4.2.jar:2.4.2]

        at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:68) [spring-data-jpa-1.7.2.RELEASE.jar:]

        at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:67) [spring-data-jpa-1.7.2.RELEASE.jar:]

        at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:145) [spring-data-jpa-1.7.2.RELEASE.jar:]

        at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:89) [spring-data-jpa-1.7.2.RELEASE.jar:]

        at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:69) [spring-data-jpa-1.7.2.RELEASE.jar:]

        at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:172) [spring-data-commons-1.9.2.RELEASE.jar:]

        at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239) [spring-data-commons-1.9.2.RELEASE.jar:]

        at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225) [spring-data-commons-1.9.2.RELEASE.jar:]

        at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) [spring-data-jpa-1.7.2.RELEASE.jar:]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) [spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]

        ... 34 more

        • 1. Re: System property "eclipselink.archive.factory" has no effect.
          Rich DiCroce Novice

          Have you tried a newer version of EclipseLink? And why use the separate, broken out EclipseLink JARs? I know from experience that the "uber JAR" EclipseLink works fine. We list all of our classes in persistence.xml though, and we don't use Spring.

           

          Could you post your WildFly configuration file, your persistence.xml, and the AccountServiceImpl class? You also may want to PM Scott Marlow and ask him to take a look at this thread. He handles all of the JPA stuff in WildFly.