openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Running with Karaf and Spring-Data
Date Thu, 30 Jan 2014 14:30:26 GMT
Hi Daniel,
OpenJPA is in the middle of parsing for persistent types.  And, while
parsing urls, it's coming across the one referenced in the exception
(bundle://143.10:1) that it can't read.  This looks to be related to some
osgi bundle.  Does that identifier mean anything to you?  Do you have your
entity classes specified in your persistence.xml?  Can you post your p.xml
file just to see if anything jumps out at us?

You're right that Spring does some classpath scanning, but it's still up to
OpenJPA to parse the Entity classes so that we can perform some byte-code
enhancement.

What else can you tell me about the environment?  It's Karaf, Spring, and
OpenJPA.  Anything else of interest?

Thanks,
Kevin


On Mon, Jan 27, 2014 at 4:47 PM, Daniel McGreal <daniel@redbite.com> wrote:

> Hi all.
>
> I started using Karaf 3.0.0 features for the Spring dependencies
> (3.1.4.RELEASE and OpenJPA 2.3.0).
>
> I now have an OpenJPA error:
>
> Exception in thread "SpringOsgiExtenderThread-2"
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'itemRepository': Injection of persistence dependencies
> failed; nested exception is <openjpa-2.3.0-r422266:1540826 nonfatal general
> error> org.apache.openjpa.util.GeneralException: Resource does not exist:
> bundle://143.10:1
> at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:343)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
> at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:589)
> at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
> at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
> at java.lang.Thread.run(Thread.java:722)
> Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
> org.apache.openjpa.util.GeneralException: Resource does not
> exist:bundle://143.10:1
> at
> org.apache.openjpa.meta.AbstractCFMetaDataFactory.getPersistentTypeNames(AbstractCFMetaDataFactory.java:635)
> at
> org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNamesInternal(MetaDataRepository.java:1478)
> at
> org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNames(MetaDataRepository.java:1470)
> at
> org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1522)
> at
> org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1513)
> at
> org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1493)
> at
> org.apache.openjpa.persistence.meta.MetamodelImpl.<init>(MetamodelImpl.java:84)
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:345)
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:59)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:376)
> at
> org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:517)
> at $Proxy33.getMetamodel(Unknown Source)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
> at $Proxy34.getMetamodel(Unknown Source)
> at
> org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.setEntityManager(JpaRepositoryFactoryBean.java:50)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:164)
> at
> org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92)
> at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:340)
> ... 15 more
> Caused by: java.io.IOException: Resource does not exist: bundle://143.10:1
> at
> org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(URLHandlersBundleURLConnection.java:60)
> at
> org.apache.felix.framework.URLHandlersBundleStreamHandler.openConnection(URLHandlersBundleStreamHandler.java:64)
> at java.net.URL.openConnection(URL.java:969)
> at java.net.URL.openStream(URL.java:1035)
> at
> org.apache.openjpa.lib.util.J2DoPrivHelper$43.run(J2DoPrivHelper.java:946)
> at
> org.apache.openjpa.lib.util.J2DoPrivHelper$43.run(J2DoPrivHelper.java:944)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.apache.openjpa.meta.AbstractCFMetaDataFactory.parsePersistentTypeNames(AbstractCFMetaDataFactory.java:769)
> at
> org.apache.openjpa.meta.AbstractCFMetaDataFactory.getPersistentTypeNames(AbstractCFMetaDataFactory.java:623)
> ... 44 more
>
>
> I don't understand it, but it sounds like this is the part where OpenJPA
> is loading entity definitions?
>
> I'm surprised as Spring-Data should have handled this with some class-path
> scanning:
>
>         @Bean
>     public LocalContainerEntityManagerFactoryBean
> entityManagerFactory(DataSource dataSource) throws ClassNotFoundException {
>         LocalContainerEntityManagerFactoryBean entityManagerFactory = new
> LocalContainerEntityManagerFactoryBean();
>
>         entityManagerFactory.setDataSource(dataSource);
>
> entityManagerFactory.setPackagesToScan("persistence.repository.jpa.entity");
>
> entityManagerFactory.setPersistenceProviderClass(PersistenceProviderImpl.class);
>         entityManagerFactory.setPersistenceUnitName("redbox");
>
>         {
>                 OpenJpaVendorAdapter vendorAdaptor = new
> OpenJpaVendorAdapter();
>                 vendorAdaptor.setDatabase(Database.POSTGRESQL);
>                 vendorAdaptor.setGenerateDdl(true);
>
>                 entityManagerFactory.setJpaVendorAdapter(vendorAdaptor);
>         }
>
>         return entityManagerFactory;
>     }
>
>
> I would greatly appreciate any help you can offer me.
>
> Best, Dan.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message