Announcement Announcement Module
Collapse
No announcement yet.
Service Not Being Initialized Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Service Not Being Initialized

    Hello,

    I am in phase of learning Flex, BlazeDS, BlazeIntegration Hibernate.
    I am using tomcat 6.20 official zip installation on winXP with
    - spring-framework-2.5.6.SEC01-with-dependencies
    - blazeds-bin-3.3.0.11846
    - spring-flex-1.0.1.RELEASE-with-dependencies
    - hibernate-distribution-3.3.2.GA-dist and other compatible
    I am trying pro flex on spring book examples. I can run examples
    with JDBC and iBATIS with this setup but hibernate example is
    giving error as given below.

    Can somebody will tell what is going wrong and how can I Correct it.

    Thanks and best regards

    Raja

    ================================================== =========
    Error I am getting.
    ================================================== =========

    (mx.rpc::Fault)#0
    content = (null)
    errorID = 0
    faultCode = "Server.Processing"
    faultDetail = (null)
    faultString = "No destination with id 'ecommerceService' is registered with any service."
    message = "faultCode:Server.Processing faultString:'No destination with id 'ecommerceService' is registered with any service.' faultDetail:'null'"
    name = "Error"
    rootCause = (null)

    ================================================== =========
    ApplicationContext.xml
    ================================================== =========

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
    default-lazy-init="true">


    <!-- ================= START Spring Managed Message Broker Configuration ================= -->
    <!-- Maps request paths at /* to the BlazeDS MessageBroker -->
    <bean class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <value>
    /*=springManagedMessageBroker
    </value>
    </property>
    </bean>

    <!--
    Dispatches requests mapped to a MessageBroker
    check proper class in org.springframework.flex-x.x.x.RELEASE.jar
    -->
    <bean class="org.springframework.flex.servlet.MessageBro kerHandlerAdapter"/>

    <!--
    Bootstraps and exposes the BlazeDS MessageBroker
    check proper class in org.springframework.flex-x.x.x.RELEASE.jar
    -->
    <bean id="springManagedMessageBroker" class="org.springframework.flex.core.MessageBroker FactoryBean"/>
    <!-- ================= END Spring Managed Message Broker Configuration ================= -->


    <!-- ================= START Load Application Properties ================= -->
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="location"><value>WEB-INF/application.properties</value></property>
    </bean>
    <!-- ================= END Load Application Properties ================= -->


    <!-- ================= START Hibernate Configuration ================= -->
    <!-- Configure SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
    <property name="annotatedClasses">
    <list>
    <value>com.txCh8.core.domain.ProductH</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
    <prop key="hibernate.format_sql">${hibernate.format_sql} </prop>
    <prop key="hibernate.transaction.factory_class">${hibern ate.transaction.factory_class}</prop>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.c3p0.min_size">${hibernate.c3p0.min _size}</prop>
    <prop key="hibernate.c3p0.max_size">${hibernate.c3p0.max _size}</prop>
    <prop key="hibernate.c3p0.timeout">${hibernate.c3p0.time out}</prop>
    <prop key="hibernate.c3p0.max_statements">${hibernate.c3 p0.max_statements}</prop>
    <prop key="hibernate.connection.driver_class">${jdbc.dri verClassName}</prop>
    <prop key="hibernate.connection.url">${jdbc.url}</prop>
    <prop key="hibernate.connection.username">${jdbc.usernam e}</prop>
    <prop key="hibernate.connection.password">${jdbc.passwor d}</prop>
    </props>
    </property>
    </bean>

    <!-- enable the configuration of transactional behavior based on annotations -->
    <tx:annotation-driven transaction-manager="txManager"/>

    <bean id="txManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory"><ref local="sessionFactory"/></property>
    </bean>

    <bean class="org.springframework.beans.factory.annotatio n.RequiredAnnotationBeanPostProcessor"/>
    <!-- ================= END Hibernate Configuration ================= -->


    <!-- ================= START DAO Configuration ================= -->
    <bean id="ecommerceDao" class="com.txCh8.core.dao.hibernate.EcommerceDaoIm pl">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    <!-- ================= END DAO Configuration ================= -->


    <!-- ================= START Exposed Services ================= -->
    <bean id="ecommerceService" class="org.springframework.flex.remoting.RemotingD estinationExporter">
    <property name="messageBroker" ref="springManagedMessageBroker"/>
    <property name="service" ref="ecommerceServiceBean"/>
    </bean>

    <bean id="ecommerceServiceBean" class="com.txCh8.core.services.EcommerceServiceImp l">
    <property name="ecommerceDao"><ref bean="ecommerceDao"/></property>
    </bean>
    <!-- ================= END Exposed Services ================= -->

    </beans>

  • #2
    Hello,

    I have Isolated the problem area

    ================================================== =========
    Original ApplicationContext.xml header which do not initialize Service
    ================================================== =========

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
    default-lazy-init="true">
    ================================================== =========

    if I remove ----> default-lazy-init="true" <---- from header it works fine and initializes the service.

    Can somebody tell me what is wrong with this ?

    Thanks and best regards

    Raja

    Comment


    • #3
      Hi,

      By using default-lazy-init="true" at the bean level,the container wont instantiate any of the singleton beans until an unless you explicitly get that instance of bean from applicationContext.

      By removing default-lazy-init="true",applicationContext eagrely pre-instantiates all the singleton beans at start up i.e even before you call it.ApplicationContext will eagerly create and configure all of its singleton beans as part of its initialization process.Hence you could get all the instances once you removed it.

      Hope it helps

      Kartik

      Comment


      • #4
        Thanks a lot for explanation.

        Raja

        Comment

        Working...
        X