Announcement Announcement Module
Collapse
No announcement yet.
Spring Data Graph in OSGi environment Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data Graph in OSGi environment

    Hello everyone

    Has anyone managed to get SDG running in an OSGi environment?
    I'm trying to get is up an running in Virgo 3.0.0.M04 without much success.

    After fixing the imports of the org.springframework.data.neo4j bundle (see this bug report), I get the following error when starting my neo4j example bundle:

    Code:
    [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)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.ClassNotFoundException: org.springframework.data.graph.neo4j.config.Neo4jConfiguration not found from bundle [com.example.eranger.neo4j.domain]
    	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
    	at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    	at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
    	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
    	at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:237)
    	... 15 common frames omitted
    Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.springframework.data.graph.neo4j.config.Neo4jConfiguration in KernelBundleClassLoader: [bundle=com.example.eranger.neo4j.domain_0.0.1.BUILD-SNAPSHOT]
    	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
    	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
    	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
    	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
    	... 20 common frames omitted
    Caused by: java.lang.ClassNotFoundException: org.springframework.data.graph.neo4j.config.Neo4jConfiguration
    	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
    	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)
    	... 25 common frames omitted
    It seems as if CGLIB cannot enhance the node entity class.
    Any ideas how this could be set up to work?

  • #2
    BTW: The org.springframework.data.graph.neo4j bundle is ACTIVE and the class org.springframework.data.graph.neo4j.config.Neo4jC onfiguration is visible from within Virgo (checked with clhas and clexport).

    When debugging the code, it reaches the method ClassUtils.forName(String name, ClassLoader classLoader) with "org.springframework.data.graph.neo4j.config.Neo4j Configuration" as the name and "BundleDelegatingClassLoader" as the ClassLoader, so this seems to make sense.

    Any ideas why the class cannot be loaded?

    Comment


    • #3
      as it says in the log: Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedCl assNotFoundException: org.springframework.data.graph.neo4j.config.Neo4jC onfiguration in KernelBundleClassLoader: [bundle=com.example.eranger.neo4j.domain_0.0.1.BUIL D-SNAPSHOT]


      add Import-Package: org.springframework.data.graph.neo4j.config to your bundle com.example.eranger.neo4j.domain and it should work (or throw another exception)

      Comment


      • #4
        I added the Import-Package declaration, and ran into other issues, where I got stuck now (see also this mailing list thread).
        Now it seems as if the CGLIB enhanced class of Neo4jConfiguration cannot be found.

        Comment


        • #5
          First of all, Exception? Have you tried dynamic import package?

          You know that theres "always" trouble @OSGi with "dirty" things like enhanced classes and so on?

          Comment

          Working...
          X