0 Replies Latest reply on Sep 27, 2015 7:29 AM by kittu_lal

    Spring + EJB + JMS

    kittu_lal

      Spring + EJB + JMS

       

      I'm trying to migrate my EJB application from JBSS 5 to WIldfly 8.

       

      Before that i tried and succeed the same JMS queue connections in Stand-alone Application and Web Application its working fine.

      When i shift to the same xml beans to to EJB , My EJB is not Connecting to queue. It is throwing  Exceptiion.

      Do i need to Configure anything in WIldfly-8??

       

      Please help me .. I'm working around on this problem from 3 days but i'm not getting any solution  on this...............


      Exception :

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'producerTemplate' defined in class path resource [com/pro/config/beanss.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.hornetq.jms.client.HornetQQueue' to required type 'javax.jms.Destination' for property 'defaultDestination'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.hornetq.jms.client.HornetQQueue] to required type [javax.jms.Destination] for property 'defaultDestination': no matching editors or conversion strategy found

      My xml Conf

       

      <?xml version="1.0" encoding="UTF-8"?>

      <beans xmlns="http://www.springframework.org/schema/beans"

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xsi:schemaLocation="http://www.springframework.org/schema/beans

      http://www.springframework.org/schema/beans/spring-beans.xsd">

         

           <bean name="jndiTemplateRef" class="org.springframework.jndi.JndiTemplate">

              <property name="environment">

                  <props>

                      <!--<prop  key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>

                          <prop key="java.naming.provider.url">jnp://192.168.1.24:1099</prop>-->

                      <prop key="java.naming.factory.initial">org.jboss.naming.remote.client.InitialContextFactory</prop>       

                      <prop key="java.naming.provider.url">http-remoting://localhost:8080</prop>

                      <!--<prop key="java.naming.factory.url.pkgs">org.jboss.ejb.client.naming</prop>-->

                      <prop key="jboss.naming.client.ejb.context">true</prop>

                      <prop key="java.naming.security.principal">prohemns</prop>

                      <prop key="java.naming.security.credentials">pro1234$</prop>

       

       

                  </props>

                 

              </property>

          </bean>

          <bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">

              <property name="jndiTemplate" ref="jndiTemplateRef"/>

              <property name="jndiName" value="jms/RemoteConnectionFactory" />

              <property name="lookupOnStartup" value="false"/>

              <property name="proxyInterface" value="javax.jms.ConnectionFactory"/>

          </bean>

       

       

         

          <!-- Definition of the JMS queue -->

          <bean id="defaultDestination" class="org.springframework.jndi.JndiObjectFactoryBean">

              <property name="jndiTemplate" ref="jndiTemplateRef"/>

              <property name="jndiName" value="jms/queue/EmailsQueue"/>

          </bean>

       

       

          <bean id="producerTemplate" class="org.springframework.jms.core.JmsTemplate">

              <property name="connectionFactory" ref="jmsConnectionFactory" />

              <property name="defaultDestination" ref="defaultDestination" />

          </bean>

       

       

          <bean id="objEjbJmsService" class="com.pro.serviceImpl.EjbJmsServiceImpl">

              <property name="objJmsTemplate" ref="producerTemplate" />

          </bean>

         

      </beans>

       

      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      standalone-full.xml

       

       

      <subsystem xmlns="urn:jboss:domain:messaging:3.0">

                  <hornetq-server>

                      <persistence-enabled>true</persistence-enabled>

                      <security-enabled>false</security-enabled>

                      <journal-file-size>102400</journal-file-size>

                      <journal-min-files>2</journal-min-files>

       

       

                      <connectors>

                          <netty-connector name="netty" socket-binding="messaging"/>

                          <netty-connector name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                          </netty-connector>

                          <in-vm-connector name="in-vm" server-id="0"/>

                      </connectors>

       

       

                      <acceptors>

                          <netty-acceptor name="netty" socket-binding="messaging"/>

                          <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">

                              <param key="batch-delay" value="50"/>

                              <param key="direct-deliver" value="false"/>

                          </netty-acceptor>

                          <in-vm-acceptor name="in-vm" server-id="0"/>

                      </acceptors>

       

       

                      <security-settings>

                          <security-setting match="#">

                              <permission type="send" roles="guest"/>

                              <permission type="consume" roles="guest"/>

                              <permission type="createNonDurableQueue" roles="guest"/>

                              <permission type="deleteNonDurableQueue" roles="guest"/>

                          </security-setting>

                      </security-settings>

       

       

                      <address-settings>

                          <address-setting match="#">

                              <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                              <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                              <redelivery-delay>0</redelivery-delay>

                              <max-size-bytes>10485760</max-size-bytes>

                              <address-full-policy>BLOCK</address-full-policy>

                              <message-counter-history-day-limit>10</message-counter-history-day-limit>

                          </address-setting>

                      </address-settings>

       

       

                      <jms-connection-factories>

                          <connection-factory name="InVmConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/ConnectionFactory"/>

                              </entries>

                          </connection-factory>

                          <connection-factory name="RemoteConnectionFactory">

                              <connectors>

                                  <connector-ref connector-name="netty"/>

                              </connectors>

                              <entries>

                                  <entry name="RemoteConnectionFactory"/>

                                  <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>

                              </entries>

                              <client-failure-check-period>2147483646</client-failure-check-period>

                              <connection-ttl>-1</connection-ttl>

                              <reconnect-attempts>-1</reconnect-attempts>

                          </connection-factory>

                          <pooled-connection-factory name="hornetq-ra">

                              <transaction mode="xa"/>

                              <connectors>

                                  <connector-ref connector-name="in-vm"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/JmsXA"/>

                                  <entry name="java:jboss/DefaultJMSConnectionFactory"/>

                              </entries>

                          </pooled-connection-factory>

                      </jms-connection-factories>

       

       

                      <jms-destinations>

                          <jms-queue name="testQueue">

                              <entry name="queue/test"/>

                              <entry name="java:jboss/exported/jms/queue/test"/>

                          </jms-queue>

                          <jms-queue name="callStatus">

                              <entry name="queue/callStatus"/>

                              <entry name="java:jboss/exported/jms/queue/callStatus"/>

                          </jms-queue>

                          <jms-queue name="onlineUsers">

                              <entry name="queue/onlineUsers"/>

                              <entry name="java:jboss/exported/jms/queue/onlineUsers"/>

                          </jms-queue>

                          <jms-queue name="dispatch">

                              <entry name="queue/dispatch"/>

                              <entry name="java:jboss/exported/jms/queue/dispatch"/>

                          </jms-queue>

                          <jms-queue name="faileddispatches">

                              <entry name="queue/faileddispatches"/>

                              <entry name="java:jboss/exported/jms/queue/faileddispatches"/>

                          </jms-queue>

                          <jms-queue name="vehicleStatus">

                              <entry name="queue/vehicleStatus"/>

                              <entry name="java:jboss/exported/jms/queue/vehicleStatus"/>

                          </jms-queue>

                          <jms-queue name="complaintStatus">

                              <entry name="queue/complaintStatus"/>

                              <entry name="java:jboss/exported/jms/queue/complaintStatus"/>

                          </jms-queue>

                          <jms-queue name="fieldUpdateStatus">

                              <entry name="queue/fieldUpdateStatus"/>

                              <entry name="java:jboss/exported/jms/queue/fieldUpdateStatus"/>

                          </jms-queue>

                          <jms-queue name="StatisticsQueue">

                              <entry name="queue/StatisticsQueue"/>

                              <entry name="java:jboss/exported/jms/queue/StatisticsQueue"/>

                          </jms-queue>

                          <jms-queue name="EmailsQueue">

                              <entry name="queue/EmailsQueue"/>

                              <entry name="java:jboss/exported/jms/queue/EmailsQueue"/>

                          </jms-queue>

                          <jms-topic name="testTopic">

                              <entry name="topic/test"/>

                              <entry name="java:jboss/exported/jms/topic/test"/>

                          </jms-topic>

                      </jms-destinations>

                  </hornetq-server>

              </subsystem>

       

       

       

      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      Class Loaders Are as Follows

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.0"  name="org.spring4x" slot="4.0.1 RELEASE">

        <resources>

        <resource-root path="aopalliance-1.0.jar"/>

        <resource-root path="aspectjtools-1.7.4.jar"/>

        <resource-root path="aspectjweaver-1.8.4.jar"/>

        <resource-root path="org-apache-commons-logging.jar"/>

       

       

        <resource-root path="spring-aop-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-aspects-4.1.7.RELEASE.jar"/>

          <resource-root path="spring-beans-4.1.7.RELEASE.jar"/>

          <resource-root path="spring-context-4.1.7.RELEASE.jar"/>

          <resource-root path="spring-context-support-4.1.7.RELEASE.jar"/>

          <resource-root path="spring-core-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-expression-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-instrument-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-instrument-tomcat-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-jdbc-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-jms-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-messaging-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-orm-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-oxm-4.1.7.RELEASE.jar"/>

          <resource-root path="spring-test-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-tx-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-web-4.1.7.RELEASE.jar"/>

        <resource-root path="spring-webmvc-4.1.7.RELEASE.jar"/>

      <resource-root path="jboss-client.jar"/>

        </resources>

       

        <dependencies>

      <module name="javax.api"/>

        <module name="javaee.api"/>

          <module name="org.apache.commons.logging"/>

        <module name="org.hibernate" slot="main"/>

        <module name="org.dom4j" slot="main"/>

          <module name="org.jboss.vfs"/>

        <module name="javax.el.api" export="true"/>

          <module name="com.sun.xml.bind" export="true"/>

        </dependencies>

      </module>

       

      Please any one can suggest the solution............