dm Server
  1. dm Server
  2. DMS-47

missing package import errors not reported when using component-auto-scan

    Details

    • Type: Defect Defect
    • Status: Done Done
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: Sprint 4, 2.0.0.M2, 2.0.0.RELEASE
    • Component/s: None
    • Labels:
      None
    • Environment:

      Eclipse Ganymede on Ubuntu 8.04 + latest STS nightlies.

    • Story Points:
      2

      Description

      Create a bundle projet A where applicationContext.xml declares :

      • component auto scan on a package X
      • a dataSource (for a MySQL DB for example)

      In the package X, I create a class Dummy annotated by @Repository having a dependency on a DataSource (via @Resource).

      In the manifest, I import the Spring library and the mySQL Driver package, but not the javax.sql package.
      I also export the Dummy class as an OSGi service.

      I then create a second bundle B with a web personality and a controller where the Dummy service is injected into a controller (to force the publishing of the service).

      When trying to deploy the par file composed of A and B bundles, I get the following S2AP startup log:

      [2008-07-03 01:26:03.491] main <SPKB0001I> Platform starting.
      [2008-07-03 01:26:05.914] main <SPKE0000I> Boot subsystems installed.
      [2008-07-03 01:26:06.511] main <SPKE0001I> Base subsystems installed.
      [2008-07-03 01:26:07.169] platform-dm-1 <SPPM0000I> Installing profile 'web'.
      [2008-07-03 01:26:07.568] platform-dm-7 <SPSC0001I> Creating HTTP/1.1 connector with scheme http on port 7070.
      [2008-07-03 01:26:07.611] platform-dm-7 <SPSC0001I> Creating HTTP/1.1 connector with scheme https on port 7443.
      [2008-07-03 01:26:07.616] platform-dm-7 <SPSC0001I> Creating AJP/1.3 connector with scheme http on port 7009.
      [2008-07-03 01:26:07.691] platform-dm-7 <SPSC0000I> Starting ServletContainer.
      [2008-07-03 01:26:07.713] platform-dm-1 <SPPM0001I> Installed profile 'web'.
      [2008-07-03 01:26:08.174] platform-dm-14 <SPPM0002I> Platform open for business with profile 'web'.
      [2008-07-03 01:26:08.356] Deployer Recovery <SPSC1000I> Creating web application '/'.
      [2008-07-03 01:26:08.442] async-delivery-thread-1 <SPSC1001I> Starting web application '/'.
      [2008-07-03 01:26:08.675] Deployer Recovery <SPDE0010I> Deployment of 'platform.admin.splash-1.0.0.beta8.war' version '0' completed.
      [2008-07-03 01:26:09.030] Deployer Recovery <SPSC1000I> Creating web application '/admin'.
      [2008-07-03 01:26:09.101] async-delivery-thread-1 <SPSC1001I> Starting web application '/admin'.
      [2008-07-03 01:26:09.503] Deployer Recovery <SPDE0010I> Deployment of 'platform.admin.web-1.0.0.beta8.war' version '0' completed.
      [2008-07-03 01:26:10.284] Deployer Recovery <SPSC1000I> Creating web application '/services'.
      [2008-07-03 01:26:10.598] async-delivery-thread-1 <SPSC1001I> Starting web application '/services'.
      [2008-07-03 01:26:10.760] Deployer Recovery <SPDE0010I> Deployment of 'djo.q2.proto' version '1' completed.
      [2008-07-03 01:26:10.766] fs-watcher <SPDE0048I> Processing 'INITIAL' event for file 'platform.admin.splash-1.0.0.beta8.war'.
      [2008-07-03 01:26:10.770] fs-watcher <SPDE0048I> Processing 'INITIAL' event for file 'platform.admin.web-1.0.0.beta8.war'.
      [2008-07-03 01:26:32.650] platform-tomcat-thread-1 <SPSC1000I> Creating web application '/dummy'.
      [2008-07-03 01:26:33.858] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:26:35.852] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:26:39.853] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:26:47.853] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:27:02.714] async-delivery-thread-1 <SPWE1001E> Failed to create web application '/dummy': the associated web bundle 'djo.bug.sample-1-djo.bug.sample.consumer' failed to publish its ApplicationContext within 30 seconds.
      [2008-07-03 01:27:02.723] platform-tomcat-thread-1 <SPDE0040E> Deployment of module 'file [/home/djo/java/servers/springsource-ap-1.0.0.beta8/work/com.springsource.platform.deployer/Module/djo.bug.sample-1/djo.bug.sample.producer-1.0.0.jar]' took too long and timed out.
      [2008-07-03 01:27:02.848] platform-tomcat-thread-1 <SPDE0011E> Deployment failed.
      [2008-07-03 01:27:03.853] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:27:35.853] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:28:35.853] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:29:35.853] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:30:35.853] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:31:32.862] Timer-0 <SPDE0020E> Application context creation failure for bundle 'djo.bug.sample-1-djo.bug.sample.consumer'.
      org.springframework.context.ApplicationContextException: Application context initializition for 'djo.bug.sample-1-djo.bug.sample.consumer' has timed out
      at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.timeout(DependencyWaiterApplicationContextExecutor.java:427)
      at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.access$000(DependencyWaiterApplicationContextExecutor.java:51)
      at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$WatchDogTask.run(DependencyWaiterApplicationContextExecutor.java:114)
      at java.util.TimerThread.mainLoop(Timer.java:534)
      at java.util.TimerThread.run(Timer.java:484)

      [2008-07-03 01:31:35.854] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:32:35.854] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:33:35.854] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.
      [2008-07-03 01:34:35.854] service-monitor-thread-1 <SPCC0001W> Mandatory reference '&dummy' waiting for service with filter '(&(objectClass=djo.bug.sample.producer.api.IDummy)(com.springsource.platform.app.name=djo.bug.sample-1))'.

      No mention anywhere to a missing package import

      But when I disable component auto scan and proceed via full XML instead, I get a much better NCDFE :

      Caused by: java.lang.NoClassDefFoundError: javax/sql/DataSource
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2444)

      Anyway, I'll attach a sample project to reproduce this.

        Activity

        Hide
        Jawher Moussa added a comment -

        This archive contains:

        • djo.bug.sample : the Eclipse par project
        • djo.bug.sample.producer : the first bundle Eclipse project (the one causing trouble)
        • djo.bug.sample.consumer : the second bundle Eclipse project : it's just a way to force S2AP to actually handle the first bundle.

        Cheers,
        Jawher

        Show
        Jawher Moussa added a comment - This archive contains: djo.bug.sample : the Eclipse par project djo.bug.sample.producer : the first bundle Eclipse project (the one causing trouble) djo.bug.sample.consumer : the second bundle Eclipse project : it's just a way to force S2AP to actually handle the first bundle. Cheers, Jawher
        Jawher Moussa made changes -
        Field Original Value New Value
        Attachment djo.bug.sample.tar.gz [ 10093 ]
        Rob Harrop made changes -
        Fix Version/s 2.0 [ 10063 ]
        Ben Hale (c) made changes -
        Assignee Rob Harrop [ rharrop ]
        Ben Hale (c) made changes -
        Fix Version/s 2.0 [ 10063 ]
        Component/s DEPLOYMENT [ 10042 ]
        Issue Type Bug [ 6 ] Defect [ 12 ]
        Project SpringSource dm Server [ 10041 ] dm Server [ 10054 ]
        Affects Version/s 1.0 Beta 8 [ 10064 ]
        Key PLATFORM-110 DMS-47
        Ben Hale (c) made changes -
        Workflow jira [ 10579 ] dm Server Workflow [ 11426 ]
        Status Open [ 1 ] New [ 10003 ]
        Ben Hale (c) made changes -
        Story Points 2
        Ben Hale (c) made changes -
        Assignee Andy Wilkinson [ wilkinsona ]
        Ben Hale (c) made changes -
        Remaining Estimate 4h [ 14400 ]
        Original Estimate 4h [ 14400 ]
        Ben Hale (c) made changes -
        Fix Version/s 2.0.0.M2 [ 10172 ]
        Fix Version/s Sprint 4 [ 10213 ]
        Fix Version/s 2.0.0.RELEASE [ 10171 ]
        Andy Wilkinson made changes -
        Status To Do [ 10003 ] In Progress [ 3 ]
        Hide
        Andy Wilkinson added a comment -

        Thanks for the Eclipse projects, they made it much easier to look into this.

        We've done a lot of work on error reporting in Spring, Spring DM, and dm Server and, thankfully, this problem has been fixed. On 1.0.2.RELEASE of dm Server, deploying the PAR produces the following error message:

        [2009-05-05 13:52:21.716] server-dm-1 <SPDE0020E> Application context creation failure for bundle 'the_par-1-djo.bug.sample'.
        java.lang.NoClassDefFoundError: javax/sql/DataSource
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
        at java.lang.Class.getDeclaredMethods(Class.java:1763)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:460)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:443)
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:363)
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:296)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:745)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:448)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(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.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:288)
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
        at com.springsource.server.kernel.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:82)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:613)

        The PersistenceAnnotationBeanPostProcessor is identifying the javax.sql.DataSource type and attempting to load it. This then results in the expected NCDFE, rather than failing silently.

        Show
        Andy Wilkinson added a comment - Thanks for the Eclipse projects, they made it much easier to look into this. We've done a lot of work on error reporting in Spring, Spring DM, and dm Server and, thankfully, this problem has been fixed. On 1.0.2.RELEASE of dm Server, deploying the PAR produces the following error message: [2009-05-05 13:52:21.716] server-dm-1 <SPDE0020E> Application context creation failure for bundle 'the_par-1-djo.bug.sample'. java.lang.NoClassDefFoundError: javax/sql/DataSource at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2395) at java.lang.Class.getDeclaredMethods(Class.java:1763) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:460) at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:443) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:363) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:296) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:745) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:448) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(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.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:288) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145) at com.springsource.server.kernel.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:82) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:613) The PersistenceAnnotationBeanPostProcessor is identifying the javax.sql.DataSource type and attempting to load it. This then results in the expected NCDFE, rather than failing silently.
        Andy Wilkinson logged work - 05/May/09 6:04 AM - Restricted to
        • Time Spent:
          20m
           
          <No comment>
        Andy Wilkinson made changes -
        Remaining Estimate 4h [ 14400 ] 3h 40m [ 13200 ]
        Time Spent 20m [ 1200 ]
        Andy Wilkinson logged work - 05/May/09 6:04 AM - Restricted to
        • Time Spent:
          1m
           
          GREENHOPPER AUTO-RESET
        Andy Wilkinson made changes -
        Time Spent 20m [ 1200 ] 0.35h [ 1260 ]
        Remaining Estimate 3h 40m [ 13200 ] 0h [ 0 ]
        Andy Wilkinson made changes -
        Status In Progress [ 3 ] Done [ 10004 ]
        Resolution Complete [ 13 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open To Do To Do
        231d 12h 18m 1 Ben Hale (c) 19/Feb/09 4:04 AM
        To Do To Do In Progress In Progress
        75d 30m 1 wilkinsona 05/May/09 5:35 AM
        In Progress In Progress Done Done
        29m 3s 1 wilkinsona 05/May/09 6:04 AM

          People

          • Assignee:
            Andy Wilkinson
            Reporter:
            Jawher Moussa
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              First Response Date:

              Time Tracking

              Estimated:
              Original Estimate - 4h
              4h
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 0.35h Time Not Required
              0.35h