Mistre83
Mistre83

Reputation: 2827

Spring Integration with Oracle AQ

I'm trying to learn Spring Integration and for this i would like to create an application like this:

From Oracle i send messages (on Oracle Queue), this message will be intercepted from a Java application (build with Spring Integration) and the application will send an email based on message received. The message will contain To: - Cc: and the text to send.

To make this kind of communication i've decided to use JMS (i think in Oracle this is made with Oracle AQ).

In the database i've already created the Queue and now i'm trying to create a simple applicationContext.xml to start this handshake.

Looking on the net i've found really few articles about this (Spring Integration + Oracle AQ) and i'm getting some error. The main error is this: java.lang.ClassNotFoundException: oracle.jms.AQjmsFactory

Right now this is my applicationContext.xml

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:orcl="http://www.springframework.org/schema/data/orcl" 
    xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
            http://www.springframework.org/schema/data/orcl  http://www.springframework.org/schema/data/orcl/spring-data-orcl-1.0.xsd">

    <int:channel id="inbound" />
    <int:channel id="outbound" />

    <bean id="simpleMessageListener" class="it.dirimo.SimpleMessageListener" />

    <int-jms:inbound-channel-adapter
        channel="inbound"
        connection-factory="connectionFactory"
        destination-name="Q1">  
        <int:poller fixed-delay="1000" />
    </int-jms:inbound-channel-adapter>

    <int:service-activator input-channel="inbound" output-channel="outbound" ref="simpleMessageListener" method="onMessage" />

    <int-jms:outbound-channel-adapter id="jmsOut" 
        channel="outbound" 
        connection-factory="connectionFactory"
        destination-name="sampleQueue" />

    <int:poller id="poller" default="true" fixed-delay="10000" />

    <orcl:aq-jms-connection-factory id="connectionFactory"
        data-source="dataSource"
        use-local-data-source-transaction="true"/>

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="false">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:ORCL" />
        <property name="username" value="user" />
        <property name="password" value="password" />
    </bean>
</beans>

Maybe i'm using "old" technologies (for example i've seen for the first time this org.apache.commons.dbcp.BasicDataSource)

Unfortunally i'm so new about Spring Integration and i've seen for the first time Oracle Queue (i'm using Oracle for work but never used any kind of Queue).

Some advice of how to proceed will be apreciated :)

EDIT 1 To solve the problem about the AQjmsFactory need to include aqapi.jar

Upvotes: 2

Views: 3095

Answers (1)

Gary Russell
Gary Russell

Reputation: 174729

java.lang.ClassNotFoundException: oracle.jms.AQjmsFactory

This simply means you are missing the jar that contains that class from the classpath.

Oracle, typically, requires that you manually download their jars from them directly.

Upvotes: 2

Related Questions