Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Problems creating EJB with Spring

  1. #11
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Have a closer look at the server.log file of your JBoss. The reason why the bean could not be instantiated should be there.

    Regards,
    Andreas

  2. #12
    Join Date
    Jan 2006
    Posts
    5

    Default

    I have did that at first, and i just did that again when you ask, but still all the exception was at org.jboss.ejb, org.jboss.jms and org.jboss.mq classes, it did not occur on any of my class nor spring's. Here i attach the full error log.

    Thanks..
    Attached Files Attached Files

  3. #13
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Maybe try to deploy a vanilla MDB (without Spring) and try to get that running. Afterwards you could extend from AbstractJmsMessageDrivenBean and add the stuff you need. That should reveal if the problem is related to Spring or some other configuration issue with JBoss.

    Regards,
    Andreas

  4. #14
    Join Date
    Jan 2006
    Posts
    5

    Default

    Hi Andreas,

    Maybe try to deploy a vanilla MDB (without Spring) and try to get that running. Afterwards you could extend from AbstractJmsMessageDrivenBean and add the stuff you need. That should reveal if the problem is related to Spring or some other configuration issue with JBoss.
    I just try to use a coventional MDB, without using Spring at all and it runs flawlessly, what I did is try to send a JMS via the login.jsp in the /jsp directory(I create a testing-mdb.ear for that), I attach all the source code into here.

    Then I retry my Spring version(platform.ear),
    but this time instead of using the JmsTemplate(AbtractJmsGateway),
    I switch it to the same logic I used in the Login.jsp, and the same error message occurs

    One thing i forget to mention is now I got the exception on the attemp to invoke jmsTemplate.convertAndSend(), not on the appserver startup anymore.

    Another thing worth to mention is when I used my platform.ear (with JsmTemplate) I got this message:

    2006-05-26 16:57:21,276 INFO [STDOUT] @@@@@ ===> Try to call JMS
    2006-05-26 16:57:21,276 DEBUG [org.springframework.beans.factory.support.DefaultL istableBeanFactory] Returning cached instance of singleton bean 'jmsEasySender'
    2006-05-26 16:57:21,276 INFO [STDOUT] ?/?/? Queue is QUEUE.testQueue
    2006-05-26 16:57:21,276 DEBUG [org.springframework.jms.connection.SingleConnectio nFactory] Created single connection: Connection@7462871[token=ConnectionToken:null/b97ff2c277a0a09f2776891247db0bfc rcvstate=STOPPED]
    2006-05-26 16:57:21,296 DEBUG [org.springframework.jms.connection.SingleConnectio nFactory] Returning single connection: Connection@7462871[token=ConnectionToken:null/b97ff2c277a0a09f2776891247db0bfc rcvstate=STOPPED]
    2006-05-26 16:57:21,306 DEBUG [org.springframework.jms.core.JmsTemplate] Executing callback on JMS Session [SpySession@11103930[tx=false ack=AUTO txid=null RUNNING connection=Connection@7462871[token=ConnectionToken:ID:3/b97ff2c277a0a09f2776891247db0bfc rcvstate=STOPPED]]] from connection [Connection@7462871[token=ConnectionToken:ID:3/b97ff2c277a0a09f2776891247db0bfc rcvstate=STOPPED]]
    2006-05-26 16:57:21,306 DEBUG [org.springframework.jms.core.JmsTemplate]
    Sending created message [SpyTextMessage {
    Header {
    jmsDestination : null
    jmsDeliveryMode : -1
    jmsExpiration : 0
    jmsPriority : -1
    jmsMessageID : null
    jmsTimeStamp : 0
    jmsCorrelationID: null
    jmsReplyTo : null
    jmsType : null
    jmsRedelivered : false
    jmsProperties : {}
    jmsPropReadWrite: true
    msgReadOnly : false
    producerClientId: ID:3
    }
    Body {
    text :HELLO 123
    }
    }]
    plus this:

    2006-05-26 16:31:47,040 WARN [org.jboss.ejb.plugins.jms.DLQHandler] Message resent too many times; sending it to DLQ; message id=ID:3-11486863063891
    The queue is not null when I print to the log, but on the header it displays as jmsDestination : null, and here is what i get when using the testing-mdb.ear:

    2006-05-26 17:04:03,514 INFO [STDOUT] @@@ routingQueue QUEUE.testQueue
    2006-05-26 17:04:03,514 INFO [STDOUT] @@@ Send JSM 2
    2006-05-26 17:04:03,524 INFO [STDOUT] @@@ queueSender : SpyMessageProducer@15701285[ dest=QUEUE.testQueue delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@28191855[tx=false ack=AUTO txid=null RUNNING connection=Connection@19458313[token=ConnectionToken:ID:3/74193d44004f149d7bc77a330c1c2214 rcvstate=STOPPED]]]
    2006-05-26 17:04:03,524 INFO [STDOUT] @@@ Send JSM 3
    2006-05-26 17:04:03,654 INFO [STDOUT] constructor
    2006-05-26 17:04:03,654 INFO [STDOUT] set MessageDrivenContext org.jboss.ejb.MessageDrivenEnterpriseContext$Messa geDrivenContextImpl@1c83354
    2006-05-26 17:04:03,664 INFO [STDOUT] ejb create
    2006-05-26 17:04:03,694 INFO [STDOUT] onMessage.jmsMessage -->SpyTextMessage {
    Header {
    jmsDestination : QUEUE.testQueue
    jmsDeliveryMode : 2
    jmsExpiration : 1148690043524
    jmsPriority : 4
    jmsMessageID : ID:3-11486882435241
    jmsTimeStamp : 1148688243524
    jmsCorrelationID: null
    jmsReplyTo : null
    jmsType : null
    jmsRedelivered : false
    jmsProperties : {message_pk=123}
    jmsPropReadWrite: false
    msgReadOnly : true
    producerClientId: ID:3
    }
    Body {
    text :Hello 123 World
    }
    }
    Kind Regards,
    k-yo
    Attached Files Attached Files

  5. #15
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    How is this jmsEasySender bean defined and configured?

    Regards,
    Andreas

  6. #16
    Join Date
    Jan 2006
    Posts
    5

    Default

    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

  7. #17
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    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

  8. #18
    Join Date
    Mar 2007
    Posts
    10

    Default Jms

    is your JunitTest Ok ?
    could you post your applicationContext?

  9. #19
    Join Date
    Mar 2007
    Posts
    10

    Default Check JNDI

    Could you check your JNDI resuorce is up?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •