Announcement Announcement Module
No announcement yet.
spring-dm / osgi / spring integration / CannotLoadBeanClassException Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-dm / osgi / spring integration / CannotLoadBeanClassException

    Springframework version: 2.5.6.SEC01
    Spring integration: 1.0.2.SR1

    I'm brand new to OSGi/Spring/Spring integration so it's quite conceivable I am missing something with nothing to do with Spring Integration, but things where going OK with spring-dm until I tried to use spring integrations.

    The exception I am getting is the following: (same in equinox/felix):
    [2009-06-16 19:18:00,682] DEBUG - Ignoring bean class loading failure for bean 'org.springframework.integration.internalDefaultConfiguringBeanFactoryPostProcessor'
    org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.integration.config.xml.DefaultConfiguringBeanFactoryPostProcessor] for bean with name 'org.springframework.integration.internalDefaultConfiguringBeanFactoryPostProcessor' defined in null; nested exception is java.lang.ClassNotFoundException: org.springframework.integration.config.xml.DefaultConfiguringBeanFactoryPostProcessor not found from bundle [com.unwiredappeal.mailgw]
    and my bundle-context-integration.xml file from META-INF/spring:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=""
            <int:channel id="inboundMail"/>
            <int:service-activator input-channel="inboundMail" ref="myMailHandler"/>
            <mail:imap-idle-channel-adapter store-uri="imaps://[email protected]:[email protected]:993/INBOX/" 
    and the bundles loaded into the osgi container:
    Framework is launched.
    id	State       Bundle
    0	ACTIVE      org.eclipse.osgi_3.4.3.R34x_v20081215-1030
    1	ACTIVE      org.eclipse.osgi.util_3.1.300.v20080303
    2	ACTIVE      org.eclipse.osgi.services_3.1.200.v20070605
    3	ACTIVE      org.apache.felix.configadmin_1.0.1
    4	ACTIVE      org.ops4j.pax.configmanager_0.2.2
    5	ACTIVE      org.ops4j.pax.logging.pax-logging-service_1.3.0
    6	ACTIVE      org.springframework.osgi.extender_1.2.0
    7	ACTIVE      org.springframework.osgi.core_1.2.0
    8	ACTIVE      org.springframework.osgi.io_1.2.0
    9	ACTIVE      org.springframework.aop_2.5.6.SEC01
    10	ACTIVE      org.springframework.transaction_2.5.6.SEC01
    11	ACTIVE      org.springframework.beans_2.5.6.SEC01
    12	ACTIVE      org.springframework.context_2.5.6.SEC01
    13	ACTIVE      org.springframework.core_2.5.6.SEC01
    14	ACTIVE      org.springframework.test_2.5.6.SEC01
    15	ACTIVE
    16	ACTIVE
    17	ACTIVE
    18	ACTIVE      com.springsource.javax.jms_1.1.0
    19	ACTIVE      com.springsource.javax.transaction_1.1.0
    20	ACTIVE      org.springframework.context.support_2.5.6.SEC01
    21	ACTIVE      org.ops4j.pax.logging.pax-logging-api_1.3.0
    22	ACTIVE      org.springframework.integration_1.0.2.SR1
    23	ACTIVE      org.springframework.integration.adapter_1.0.2.SR1
    24	ACTIVE      org.springframework.integration.mail_1.0.2.SR1
    25	ACTIVE      com.unwiredappeal.mailgw_1.0.0.SNAPSHOT
    26	ACTIVE      javax.mail_1.4.1
    myMailHandler is defined (and from debugging seems to get loaded) from a seperate xml file in the same directory.

    I seem to receive the exception above whenever I try to use the integration name space. If I comment out the int: entries and just leave the mail:imap-idle-channel-adapter, it seems to work OK (except that I receive an error that channel "inboundMail" doesn't exist, but this is to be expected)

    Because I'm new at this, I am not sure what the relevant portions of the log/code/xml files to post, so if you need more please let me know.

    If it makes a difference the project was initially created using pax-construct. I have tried felix 1.8, and equinox 3.4.2 (plus others)

    Thanks in advance for any advice, I've been banging my head all day.

  • #2
    I've done this before succesfully see:

    Yesterday evening I prepared my demos for OSGi DevCon and they run fine with 1.0.2.SR1. Maybe you can post a dressed down version of your code, so we can check the manifest headers? I'm guessing that since you don't have the Import-Bundle directive (being on plain OSGi) you've missed a package.



    • #3
      I think Iwein's probably right. Can you post your manifests?... at least the imports that would be relevant for any org.springframework.integration.* packages?


      • #4
        I currently don't have any spring related imports in my MANIFEST.MF. The import I have in the MANIFEST is:

        Import-Package: com.unwiredappeal.mailgw;version="1.0.0.SNAPSHOT", org.

        I was assuming I didn't need any, and spring-dm handled everything "under the hood". I don't reference any spring classes within my code.

        The interface:
        package com.unwiredappeal.mailgw;
        public interface MailHandler {
                public void process(String m);
        The implementation:
        package com.unwiredappeal.mailgw.internal;
        import org.slf4j.Logger;
        import org.slf4j.LoggerFactory;
        import com.unwiredappeal.mailgw.MailHandler;
        public class MailHandlerImpl implements MailHandler {
            private static  final  Logger logger = LoggerFactory.getLogger(MailHandlerImpl.class);
            static {
                logger.debug("MailHandlerImpl started.");
                public void process(String m) {
        and the XML file to export the bean: (This works fine on its own, without trying to add the spring-integration related XML bits);

        <?xml version="1.0" encoding="UTF-8"?>
        <beans xmlns=""
          <!-- regular spring configuration file defining the beans for this
               bundle. We've kept the osgi definitions in a separate 
               configuration file so that this file can easily be used
               for integration testing outside of an OSGi environment -->
          <bean name="myExampleBean" class="com.unwiredappeal.mailgw.internal.ExampleBeanImpl" />
          <bean name="myMailHandler" class="com.unwiredappeal.mailgw.internal.MailHandlerImpl" />


        • #5
          Yep, that's your problem then. dm Server handles some things under the hood, but it will not make asumptions about the spring version you wish to use just to name an example.

          If you include an Import-Library: org.springframework.spring and Import-Bundle statements for the Spring Integration stuff you need you should be grand.


          • #6
            Originally posted by iwein View Post
            If you include an Import-Library: org.springframework.spring and Import-Bundle statements for the Spring Integration stuff you need you should be grand.
            Thanks, that did the trick. I'm not using spring dm server so I used Require-Bundle instead. (I think Import-Library & bundle are spring dm server specific)

            Require-Bundle: org.springframework.beans, org.springframework.core, o
             rg.springframework.integration, org.springframework.integration.adapt
             er, org.springframework.integration.mail
            Not sure if they are all needed, I haven't had a chance to fool around too much yet.

            I think what threw me was the fact that the Spring beans worked without any additional imports/requires, I just made the assumption that Spring Integration would work the same way. If the beans hadn't worked I would probably have tried mucking with the imports straight off.

            Thanks again