Hi Nicolas,

Could you try using

 <dependency>
           <groupId>org.apache.openjpa</groupId>
           <artifactId>openjpa</artifactId>
           <version>1.2.1</version>
 </dependency>

OpenJPA aggregates several service files when we build our the final jar. It
looks like those service files are not on your classpath.

If that doesn't help could you post the entire pom.xml file that you're
using?

-mike

On Thu, Jul 2, 2009 at 3:09 AM, nfrancoi <[email protected]> wrote:

>
> Dear all,
>
> I face a problem when I try to make a flat executable JAR of an application
> that uses OpenJPA.
> My configuration files work perfectly on an application server
>
> It seams that some JAR are missing but in my pom.xml I specifie the
> following dependencies:
>
>  <dependency>
>            <groupId>org.apache.openjpa</groupId>
>            <artifactId>openjpa-persistence</artifactId>
>            <version>1.2.1</version>
>  </dependency>
>  <dependency>
>            <groupId>org.apache.openjpa</groupId>
>            <artifactId>openjpa-persistence-jdbc</artifactId>
>            <version>1.2.1</version>
>            <scope>runtime</scope>
>  </dependency>
>
> Do you have any idea of what is the problem?
>
> Thanks for your help,
>
>
> Nicolas
>
>
> Here stands the stack trace.
>
>
> Exception in thread "main"
> org.springframework.beans.factory.BeanCreationExcepti
> on: Error creating bean with name 'prmGeneratedProcessesDao': Injection of
> persi
> stence methods failed; nested exception is
> org.springframework.beans.factory.Bea
> nCreationException: Error creating bean with name 'gpEntityManagerFactory'
> defin
> ed in class path resource [daoContext.xml]: Invocation of init method
> failed; ne
> sted exception is <openjpa-1.2.1-r752877:753278 fatal user error>
> org.apache.ope
> njpa.persistence.ArgumentException: Could not invoke the static newInstance
> meth
> od on the named factory class "<<openjpa-1.2.1-r752877:753278 fatal user
> error>
> org.apache.openjpa.util.UserException: You did not name the factory class
> with t
> he required property openjpa.BrokerFactory.  Normally this property
> defaults
> app
> ropriately; have you forgotten to include all the OpenJPA jars in your
> classpath
> ?>".
>        at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc
>
> essor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:324)
>
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.populateBean(AbstractAutowireCapableBeanFactory.java:998)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
> ject(AbstractBeanFactory.java:264)
>        at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
> y.getSingleton(DefaultSingletonBeanRegistry.java:222)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
> an(AbstractBeanFactory.java:261)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean
> (AbstractBeanFactory.java:185)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean
> (AbstractBeanFactory.java:164)
>        at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.
> preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>        at
> org.springframework.context.support.AbstractApplicationContext.finish
> BeanFactoryInitialization(AbstractApplicationContext.java:728)
>        at
> org.springframework.context.support.AbstractApplicationContext.refres
> h(AbstractApplicationContext.java:380)
>        at
>
> org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
>        at
>
> org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)
>        at com.caceis.tacos.computations.Main.startLimitsJob(Main.java:70)
>        at com.caceis.tacos.computations.Main.main(Main.java:51)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creati
> ng bean with name 'gpEntityManagerFactory' defined in class path resource
> [daoCo
> ntext.xml]: Invocation of init method failed; nested exception is
> <openjpa-1.2.1
> -r752877:753278 fatal user error>
> org.apache.openjpa.persistence.ArgumentExcepti
> on: Could not invoke the static newInstance method on the named factory
> class "<
> <openjpa-1.2.1-r752877:753278 fatal user error>
> org.apache.openjpa.util.UserExce
> ption: You did not name the factory class with the required property
> openjpa.Bro
> kerFactory.  Normally this property defaults appropriately; have you
> forgotten t
> o include all the OpenJPA jars in your classpath?>".
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
> ject(AbstractBeanFactory.java:264)
>        at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
> y.getSingleton(DefaultSingletonBeanRegistry.java:222)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
> an(AbstractBeanFactory.java:261)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean
> (AbstractBeanFactory.java:185)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean
> (AbstractBeanFactory.java:164)
>        at
> org.springframework.orm.jpa.EntityManagerFactoryUtils.findEntityManag
> erFactory(EntityManagerFactoryUtils.java:99)
>        at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc
>
> essor.findNamedEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:
> 488)
>        at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc
>
> essor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:470)
>        at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc
>
> essor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProce
> ssor.java:599)
>        at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc
>
> essor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProces
> sor.java:570)
>        at
> org.springframework.beans.factory.annotation.InjectionMetadata$Inject
> edElement.inject(InjectionMetadata.java:192)
>        at
> org.springframework.beans.factory.annotation.InjectionMetadata.inject
> Methods(InjectionMetadata.java:117)
>        at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProc
>
> essor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:321)
>
>        ... 17 more
> Caused by: <openjpa-1.2.1-r752877:753278 fatal user error>
> org.apache.openjpa.pe
> rsistence.ArgumentException: Could not invoke the static newInstance method
> on t
> he named factory class "<<openjpa-1.2.1-r752877:753278 fatal user error>
> org.apa
> che.openjpa.util.UserException: You did not name the factory class with the
> requ
> ired property openjpa.BrokerFactory.  Normally this property defaults
> appropriat
> ely; have you forgotten to include all the OpenJPA jars in your
> classpath?>".
>        at
> org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:7
> 0)
>        at
> org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFacto
> ry(PersistenceProviderImpl.java:102)
>        at
> org.apache.openjpa.persistence.PersistenceProviderImpl.createContaine
> rEntityManagerFactory(PersistenceProviderImpl.java:142)
>        at
> org.apache.openjpa.persistence.PersistenceProviderImpl.createContaine
> rEntityManagerFactory(PersistenceProviderImpl.java:53)
>        at
> org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.cr
>
> eateNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
>        at
> org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPro
> pertiesSet(AbstractEntityManagerFactoryBean.java:291)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBean
> Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
>        ... 34 more
> Caused by: <openjpa-1.2.1-r752877:753278 fatal user error>
> org.apache.openjpa.pe
> rsistence.ArgumentException: You did not name the factory class with the
> require
> d property openjpa.BrokerFactory.  Normally this property defaults
> appropriately
> ; have you forgotten to include all the OpenJPA jars in your classpath?
>        at
> org.apache.openjpa.kernel.Bootstrap.getFactoryClass(Bootstrap.java:15
> 3)
>        at
> org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:111)
>
>        at
> org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:6
> 2)
>        ... 41 more
>
> --
> View this message in context:
> http://n2.nabble.com/UserException%3A-You-did-not-name-the-factory-class-with-the-required-property-openjpa.BrokerFactory-tp3193960p3193960.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Reply via email to