This could be the problem, yes. The "repository factories" that create
the repositories from the interface definitions would need to import
the domain specific packages that contain the interfaces to have
access to them - which requires buddy loading.

It seems as if the CGLIB enhanced class
org.springframework.data.graph.neo4j.config.Neo4jConfiguration cannot
be created when the app starts up. This is the relevant part of the
log file:

[2011-05-16 15:10:49.467] region-dm-3
o.s.beans.factory.support.DefaultListableBeanFactory
Creating shared instance of singleton bean
'org.springframework.data.graph.neo4j.config.Neo4jConfiguration#0'
[2011-05-16 15:10:49.467] region-dm-3
o.s.beans.factory.support.DefaultListableBeanFactory
Creating instance of bean
'org.springframework.data.graph.neo4j.config.Neo4jConfiguration#0'
[2011-05-16 15:10:49.471] region-dm-3
org.springframework.beans.factory.annotation.InjectionMetadata
Found injected element on class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448$$EnhancerByCGLIB$$e7c2c330$$EnhancerByCGLIB$$4422c70a]:
AutowiredFieldElement for private javax.validation.Validator
org.springframework.data.graph.neo4j.config.Neo4jConfiguration.validator
[2011-05-16 15:10:49.471] region-dm-3
org.springframework.beans.factory.annotation.InjectionMetadata
Found injected element on class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448$$EnhancerByCGLIB$$e7c2c330$$EnhancerByCGLIB$$4422c70a]:
AutowiredMethodElement for public void
org.springframework.data.graph.neo4j.config.Neo4jConfiguration.setGraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService)
[2011-05-16 15:10:49.471] region-dm-3
org.springframework.beans.factory.annotation.InjectionMetadata
Found injected element on class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448$$EnhancerByCGLIB$$e7c2c330$$EnhancerByCGLIB$$4422c70a]:
AutowiredMethodElement for public void
org.springframework.data.graph.neo4j.config.Neo4jConfiguration.setEntityManagerFactory(javax.persistence.EntityManagerFactory)
[2011-05-16 15:10:49.471] region-dm-3
o.s.beans.factory.support.DefaultListableBeanFactory
Eagerly caching bean
'org.springframework.data.graph.neo4j.config.Neo4jConfiguration#0' to
allow for resolving potential circular references
[2011-05-16 15:10:49.471] region-dm-3
org.springframework.beans.CachedIntrospectionResults
Getting BeanInfo for class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448$$EnhancerByCGLIB$$e7c2c330$$EnhancerByCGLIB$$4422c70a]
[2011-05-16 15:10:49.472] region-dm-3
org.springframework.osgi.util.DebugUtils
Could not find class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448$$EnhancerByCGLIB$$e7c2c330$$EnhancerByCGLIB$$4422c70aBeanInfo]
required by [neo4j.domain(com.example.neo4j.domain)] scanning
available bundles
[2011-05-16 15:10:49.472] region-dm-3
org.springframework.osgi.util.DebugUtils
Class is correctly imported as version [1.0.0], checking providing
bundles
[2011-05-16 15:10:49.476] region-dm-3
org.springframework.osgi.util.DebugUtils
Bundle [Spring Data Neo4J (org.springframework.data.neo4j)] exports
[org.springframework.data.graph.neo4j.config] as version
[1.1.0.BUILD-SNAPSHOT] but version [1.0.0] was required
[2011-05-16 15:10:49.477] region-dm-3
org.springframework.osgi.util.DebugUtils
Could not find class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448$$EnhancerByCGLIB$$e7c2c330BeanInfo]
required by [neo4j.domain(com.example.neo4j.domain)] scanning
available bundles
[2011-05-16 15:10:49.477] region-dm-3
org.springframework.osgi.util.DebugUtils
Class is correctly imported as version [1.0.0], checking providing
bundles
[2011-05-16 15:10:49.481] region-dm-3
org.springframework.osgi.util.DebugUtils
Bundle [Spring Data Neo4J (org.springframework.data.neo4j)] exports
[org.springframework.data.graph.neo4j.config] as version
[1.1.0.BUILD-SNAPSHOT] but version [1.0.0] was required
[2011-05-16 15:10:49.482] region-dm-3
org.springframework.osgi.util.DebugUtils
Could not find class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448BeanInfo]
required by [neo4j.domain(com.example.neo4j.domain)] scanning
available bundles
[2011-05-16 15:10:49.482] region-dm-3
org.springframework.osgi.util.DebugUtils
Class is correctly imported as version [1.0.0], checking providing
bundles
[2011-05-16 15:10:49.486] region-dm-3
org.springframework.osgi.util.DebugUtils
Bundle [Spring Data Neo4J (org.springframework.data.neo4j)] exports
[org.springframework.data.graph.neo4j.config] as version
[1.1.0.BUILD-SNAPSHOT] but version [1.0.0] was required
[2011-05-16 15:10:49.487] region-dm-3
org.springframework.osgi.util.DebugUtils
Could not find class
[org.springframework.data.graph.neo4j.config.Neo4jConfigurationBeanInfo]
required by [neo4j.domain(com.example.neo4j.domain)] scanning
available bundles
[2011-05-16 15:10:49.487] region-dm-3
org.springframework.osgi.util.DebugUtils
Class is correctly imported as version [1.0.0], checking providing
bundles
[2011-05-16 15:10:49.491] region-dm-3
org.springframework.osgi.util.DebugUtils
Bundle [Spring Data Neo4J (org.springframework.data.neo4j)] exports
[org.springframework.data.graph.neo4j.config] as version
[1.1.0.BUILD-SNAPSHOT] but version [1.0.0] was required
[2011-05-16 15:10:49.492] region-dm-3
org.springframework.osgi.util.DebugUtils
Could not find class [java.lang.ObjectBeanInfo] required by
[neo4j.domain(com.example.neo4j.domain)] scanning available bundles
[2011-05-16 15:10:49.493] region-dm-3
org.springframework.beans.CachedIntrospectionResults
Caching PropertyDescriptors for class
[org.springframework.data.graph.neo4j.config.Neo4jConfiguration$$EnhancerByCGLIB$$775b2448$$EnhancerByCGLIB$$e7c2c330$$EnhancerByCGLIB$$4422c70a]
[2011-05-16 15:10:49.493] region-dm-3
org.springframework.beans.CachedIntrospectionResults
Found bean property 'class' of type [java.lang.Class]
[2011-05-16 15:10:49.493] region-dm-3
org.springframework.beans.CachedIntrospectionResults
Found bean property 'entityManagerFactory' of type
[javax.persistence.EntityManagerFactory]


2011/5/15 Neale Upstone <neale.upst...@opencredo.com>:
>  In OSGi, missing classes can be down to which bundles are visible to
> the bundle doing the scanning.  In this case, whatever is doing the
> classpath scanning cannot see the bundle exporting your domain package.
>
>  From a number of years back, I remember having to use
> eclipse-registerbuddy to solve a classloader visibility issue.  I'm not
> sure what the standard approach to this became.  A quick search doesn't
> deliver anything definitive for bundle-buddypolicy, which I suspect is
> the standardised mechanism.
>
>
>
> On 13/05/2011 15:10, Jean-Pierre Bergamin wrote:
>> I just could resove some more issues.
>> First of all I had to excplicitely add an Import-Package directive in
>> the template.mf of our project for packages that are not recognized by
>> bundlor (as the one for the missing Neo4jConfiguration):
>>
>> Import-Package:
>>   org.springframework.data.graph.neo4j.config;version="[1.1.0, 1.2.0)",
>>   org.springframework.data.repository.support;version="[1.0.0, 1.2.0)",
>>   org.springframework.transaction.aspectj;version="[3.0, 3.1)"
>>
>> I also had to put Import-Pacakge statements for cglib packages to the
>> spring data neo4j bundle.
>>
>> The next problem I'm facing is that graph repositories cannot be
>> injected, because they seem not to be created by SDG:
>>
>> [2011-05-13 16:06:29.786] region-dm-0<AG0000E>
>> Application context creation failure for bundle
>> 'com.example.neo4j.domain' version '0.0.1.BUILD-SNAPSHOT'.
>> org.springframework.beans.factory.BeanCreationException: Error
>> creating bean with name 'serviceRepositoryImpl': Injection of
>> autowired dependencies failed; nested exception is
>> org.springframework.beans.factory.BeanCreationException: Could not
>> autowire field: private com.example.neo4j.ServiceRepository
>> com.example.neo4j.ServiceRepositoryImpl.serviceRepository; nested
>> exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
>> No matching bean of type [com.example.neo4j.ServiceRepository] found
>> for dependency: expected at least 1 bean which qualifies as autowire
>> candidate for this dependency. Dependency annotations:
>> {@org.springframework.beans.factory.annotation.Autowired(required=true)}
>>       at 
>> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
>>       at 
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
>>       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:291)
>>       at 
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>       at 
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>>       at 
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>>       at 
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>>       at 
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>>       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 
>> org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)
>>       at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>       at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>       at java.lang.Thread.run(Thread.java:662)
>> Caused by: org.springframework.beans.factory.BeanCreationException:
>> Could not autowire field: private com.example.neo4j.ServiceRepository
>> com.example.neo4j.ServiceRepositoryImpl.serviceRepository; nested
>> exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
>> No matching bean of type [com.example.neo4j.ServiceRepository] found
>> for dependency: expected at least 1 bean which qualifies as autowire
>> candidate for this dependency. Dependency annotations:
>> {@org.springframework.beans.factory.annotation.Autowired(required=true)}
>>       at 
>> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)
>>       at 
>> org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
>>       at 
>> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)
>>       ... 18 common frames omitted
>> Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
>> No matching bean of type [com.example.neo4j.ServiceRepository] found
>> for dependency: expected at least 1 bean which qualifies as autowire
>> candidate for this dependency. Dependency annotations:
>> {@org.springframework.beans.factory.annotation.Autowired(required=true)}
>>       at 
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:920)
>>       at 
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:789)
>>       at 
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
>>       at 
>> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)
>>       ... 20 common frames omitted
>>
>>
>> Any ideas about that?
>>
>>
>> Best regards,
>> James
>>
>>
>> 2011/5/13 Jean-Pierre Bergamin<jpberga...@gmail.com>:
>>> SDG is using bundlor to generate the MANIFEST.MF file.I already fixed
>>> the MANIFEST and the spring data neo4j bundle can now be resolved.
>>>
>>> But when the spring application context is loaded, the class
>>> "org.springframework.data.graph.neo4j.config.Neo4jConfiguration"
>>> cannot be found during bean postprocessing and aspectj magic (see
>>> stacktrace below).
>>> The class is available and exported. I checked that with clhas and
>>> clexport on the Virgo console. Does maybe the kernel space of Virgo
>>> has to to know the spring data neo4j bundle, because this aspectj
>>> "enhancements" are performed there?
>>>
>>>
>>> Best regards
>>> James
>>>
>>> [2011-05-12 16:44:23.865] region-dm-14<AG0000E>
>>> Application context creation failure for bundle
>>> 'com.example.neo4j.domain' version '0.0.1.BUILD-SNAPSHOT'.
>>> java.lang.IllegalStateException: Cannot load configuration class:
>>> org.springframework.data.graph.neo4j.config.Neo4jConfiguration
>>>         at 
>>> org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:246)
>>>         at 
>>> org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:160)
>>>         at 
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:479)
>>>         at 
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:467)
>>>         at 
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:395)
>>>         at 
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:281)
>>>         at 
>>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>>>         at 
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)
>>>         at 
>>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)
>>>         at 
>>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)
>>>         at 
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
>>>         at 
>>> org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)
>>>         at 
>>> org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)
>>>         at 
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>         at 
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>
>>>
>>>
>>> 2011/5/13 Nicolas Jouanin<nicolas.joua...@gmail.com>
>>>> Well, at the minimum, it's only a question of adding some extra headers
>>>> (Bundle-Symbolic, Export-Package; ...) in the package MANIFEST and this can
>>>> be done automatically using the maven-bundle-plugin.
>>>> You can have a look at Neo4j pom file or this second article :
>>>> http://wiki.escapek.org/display/DEV/Create+OSGi+bundle+from+regular+jar+archive
>>>>
>>>>
>>>>
>>>> 2011/5/13 Michael Hunger<michael.hun...@neotechnology.com>
>>>>
>>>>> The issue is about Spring Data Graph not being correctly packaged as OSGi
>>>>> bundle / compatible jar.
>>>>>
>>>>> And I have neither the knowledge nor the resources at the moment to fix
>>>>> that.
>>>>>
>>>>> So if any one of you can help out with that, this would be most welcome.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Michael
>>>>>
>>>>> Am 13.05.2011 um 11:42 schrieb Nicolas Jouanin:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I've written an article [1] showing how to run neo4j embedded database
>>>>>> inside an OSGi container. Starting from that I think you can create a
>>>>> bundle
>>>>>> which uses this database to create the appropriate Spring data
>>>>>> configuration. I suppose that spring-data-graph is packaged as a OSGi
>>>>>> compatible jar, so using spring-dm too should do it.
>>>>>>
>>>>>>
>>>>>> [1]
>>>>> http://wiki.escapek.org/display/DEV/Neo4j+community+edition+installation
>>>>>> 2011/5/13 Michael Hunger<michael.hun...@neotechnology.com>
>>>>>>
>>>>>>> I'm no expert in OSGi so I did just the minimal thing, adding bundlor
>>>>>>> information to the maven build. This is obviously not successful enough.
>>>>>>>
>>>>>>> So I would be very happy I someone would pull spring data graph put in
>>>>> the
>>>>>>> correct OSGi information and send me a pull request.
>>>>>>>
>>>>>>> Cheers
>>>>>>>
>>>>>>> Michael
>>>>>>>
>>>>>>> Am 13.05.2011 um 11:26 schrieb Jean-Pierre Bergamin:
>>>>>>>
>>>>>>>> Dear neo4j community
>>>>>>>>
>>>>>>>> I'm so free to cross post a question to this list that I already posted
>>>>>>> in
>>>>>>>> the spring forum (
>>>>>>>>
>>>>> http://forum.springsource.org/showthread.php?109267-Spring-Data-Graph-in-OSGi-environment
>>>>>>> ),
>>>>>>>> since most of the SDG experts probably are subscribed to this list. ;-)
>>>>>>>> Could anyone get spring data graph successfully up and running in an
>>>>> OSGi
>>>>>>>> container?
>>>>>>>>
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> James
>
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to