Results 1 to 7 of 7

Thread: OSGi web module failed in S2AP

  1. #1
    Join Date
    Oct 2008
    Posts
    0

    Default OSGi web module failed in S2AP

    I have a web module which will get reference to an OSGi service and expose it as a web service (CXF enabled). All the related modules work in Equinox with Spring DM 1.1.1 support (I have updated from version 1.0 to the current release). While deploying all the modules in S2AP, only the web module didn't work.

    I will paste content of web.xml and applicationContext.xml to see if I can get any help to solve the problem.

    web.xml:

    <web-app>
    <display-name>com.ng.device.video.webservice</display-name>

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>

    <context-param>
    <param-name>contextClass</param-name>
    <param-value>
    com.springsource.platform.web.dm.PlatformOsgiBundl eXmlWebApplicationContext
    </param-value>
    </context-param>

    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>
    ...
    </web-app>

    applicationContext.xml:

    <osgi:list id="osgi.service.video.list" interface="com.xxx.device.video.ImageGrabber" cardinality="0..N"/>

    ...

    Here is the stacktrace: (I have to removed part of the stacktrace because of this forum limit)

    [2008-08-21 09:54:52.419] latform-tomcat-thread-20 video.war-0 I Trace configuration: {com.springsource.platform.*=WARN, *=INFO}
    [2008-08-21 09:54:55.061] async-delivery-thread-1 amework.beans.factory.support.DefaultListableBeanF actory.unknown I Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@aa045f: defining beans [osgi.service.video.list,video.serviceProvider,cxf, org.apache.cxf.bus.spring.BusWiringBeanFactoryPost Processor,org.apache.cxf.bus.spring.Jsr250BeanPost Processor,org.apache.cxf.bus.spring.BusExtensionPo stProcessor,org.apache.cxf.resource.ResourceManage r,org.apache.cxf.configuration.Configurer,org.apac he.cxf.binding.BindingFactoryManager,org.apache.cx f.transport.DestinationFactoryManager,org.apache.c xf.transport.ConduitInitiatorManager,org.apache.cx f.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManag er,org.apache.cxf.workqueue.WorkQueueManager,org.a pache.cxf.buslifecycle.BusLifeCycleManager,org.apa che.cxf.endpoint.ServerRegistry,org.apache.cxf.end point.ServerLifeCycleManager,org.apache.cxf.endpoi nt.ClientLifeCycleManager,org.apache.cxf.transport s.http.QueryHandlerRegistry,org.apache.cxf.endpoin t.EndpointResolverRegistry,org.apache.cxf.headers. HeaderManager,org.apache.cxf.catalog.OASISCatalogM anager,org.apache.cxf.endpoint.ServiceContractReso lverRegistry,org.apache.cxf.binding.soap.SoapBindi ngFactory,org.apache.cxf.binding.soap.SoapTranspor tFactory,org.apache.cxf.binding.soap.customEditorC onfigurer,org.apache.cxf.transport.servlet.Servlet TransportFactory,videoService,videoService2]; root of factory hierarchy
    [2008-08-21 09:54:55.092] async-delivery-thread-1 amework.beans.factory.support.DefaultListableBeanF actory.unknown I Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@aa045f: defining beans [osgi.service.video.list,video.serviceProvider,cxf, org.apache.cxf.bus.spring.BusWiringBeanFactoryPost Processor,org.apache.cxf.bus.spring.Jsr250BeanPost Processor,org.apache.cxf.bus.spring.BusExtensionPo stProcessor,org.apache.cxf.resource.ResourceManage r,org.apache.cxf.configuration.Configurer,org.apac he.cxf.binding.BindingFactoryManager,org.apache.cx f.transport.DestinationFactoryManager,org.apache.c xf.transport.ConduitInitiatorManager,org.apache.cx f.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManag er,org.apache.cxf.workqueue.WorkQueueManager,org.a pache.cxf.buslifecycle.BusLifeCycleManager,org.apa che.cxf.endpoint.ServerRegistry,org.apache.cxf.end point.ServerLifeCycleManager,org.apache.cxf.endpoi nt.ClientLifeCycleManager,org.apache.cxf.transport s.http.QueryHandlerRegistry,org.apache.cxf.endpoin t.EndpointResolverRegistry,org.apache.cxf.headers. HeaderManager,org.apache.cxf.catalog.OASISCatalogM anager,org.apache.cxf.endpoint.ServiceContractReso lverRegistry,org.apache.cxf.binding.soap.SoapBindi ngFactory,org.apache.cxf.binding.soap.SoapTranspor tFactory,org.apache.cxf.binding.soap.customEditorC onfigurer,org.apache.cxf.transport.servlet.Servlet TransportFactory,videoService,videoService2]; root of factory hierarchy
    [2008-08-21 09:54:55.092] async-delivery-thread-1 atform.web.dm.PlatformOsgiBundleXmlWebApplicationC ontext.unknown E Refresh error
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'osgi.service.video.list': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Required 'bundleContext' property was not set.
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1337)
    at

  2. #2
    Join Date
    Oct 2008
    Posts
    493

    Default OSGi web module failed in S2AP

    Hi,

    An "IllegalArgumentException: Required 'bundleContext' property was not set" typically occurs when there is more than one version of Spring-DM being used. Can you please try your application on the Platform using the version of Spring-DM that's supplied with it, rather than adding your own version to the Platform's repo (assuming, of course, that my guess work is correct, and this is what you've done...).

    Thanks,
    Andy

  3. #3
    Join Date
    Oct 2008
    Posts
    0

    Default OSGi web module failed in S2AP

    I just used a clean version of S2AP. The same exception was generated. There is no Spring or Spring OSGi related jar files in the web bundle. I have since removed all CXF related configuration. Still the same exception. I suspect for
    "com.springsource.platform.web.dm.PlatformOsgiBund leXmlWebApplicationContext", the "bundleContext" is not injected at all.

  4. #4
    Join Date
    Oct 2008
    Posts
    0

    Default OSGi web module failed in S2AP

    I tested using osgi:reference instead of osgi:list, same exception.

    <osgi:reference id="osgi.service.video"
    interface="com.xxx.device.video.ImageGrabber" />

    For all the S2AP examples, does any web module use Spring DM to refer to a OSGi service? I need a sample to follow.

    If I use pure OSGi APIs without Spring DM, I have no problem to get/invoke the OSGi service inside S2AP.

  5. #5
    Join Date
    Jan 2006
    Location
    Zürich, Switzerland
    Posts
    423

    Default OSGi web module failed in S2AP

    Hi Jian,

    > For all the S2AP examples, does any web module use Spring DM to refer to a OSGi service?

    Yes, the Web Module in the Form Tags sample application references the UserManager as a service in the OSGi Service Registry as follows:

    <reference id="userManager" interface="org.springframework.showcase.formtags.s ervice.UserManager" />

    To download the sample application visit the Downloads page on this site.

    Regards,

    Sam

  6. #6
    Join Date
    Oct 2008
    Posts
    0

    Default OSGi web module failed in S2AP

    Andy is right. After carefully checked the package, I found the CXF has a dependency on Spring 2.5.5. After excluding the corresponding artifacts, it works.

    One question rose from this deployment:

    In my manifest (OSGi), I didn't include the Spring related jar files from the WEB-INF/lib directory in my bundle classpath. Why are they used for class loading?

  7. #7
    Join Date
    Jan 2006
    Location
    Zürich, Switzerland
    Posts
    423

    Default OSGi web module failed in S2AP

    Hi Jian,

    > In my manifest (OSGi), I didn't include the Spring related jar files from the WEB-INF/lib
    > directory in my bundle classpath. Why are they used for class loading?

    They are included automatically.

    The following is taken straight from the Programmer Guide:

    "For Web Modules, the SpringSource Application Platform introspects the contents of the deployed artifact and automatically adds /MODULE-INF/WEB-INF/classes (if present) to the Bundle-ClassPath. Similarly, if there are any JARs present in /MODULE-INF/WEB-INF/lib, each JAR will be added to the Bundle-ClassPath. For WARs, the Platform performs the same logic for /WEB-INF/classes and any JARs present in /WEB-INF/lib."

    You can find this information and more here:

    http://static.springsource.com/projects/applicationplatform/1.0.x/programmer-guide/html/ch05s02.html#developing-applications-packaging-web-modules

    Regards,

    Sam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •