Announcement Announcement Module
Collapse
No announcement yet.
Problems creating EJB with Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Sorry for the late reply,

    Here is the config of the JmsEasySender and other beans reference by it:

    <bean id="jndiTemplate"
    class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
    <props>
    <prop key="javax.naming.factory.initial">
    org.jnp.interfaces.NamingContextFactory
    </prop>
    <prop key="javax.naming.provider.url">jnp://localhost:1099</prop>
    <prop key="javax.naming.factory.url.pkgs">
    jboss.naming:org.jnp.interfaces</prop>
    </props>
    </property>
    </bean>

    <bean id="jmsConnFactory"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="expectedType" value="javax.jms.QueueConnectionFactory"/>
    <property name="jndiName" value="jms/XAConnectionFactory"/>
    <property name="jndiTemplate">
    <ref local="jndiTemplate"/>
    </property>
    </bean>

    <bean id="queue"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>queue/testQueue</value></property>
    </property>-->
    <property name="jndiTemplate">
    <ref local="jndiTemplate"/>
    </property>
    </bean>

    <bean id="jmsConnFactoryWrapper"
    class="org.springframework.jms.connection.SingleCo nnectionFactory">
    <property name="targetConnectionFactory">
    <ref bean="jmsConnFactory"/></property>
    </bean>

    <bean id="jmsEasySender"
    class="com.al9202.platform.obj.messaging.JmsEasySe nderImpl">
    <property name="connectionFactory">
    <ref bean="jmsConnFactoryWrapper"/></property>
    <property name="queue">
    <ref local="queue"/></property>
    </bean>
    and here is the code:

    public class JmsEasySenderImpl extends JmsGatewaySupport implements JmsEasySender {

    private PlatformBeanFactory pbf;
    private Queue queue;

    public void tryToSend(Object message) {
    try {
    if(queue == null) {
    System.out.print("?/?/? Queue must set!");
    throw new Exception("Queue must set, JmsTemplate cannot send message without queue!");
    }
    System.out.print("?/?/? Queue is "+queue);
    super.getJmsTemplate().convertAndSend(queue, message);
    } catch(Exception x) {
    System.out.print("?/?/? Error!!! ");
    x.printStackTrace(System.out);
    }
    }

    protected void initGateway() {
    pbf = PlatformBeanFactory.getInstance();
    }

    public void setQueue(Queue queue) {
    this.queue = queue;
    }
    }

    Regards,

    K-yo

    Comment


    • #17
      The code I see should be ok. Maybe you should try debugging into the code to get a deeper insight on what actually happens here.

      Regards,
      Andreas

      Comment


      • #18
        Jms

        is your JunitTest Ok ?
        could you post your applicationContext?

        Comment


        • #19
          Check JNDI

          Could you check your JNDI resuorce is up?

          Comment

          Working...
          X