Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Spring Composite Applications Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Composite Applications

    Is it possible to build a Spring DM bundle that composes one or more Spring components packaged as standard jars built via Maven?

    For instance, build a (non-OSGI bundle) service.date.jar, with the following context:

    <context:component-scan base-package="service.date"/>

    Then build an app.osgi.date.jar bundle that contains a dependency on service.date.jar. It has the following context:

    <import resource="classpath*:service.date.context.xml"/>

    <osgi:service id="dateService"
    ref="dateService"
    interface="service.date.DateService"/>

    The packaged app.osgi.date.jar, an OSGi bundle, contains the service.date.jar, a standard jar. The bundle plugin configuration is:

    <Export-Package>
    service.date.*;version=${version}
    </Export-Package>
    <Include-Resource>
    src/main/resources
    </Include-Resource>
    <Embed-Dependency>
    *;scope=compile|runtime
    </Embed-Dependency>

    Running an AbstractConfigurableBundleCreatorTests integration test, though, produces the following exception:

    Caused by: org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Import-Package: service.date; version="0.0.0"

    Overriding getTestBundlesName(), per the Spring DM documentations, does not resolve the above exception.

    Also the above import of the service.date.context.xml is not processed, according to the log.

    This leads me to believe that one 'can not' build a Spring DM bundle that imports and autowires together a set of Spring components packaged as standard jars. Is this true?
    Last edited by Javawerks; Sep 13th, 2008, 01:59 PM. Reason: clarification

  • #2
    What exactly do you mean by standard jars? Having a bundle that contains the jars internally? If so, then make sure you add the jars inside the bundle classpath since otherwise they will not be picked up.

    Comment


    • #3
      Spring Composite Applications

      A standard jar from a maven repository. My manifest:

      Code:
      Manifest-Version: 1.0
      Export-Package: com.ihg.crm.offline.transformation.booking;uses:="com.
       ihg.crm.offline.model.booking,org.xml.sax,javax.xml.transform,javax.x
       ml.transform.stream,javax.xml.validation,org.apache.commons.io,javax.
       xml.bind",com.ihg.crm.offline.service.booking;uses:="com.ihg.persiste
       nce.hibernate,org.aspectj.lang,com.ihg.crm.offline.model.booking,java
       x.xml.namespace,org.springframework.transaction.aspectj,org.aspectj.l
       ang.reflect,org.springframework.transaction.annotation,org.aspectj.ru
       ntime.reflect,javax.xml.bind.annotation,javax.xml.bind",com.ihg.crm.o
       ffline.message.listener.booking;uses:="com.ihg.crm.offline.transforma
       tion.booking,org.springframework.jms.support.converter,com.ihg.crm.of
       fline.service.booking,javax.jms",com.ihg.crm.offline.model.booking.ut
       il;uses:="javax.xml.bind",com.ihg.crm.offline.model.booking;uses:="or
       g.jvnet.jaxb2_commons.lang.builder,org.apache.commons.lang.builder,ja
       vax.xml.bind.annotation,com.ihg.crm.offline.model.booking.util,javax.
       xml.bind.annotation.adapters,javax.xml.bind,org.jvnet.jaxb2_commons.l
       ang,javax.xml.namespace"
      Private-Package: org.springframework.asm,org.springframework.asm.commo
       ns,org.springframework.asm.signature,org.springframework.beans,org.sp
       ringframework.beans.annotation,org.springframework.beans.factory,org.
       springframework.beans.factory.access,org.springframework.beans.factor
       y.access.el,org.springframework.beans.factory.annotation,org.springfr
       amework.beans.factory.config,org.springframework.beans.factory.generi
       c,org.springframework.beans.factory.parsing,org.springframework.beans
       .factory.serviceloader,org.springframework.beans.factory.support,org.
       springframework.beans.factory.wiring,org.springframework.beans.factor
       y.xml,org.springframework.beans.propertyeditors,org.springframework.b
       eans.support,org.springframework.context,org.springframework.context.
       access,org.springframework.context.annotation,org.springframework.con
       text.config,org.springframework.context.event,org.springframework.con
       text.i18n,org.springframework.context.support,org.springframework.con
       text.weaving,org.springframework.core,org.springframework.core.annota
       tion,org.springframework.core.enums,org.springframework.core.io,org.s
       pringframework.core.io.support,org.springframework.core.style,org.spr
       ingframework.core.task,org.springframework.core.task.support,org.spri
       ngframework.core.type,org.springframework.core.type.classreading,org.
       springframework.core.type.filter,org.springframework.ejb.access,org.s
       pringframework.ejb.config,org.springframework.ejb.interceptor,org.spr
       ingframework.ejb.support,org.springframework.instrument.classloading,
       org.springframework.instrument.classloading.glassfish,org.springframe
       work.instrument.classloading.oc4j,org.springframework.instrument.clas
       sloading.weblogic,org.springframework.jmx,org.springframework.jmx.acc
       ess,org.springframework.jmx.export,org.springframework.jmx.export.ann
       otation,org.springframework.jmx.export.assembler,org.springframework.
       jmx.export.metadata,org.springframework.jmx.export.naming,org.springf
       ramework.jmx.export.notification,org.springframework.jmx.support,org.
       springframework.jndi,org.springframework.jndi.support,org.springframe
       work.metadata,org.springframework.metadata.commons,org.springframewor
       k.osgi.extender,org.springframework.osgi.extender.event,org.springfra
       mework.osgi.extender.internal.activator,org.springframework.osgi.exte
       nder.internal.dependencies.shutdown,org.springframework.osgi.extender
       .internal.dependencies.startup,org.springframework.osgi.extender.inte
       rnal.support,org.springframework.osgi.extender.internal.util.concurre
       nt,org.springframework.osgi.extender.support,org.springframework.osgi
       .extender.support.internal,org.springframework.osgi.extender.support.
       scanning,org.springframework.remoting,org.springframework.remoting.rm
       i,org.springframework.remoting.soap,org.springframework.remoting.supp
       ort,org.springframework.scheduling,org.springframework.scheduling.bac
       kportconcurrent,org.springframework.scheduling.concurrent,org.springf
       ramework.scheduling.support,org.springframework.scheduling.timer,org.
       springframework.scripting,org.springframework.scripting.bsh,org.sprin
       gframework.scripting.config,org.springframework.scripting.groovy,org.
       springframework.scripting.jruby,org.springframework.scripting.support
       ,org.springframework.stereotype,org.springframework.ui,org.springfram
       ework.ui.context,org.springframework.ui.context.support,org.springfra
       mework.util,org.springframework.util.comparator,org.springframework.u
       til.xml,org.springframework.validation
      Bundle-ClassPath: .,model.booking-0.1-SNAPSHOT.jar,transformation.book
       ing-0.1-SNAPSHOT.jar,spring-osgi-extender-1.1.1.jar,service.booking-0
       .1-SNAPSHOT.jar,spring-beans-2.5.5.jar,spring-context-2.5.5.jar,messa
       ge.listener.booking-0.1-SNAPSHOT.jar,spring-core-2.5.5.jar
      Built-By: funkmi
      Tool: Bnd-0.0.238
      Bundle-Name: Booking OSGi Application
      Created-By: Apache Maven Bundle Plugin
      Build-Jdk: 1.6.0_07
      Bundle-Version: 0.1.0.SNAPSHOT
      Eclipse-BuddyPolicy: registered
      Bnd-LastModified: 1222180256217
      Bundle-ManifestVersion: 2
      Import-Package: bsh,com.ihg.crm.offline.message.listener.booking,com.i
       hg.crm.offline.model.booking,com.ihg.crm.offline.model.booking.util,c
       om.ihg.crm.offline.service.booking,com.ihg.crm.offline.transformation
       .booking,com.ihg.persistence.hibernate,com.sun.enterprise.loader,com.
       sun.net.httpserver,edu.emory.mathcs.backport.java.util.concurrent,gro
       ovy.lang,javax.annotation,javax.ejb,javax.el,javax.interceptor,javax.
       jms,javax.management,javax.management.modelmbean,javax.management.ope
       nmbean,javax.management.remote,javax.naming,javax.persistence.spi,jav
       ax.rmi,javax.rmi.CORBA,javax.xml.bind,javax.xml.bind.annotation,javax
       .xml.bind.annotation.adapters,javax.xml.namespace,javax.xml.parsers,j
       avax.xml.transform,javax.xml.transform.stream,javax.xml.validation,ja
       vax.xml.ws,net.sf.cglib.asm,net.sf.cglib.core,net.sf.cglib.proxy,orac
       le.classloader.util,org.aopalliance.aop;version="1.0",org.aopalliance
       .intercept;version="1.0",org.apache.commons.attributes,org.apache.com
       mons.collections,org.apache.commons.collections.map,org.apache.common
       s.io;version="1.4",org.apache.commons.lang.builder;version="2.4",org.
       apache.commons.logging,org.apache.log4j,org.apache.log4j.xml,org.aspe
       ctj.bridge,org.aspectj.lang,org.aspectj.lang.reflect,org.aspectj.runt
       ime.reflect,org.aspectj.weaver,org.aspectj.weaver.bcel,org.aspectj.we
       aver.loadtime,org.aspectj.weaver.patterns,org.codehaus.groovy.control
       ,org.jruby,org.jruby.ast,org.jruby.exceptions,org.jruby.javasupport,o
       rg.jruby.runtime,org.jruby.runtime.builtin,org.jvnet.jaxb2_commons.la
       ng,org.jvnet.jaxb2_commons.lang.builder,org.omg.CORBA,org.omg.CORBA.p
       ortable,org.omg.CORBA_2_3.portable,org.osgi.framework,org.osgi.servic
       e.packageadmin,org.springframework.aop;version="2.5",org.springframew
       ork.aop.framework;version="2.5",org.springframework.aop.scope;version
       ="2.5",org.springframework.aop.support;version="2.5",org.springframew
       ork.aop.target;version="2.5",org.springframework.aop.target.dynamic;v
       ersion="2.5",org.springframework.instrument,org.springframework.jms.s
       upport.converter;version="2.5",org.springframework.osgi;version="1.1"
       ,org.springframework.osgi.context;version="1.1",org.springframework.o
       sgi.context.event;version="1.1",org.springframework.osgi.context.supp
       ort;version="1.1",org.springframework.osgi.io.internal.resolver;versi
       on="1.1",org.springframework.osgi.service.importer;version="1.1",org.
       springframework.osgi.service.importer.event;version="1.1",org.springf
       ramework.osgi.service.importer.support;version="1.1",org.springframew
       ork.osgi.util;version="1.1",org.springframework.transaction.annotatio
       n;version="2.5",org.springframework.transaction.aspectj;version="2.5"
       ,org.w3c.dom,org.xml.sax
      Embed-Dependency: *;scope=compile|runtime
      Bundle-SymbolicName: com.ihg.crm.offline.app.osgi.booking
      All the required jars are on the classpath. The issue is that the Spring DM context ignores the import of 3 other Spring contexts. So I'm unable to launch a Spring application composed of a set of contexts.

      Using only one context works, less the integration test. But that is not ideal in a component-based world.

      Has no one else attempted to build a Spring DM bundle that compose other Spring contexts? It works like a charm in standalone and web applications.

      I would respectfully suggest that the next release of Spring DM include meaningful example applications.

      Comment

      Working...
      X