Announcement Announcement Module
Collapse
No announcement yet.
DefaultMessageListenerContainer fails to initialize with TIBCO TOPIC as destination Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultMessageListenerContainer fails to initialize with TIBCO TOPIC as destination

    Hi,

    I am working on a standalone app which consumes messages from Remote EMS Tibco Topic .The standalone app is running on jboss-soe-5.1.1 and jre 1.6.

    It uses Spring's MDP (Message Driven Pojo) as Message Listener, initialized by Spring DefaultMessageListenerContainer (DMLC) to listen to Messages on EMS TIBCO Topic configured on TIBCO JNDI Server.

    When the Web Container is up, DMLC fails to load with the below error

    [DispatcherServlet] Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'defineSearchContainer' defined: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert property value of type 'com.tibco.tibjms.naming.TibjmsFederatedTopic' to required type 'javax.jms.Destination' for property 'destination'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.tibco.tibjms.naming.TibjmsFederatedTopic] to required type [javax.jms.Destination] for property 'destination': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:527)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    ..
    ..



    I am using following snippet in my Spring Configuration file to load DMLC

    <bean id="defineSearchContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="ConnectFactory" />
    <property name="destination" ref="gsaDefineSearchDestination"/>
    <property name="messageListener" ref="Listener" />
    </bean>


    where gsaDefineSearchDestination is an object of Topic[com.tibco.tibjms.naming.TibjmsFederatedTopic] created using Topic name defined in EMS Tibco JNDI Server.

    ConnectFactory is created using Tibco JNDI name configured with Jboss JNDI


    I have added all the required Tibco jars (eg. tibjms.jar etc) to application's classpath as well as Jboss classpath. I could not understand why the DMLC fails to convert 'com.tibco.tibjms.naming.TibjmsFederatedTopic' to required type 'javax.jms.Destination' , when TibjmsFederatedTopic is actually a type of "javax.jms.Desination" object.

    I would appreciate, if anyone has come across this error and also have a solution?

    Regards

  • #2
    Please use [ code][/code ] tags when posting code/xml/stacktracs, that way it remains readable.

    Check your classpath my guess is that you have multiple jars containing the jms api which leads to classcast exceptions. (Class identity is determined on the classloader and classname, so the same class in different classloaders aren't equal).

    Comment


    • #3
      hello Marten,

      Thank you for your response.

      Prima facie, we did suspect this to be a class loader issue. To preempt this, we added the "expectedType" attribute (with value set to "javax.jms.Destination") to the org.springframework.jndi.JndiObjectFactoryBean bean definition. No exceptions were raised and the bean ( of type Topic[com.tibco.tibjms.naming.TibjmsFederatedTopic]) was created successfully.
      We even did a negative test by setting the value of "expectedType" attribute to "java.lang.String". That threw the below error.

      "..java.lang.String not assignable to javax.jms.Destination.."


      Going by our findings, we ruled out the that it was the classloader causing the problem.

      Today, we did a small exercise and found the jar files containing javax.jms.Destination interface.
      Below are the jar file names and the locations

      1) jms.jar provided by TIBCO (present in application classpath)
      2) jboss-javaee.jar present in my JBOSS 5.1.1. (<Jboss-Home>/common/lib)


      We ran tests, by maintaining a single jar and this too resulted in the same DMLC error as stated in my earlier post.


      Below is the Spring XML configuration snippet:

      Code:
      <bean id="defineSearchContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
             <property name="connectionFactory" ref="ConnectFactory" />
             <property name="destination" ref="gsaDefineSearchDestination"/>
             <property name="messageListener" ref="Listener" />
      </bean>
      <bean id="gsaDefineSearchDestination" class="org.springframework.jndi.JndiObjectFactoryBean" 
      		lazy-init="false" depends-on="jndiTemplate">
      		<property name="expectedType" value="javax.jms.Destination"/>
          	<property name="jndiTemplate">
              	<ref bean="jndiTemplate"/>
           	</property>
           	<property name="jndiName">
              	<value>[topic name present in the remote EMS TIBCO JNDI server]</value>
           	</property>
          </bean>

      Note that the Tibco JMS connection factory is defined within the JBoss JNDI where as the Tibco JMS Destinations (Topics) are referenced from Tibco JNDI.

      The JBoss JNDI lookup (i.e. Tibco connection factory) works fine. However the later, Tibco JNDI looks up does not.


      About JNDI template:
      Following properties are used to configure this.

      java.naming.factory.initial
      java.naming.provider.url
      java.naming.security.principal
      java.naming.security.credentials
      java.naming.factory.url.pkgs

      What is Spring's default behaviour for type casting of objects ? Will Spring by default "attempt" to type cast an object of any type (akin to the value passed in a function) to the receiving type (akin to the parameter types declared for a function) ?


      Thanks & Regards
      Last edited by NehaVerma; Feb 26th, 2013, 06:08 AM. Reason: elaborating the details

      Comment


      • #4
        Do you still think if this issue is because of multiple jms api jars present ?
        Yes...

        I'm not interested in the jars on your classpath when developing... The interesting part are the jars on the server. Make sure that you do NOT include any jms jar in your war/ear file as those are already provided by JBoss

        Comment


        • #5
          Do you still think if this issue is because of multiple jms api jars present ?
          Yes...

          I'm not interested in the jars on your classpath when developing... The interesting part are the jars on the server. Make sure that you do NOT include any jms jar in your war/ear file as those are already provided by JBoss

          Comment


          • #6
            hello Marten,
            kindly note that i have edited the above post to elaborate a little more, sorry for delaying the edit.
            All the tibco jar files are only in build path , they have not been added to the ear file deployed. Also no other jms api jar is present in Jboss other than Jboss own jms jar

            Now the above edited post will also clarify that we used "expectedType" as javax.jms.Destination ,to make sure that Topic[com.tibco.tibjms.naming.TibjmsFederatedTopic] is of javax.jms.Destination type , where it threw no error. But DMLC when using the same Topic object fails to recognize it's type as javax.jms.Destination



            Regards,

            Comment


            • #7
              Hi,

              Please do have a look at the content of my 3# post also.

              I badly need this working , so continuously trying possibilities for resolving the issue.

              Again Yesterday I tried fetching the remote tibco topic deployed in EMS TIBCO server, using <jee:jndi-lookup , also tried JndiDestinationResolver
              Attaching snippet done using <jee:jndi-lookup

              Code:
                 <jee:jndi-lookup id="gsaDefineSearchDestination1" jndi-name="My.Simple.Tibco.Topic" >
              	<jee:environment>
              			
              	    java.naming.factory.initial = com.tibco.tibjms.naming.TibjmsInitialContextFactory
                          java.naming.provider.url = tibjmsnaming://<host>:<port>
                          java.naming.security.principal = <user>
                          java.naming.security.credentials = <password>
                          java.naming.factory.url.pkgs = com.tibco.tibjms.naming
              	</jee:environment>
                  </jee:jndi-lookup>
              This gives me an object of Topic[My.Simple.Tibco.Topic] where Topic class is of type com.tibco.tibjms.naming.TibjmsFederatedTopic.
              Now using the same object in DMLC as in snippet below:

              Code:
                <bean id="defineSearchContainer"
              		class="org.springframework.jms.listener.DefaultMessageListenerContainer">
               	
              	<property name="connectionFactory" ref="ConnectFactory"/>
                  	<property name="destination" ref="gsaDefineSearchDestination1"/>
                  	<property name="messageListener" ref="Listener" />
                  	<property name="sessionAcknowledgeModeName" value="AUTO_ACKNOWLEDGE"/>
                  	<property name="pubSubDomain" value="true"/>
                </bean>
              DMLC throws warning message as mentioned below, & hence fails to invoke My Listener:

              WARN [org.springframework.jms.listener.DefaultMessageLis tenerContainer] (defineSearchContainer-1) Setup of JMS message listener invoker failed for destination 'Topic[My.Simple.Tibco.Topic]' - trying to recover. Cause: Not a JBossDestination:Topic[My.Simple.Tibco.Topic]

              This warning seems to me that DMLC is expecting a JBOSSDestination , and ofcourse my TIBCO Topic[My.Simple.Tibco.Topic] deployed in remote TIBCO JNDI server can
              never be a JBOSS destination. Does this mean DMLC is limited to function only if the Topic is physically present/created in JBOSS & DMLC does not support access to
              TIBCO topic deployed in TIBCO JNDI Server ? or am I missing some step while accessing remote TIBCO topic ?

              Please enlighten me.

              Regards,

              Comment


              • #8
                Please use [ code][/code ] tags when posting stacktraces.

                Can you post your full configuration, my guess is that your problem arises due to the fact that the connectionfactory is configured in JBoss (judging from your first post) and your topic isn't... Could be tibco specific... Not sure.

                Comment


                • #9
                  I am not an expert in Tibco EMS or Spring , but i did some googling and found below.


                  When the JBoss server invokes JNDI and encounters the tibjmsnaming scheme, the server must be able to find the TIBCO Enterprise Message Service URLConnectionFactory. Therefore, modify the file %JBOSS_CONF%\jndi.properties as follows:
                  Change:
                  java.naming.factory.url.pkgs=org.jboss.naming:org. jnp.interfaces
                  To
                  java.naming.factory.url.pkgs=org.jboss.naming:org. jnp.interfaces:com.tibco.tibjms.naming

                  source - https://docs.tibco.com/pub/enterpris...ppint.5.10.htm

                  Comment


                  • #10
                    Hello Marten,

                    Please find below the spring configuration file I used for my application
                    And you are correct Tibco Connection Factory in configured in Jboss , but Tibco topics are not. They are directly being referred from Remote Tibco JNDI server (refer snippet bean id ConnectFactory1)
                    But I have also tried connecting directly to TopicConnectionFactory in Tibco server(refer snippet bean id TopicConnectionFactory) .
                    Both gives the same error as in above post


                    Code:
                    <bean id="ConnectFactory1" class="org.springframework.jndi.JndiObjectFactoryBean">
                      <property name="jndiTemplate">
                           	<ref bean="jndiTemplate"/>
                      </property>
                      <property name="jndiName">
                          	<value>java:/TibcoXA</value>
                      </property>
                     </bean>
                        
                     <bean id="TopicConnectionFactory" class="com.tibco.tibjms.TibjmsTopicConnectionFactory">
                        <constructor-arg type="java.lang.String">
                        	<value>tcp://<host>:<port></value> 
                        </constructor-arg>
                        <property name="userName" value="<user>"/>
                        <property name="userPassword" value="<password>"/>
                     </bean>
                    
                     <bean id="gsaDefineSearchDestination" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="false" depends-on="jndiTemplate">
                    	
                    	<property name="expectedType" value="javax.jms.Destination"/>
                        	<property name="jndiTemplate"><ref bean="jndiTemplate"/></property>
                         	<property name="jndiName">
                            	<value>My.Simple.Tibco.Topic</value>
                         	</property>
                       </bean>
                    	
                      <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate" lazy-init="false">
                          <property name="environment">
                            <props>
                                <prop key="java.naming.factory.initial">com.tibco.tibjms.naming.TibjmsInitialContextFactory</prop>
                                <prop key="java.naming.provider.url">tibjmsnaming://<host>:<port></prop>
                                <prop key="java.naming.security.principal"><user></prop>
                                <prop key="java.naming.security.credentials"><password></prop>
                                <prop key="java.naming.factory.url.pkgs">com.tibco.tibjms.naming</prop>
                            </props>
                          </property>
                    	</bean>
                    	
                      <bean id="defineSearchContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
                         <property name="connectionFactory" ref="ConnectFactory1"/>
                         <!--<property name="connectionFactory" ref="TopicConnectionFactory"/>-->
                         <property name="destination" ref="gsaDefineSearchDestination"/>
                         <property name="messageListener" ref="Listener" />
                         <property name="sessionAcknowledgeModeName" value="AUTO_ACKNOWLEDGE"/>
                         <property name="pubSubDomain" value="true"/>
                      </bean>
                    
                      <bean id="Listener" class="xx.xx.MyListener" scope="singleton">
                         <property name="propety1" ref="propertyX" />
                     </bean>

                    Alternatively I had also tried connecting to Tibco topic using simple Java client application, where I was even able to connect to tibco topic, publish message, and even consume message from the topic. This ruled out my doubt about issues with topic created on Tibco server. The same scenario fails , when using spring DMLC ? Please let us know if I am missing any configuration point.., or is it DMLC's limitation..?


                    Regards,

                    Comment

                    Working...
                    X