[mule-user] Problems integrating Mule with Oracle AQ

80 views
Skip to first unread message

Ian Petzer

unread,
Mar 13, 2007, 3:20:11 PM3/13/07
to us...@mule.codehaus.org
Hi,

I'm having some problems integrating Mule with Oracle AQ. I've
included my configuration below and as you can see I'm not trying to
do much, simply read in a message from an AQ queue and then echo it
out to the console.

However when I try to start Mule, I get the following exception:

Root Exception stack trace:
java.lang.NullPointerException
at oracle.jms.AQjmsConsumer.<init>(AQjmsConsumer.java:292)
at oracle.jms.AQjmsConsumer.<init>(AQjmsConsumer.java:178)
at oracle.jms.AQjmsSession.createReceiver(AQjmsSession.java:1438)
at org.mule.providers.jms.Jms102bSupport.createConsumer(Jms102bSupport.j
ava:139)
at org.mule.providers.oracle.jms.OracleJmsSupport.createConsumer(OracleJ
msSupport.java:106)
at org.mule.providers.jms.TransactedJmsMessageReceiver.createConsumer(Tr
ansactedJmsMessageReceiver.java:336)
at org.mule.providers.oracle.jms.OracleJmsMessageReceiver.createConsumer
(OracleJmsMessageReceiver.java:42)
at org.mule.providers.jms.TransactedJmsMessageReceiver.doConnect(Transac
tedJmsMessageReceiver.java:125)
at org.mule.providers.AbstractMessageReceiver.connect(AbstractMessageRec
eiver.java:400)
at org.mule.providers.SingleAttemptConnectionStrategy.doConnect(SingleAt
temptConnectionStrategy.java:29)
at org.mule.providers.AbstractConnectionStrategy.connect(AbstractConnect
ionStrategy.java:86)
at org.mule.providers.AbstractMessageReceiver.connect(AbstractMessageRec
eiver.java:393)
at org.mule.impl.model.AbstractComponent.connectListeners(AbstractCompon
ent.java:629)
at org.mule.impl.model.AbstractComponent.start(AbstractComponent.java:22
4)
at org.mule.impl.model.AbstractComponent.start(AbstractComponent.java:20
3)
at org.mule.impl.model.AbstractModel.start(AbstractModel.java:322)
at org.mule.MuleManager.start(MuleManager.java:858)
at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXm
lConfigurationBuilder.java:247)
at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXm
lConfigurationBuilder.java:208)
at org.mule.MuleServer.initialize(MuleServer.java:268)
at org.mule.MuleServer.run(MuleServer.java:181)
at org.mule.MuleServer.start(MuleServer.java:169)
at org.mule.MuleServer.main(MuleServer.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java
:292)
at java.lang.Thread.run(Thread.java:595)


Since I don't have access to the oracle.jms.AQjmsConsumer source code,
I can't see what is going on. Does anyone have any ideas?

Thanks,
Ian

ps: I'm using the thing client, not the oci client as described in the
example at:
http://mule.mulesource.org/wiki/display/MULE/Oracle+AQ+Integration

pps: I've changed the jdbc url in this email but I kno its valid as if
I change it in my app, I get a different exception complaining about
an inability to connect to the db.

ppps: The actual AQ message payload is just a byte stream. (RAW in Oracle terms)

<mule-configuration id="Mule_Echo_Sample" version="1.0">

<container-context
className="org.mule.extras.spring.SpringContainerContext">
<properties>
<property name="configFile" value="application-context.xml" />
</properties>
</container-context>

<connector name="oracleJmsConnector"
className="org.mule.providers.oracle.jms.OracleJmsConnector">
<properties>
<property name="url"
value="jdbc:oracle:thin:USERNAME/PASSWORD@host:1521:SID"/>
</properties>
</connector>

<model name="echoSample">
<mule-descriptor name="Oracel AQ stuff"
implementation="org.mule.components.simple.EchoComponent">
<inbound-router>
<endpoint address="oaq://aq_queue1">
</endpoint>
</inbound-router>
</mule-descriptor>
</model>

</mule-configuration>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Ian Petzer

unread,
Mar 22, 2007, 10:41:59 AM3/22/07
to us...@mule.codehaus.org

Hi all,

I solved the issue below, so if anyone runs into the same problem:

The NullPointerException is coming from within the Oracle code when it
attempts to determine the ADT type of the queue. It was not actually a Mule
configuration problem, it was a problem with the way the queue was created.

The Mule AQ connector will not be able to connect to a queue of type 'Raw'.

I used the following code to create the queue (mostly ripped from the Oracle
online documentation). Note you will have to create the start the queue once
it is started

public static AQSession createSession(String args[])
{
Connection db_conn;
AQSession aq_sess = null;

try
{

Class.forName("oracle.jdbc.driver.OracleDriver");

//Put in your connection details here
db_conn =
DriverManager.getConnection(
"jdbc:oracle:thin:@HOST:PORT:SID",
"USER", "PASSWORD");

System.out.println("JDBC Connection opened ");
db_conn.setAutoCommit(false);

Class.forName("oracle.AQ.AQOracleDriver");

/* Creating an AQ Session: */
aq_sess = AQDriverManager.createAQSession(db_conn);
System.out.println("Successfully created AQSession ");
}
catch (Exception ex)
{
System.out.println("Exception: " + ex);
ex.printStackTrace();
}
return aq_sess;
}

public static void createQueueTable(AQSession aq_sess) throws AQException
{

AQQueueProperty queue_prop;
AQQueueTable q_table;
AQQueue queue;


AQQueueTableProperty jmsQTP = new
AQQueueTableProperty("SYS.AQ$_JMS_MESSAGE");

/* Creating a queue table called aq_table1 in C4_QUEUES schema: */
q_table = aq_sess.createQueueTable ("USER", "TABLE", jmsQTP);
System.out.println("Successfully created queue table");

/* Creating a new AQQueueProperty object */
queue_prop = new AQQueueProperty();

/* Creating a queue called aq_queue1 in aq_table1: */
queue = aq_sess.createQueue (q_table, "aq_queue2", queue_prop);
System.out.println("Successfully created aq_queue1 in aq_table1");
}

--
View this message in context: http://www.nabble.com/Problems-integrating-Mule-with-Oracle-AQ-tf3397984.html#a9616191
Sent from the Mule - User mailing list archive at Nabble.com.

Reply all
Reply to author
Forward
0 new messages