0

We are upgrading some ejb based application from Oc4j to jboss eap 7 and one need to connect to oracle AQ created in oracle database but unable to deploy mdb. I have been following this link and used generic jms ra but unable to connect to the queue. My queue name is AD_AMP_QUEUE,I don't know what will be correct connection factory myQCF that i have used was used in Oc4j.

Here is my code:

@MessageDriven(
activationConfig = {
@ActivationConfigProperty(propertyName ="destinationType", propertyValue = "javax.jms.Queue") ,
@ActivationConfigProperty(propertyName="destination", propertyValue="java:/AD_AMP_QUEUE"),
@ActivationConfigProperty(propertyName="jndiParameters", propertyValue="java.naming.factory.url.pkgs=org.jboss.ejb.client.naming"),
@ActivationConfigProperty(propertyName="connectionFactory", propertyValue="myQCF"),
@ActivationConfigProperty(propertyName="connectionFactoryJndiName",propertyValue="myQCF"),
@ActivationConfigProperty(propertyName="connectionFactoryProperties", propertyValue="jdbc_connect_string=jdbc:oracle:thin:@//cdcld600n-NA-vip.adr.alcoa.com:1571/u601.adr.alcoa.com,host=cdcld600n-NA-vip.adr.alcoa.com,user=xxebz_admin,password=******,port=1571,driver=oracle.jdbc.driver.OracleDriver"),
@ActivationConfigProperty(propertyName="destinationProperties", propertyValue="owner=xxebz_admin,name=AD_AMP_QUEUE"),
@ActivationConfigProperty(propertyName="user", propertyValue="xxebz_admin"),
@ActivationConfigProperty(propertyName="password", propertyValue="********"),
@ActivationConfigProperty(propertyName="ConnectionFactoryClassName", propertyValue="oracle.jms.AQjmsConnectionFactory"),
@ActivationConfigProperty(propertyName="QueueConnectionFactoryClassName", propertyValue="oracle.jms.AQjmsQueueConnectionFactory")
}
)
@ResourceAdapter("generic-jms-ra-2.0.0.Alpha3-SNAPSHOT.rar")

public class MessageReceiverEBSNABean implements MessageDrivenBean, MessageListener {  

    static Log log = LogFactory.getLog(MessageReceiverEBSNABean.class.getName());

    private MessageDrivenContext mdc = null;
    public static final String MODIFY = "UPDATE";
    public static final String ERRORS = "ERRORS";
    public static final String CREATE = "CREATE";

    /**
    * Constructor, which is public and takes no arguments.
    */
    public MessageReceiverEBSNABean() {
        log.debug("Constructor invoked");
    }


public void onMessage(Message inMessage) {

        TextMessage msg = null;

        try {

            if (inMessage instanceof TextMessage) 
//logic goes here

}
}

}
and after deploymentwhen jboss tries to connect to destination as defined in mdb am getting below error:
Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@271a856c(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@6250529f destination=java:/AD_AMP_QUEUE destinationType=javax.jms.Queue acknowledgeMode=Auto-acknowledge subscriptionDurability=false reconnectInterval=10 reconnectAttempts=-1 user=xxebz_admin password=<not shown> maxMessages=1 minSession=1 maxSession=15 connectionFactory myQcf jndiParameters={java.naming.factory.url.pkgs=org.jboss.ejb.client.naming}): javax.naming.NameNotFoundException: AD_AMP_QUEUE -- service jboss.naming.context.java.AD_AMP_QUEUE
        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
        at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)
        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at org.jboss.resource.adapter.jms.inflow.JmsActivation.lookup(JmsActivation.java:562)
        at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:385)
        at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupActivation(JmsActivation.java:312)
        at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:258)
        at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsAc
parik
  • 2,313
  • 12
  • 39
  • 67
  • Got a stack trace ? – Nicholas Sep 27 '17 at 23:00
  • It looks like you have a class Isolation problem more like an EJB3 version problem. It may be something happened with "jboss-ejb3-client.jar" file – Anup Dey Sep 30 '17 at 02:44
  • @Nicholas-Full stack trace- – Anupam Mondol Oct 03 '17 at 07:43
  • @Nicola, I have posted stact trace from jboss server log at the end of my post. You can have a look at that. It is throwing error while connecting to oracle AQ. Do you have any other way known to you to connect to oracle AQ from mdb in jboss rather than using a generic jms ra which I have used following https://github.com/jbertram/generic-jms-ra – Anupam Mondol Oct 03 '17 at 07:49
  • @AnupamMondol : First check would be whether the queue exists or not. You can check the logs during the server start up and see if the queue is being deployed. If yes, You can write a simple Java program to just lookup the queue and see if you are able to get the queue. – Anup Dey Oct 03 '17 at 09:45
  • @AnupamMondol : Try activating the JMS message inflow from jmsra.rar. Follow this steps: 1. goto {JBOSS_HOME}/server/{YOURCONFIG}/conf 2. open the standardjboss.xml file 3. scroll down and locate this comment " – Anup Dey Oct 03 '17 at 09:48
  • @Anup Dey: Yes queue exists in oracle schema and I have written a session bean with AQjmsSession and Meesageproducer to send message to the queue which is working and for your second comment are you suggesting to use different rar instead of what am I using now? – Anupam Mondol Oct 03 '17 at 10:41
  • @Anup Dey: I have followed https://developer.jboss.org/thread/228482 and https://github.com/jbertram/generic-jms-ra for the MDB to connect to oracle AQ. I am not able to understand how to bind connectionfactory and queue to a jndi as these exist in a oracle schema and I am trying to connect to it from jboss.getting confused..need help!! – Anupam Mondol Oct 03 '17 at 10:43
  • @ANup Dey:Here is 3 lines of code that have been used in sessionbean: Queue queue = ((AQjmsSession) session).getQueue(user, queueName); MessageProducer producer = session.createProducer(queue); TextMessage tMsg = session.createTextMessage(message); and it id working as I am not looking and jndi I have obtained jms session using datasource of that oracle schema so now when I am trying to deploy a MDB I am just getting confused, don't know how to bind connectionfactory and queue to jndi for cutom jms ra to do a jndi look up. – Anupam Mondol Oct 03 '17 at 10:58
  • Anyone any input? – Anupam Mondol Oct 04 '17 at 07:16

0 Answers0