Please don't send the mail for request help to dev and user mail list at
the same time. Most developer monitor these two mail list.
>From the stack trace , I guess it's an AQ's setup issue.
Maybe you can try to write a normal JMS code to test if you can get the
message from the remote AQ's Queue.
Willem
sebodev wrote:
> Hi,
>
> i'm using Oracle AQ with apache camel. I have a very simple code like this:
>
> ---
> package pl.sbsd.apachecamel.oracleaq;
>
> import javax.jms.ConnectionFactory;
>
> import oracle.jdbc.pool.OracleDataSource;
> import oracle.jms.AQjmsFactory;
>
> import org.apache.camel.CamelContext;
> import org.apache.camel.Consumer;
> import org.apache.camel.Exchange;
> import org.apache.camel.Processor;
> import org.apache.camel.ProducerTemplate;
> import org.apache.camel.component.jms.JmsComponent;
> import org.apache.camel.impl.DefaultCamelContext;
>
> public class OracleAQApp {
>
> private String uri;
> private String login;
> private String password;
>
> private final String jdbcUrl = "jdbc:oracle:thin:@xxx:1521:xxx";
>
> private CamelContext camel;
> private ConnectionFactory connectionFactory;
> private ProducerTemplate producerTemplate;
>
> public OracleAQApp(String uri, String login, String password)
> throws Exception {
> this.uri = uri;
> this.login = login;
> this.password = password;
> OracleDataSource dataSource = new OracleDataSource();
> dataSource.setURL(jdbcUrl);
> dataSource.setUser(login);
> dataSource.setPassword(password);
> connectionFactory =
> AQjmsFactory.getQueueConnectionFactory(dataSource);
> camel = new DefaultCamelContext();
> JmsComponent jmsComponent = new JmsComponent(camel);
> jmsComponent.setConnectionFactory(connectionFactory);
> camel.addComponent("jms", jmsComponent);
> producerTemplate = camel.createProducerTemplate();
> Consumer consumer = camel.getEndpoint(uri).createConsumer(
> new Processor() {
>
> public void process(Exchange exchange)
> throws Exception {
> System.out.println("New
> message!");
>
> System.out.println(exchange.getIn().getBody());
> }
>
> });
> consumer.start();
> camel.start();
> }
>
> public void send(String message) throws InterruptedException {
> producerTemplate.sendBody(uri, message);
> Thread.sleep(500000);
> }
>
> }
> ---
>
> I'm sending some message to the queue and the consumer will consume it. That
> works with my local installation of oracle database. When i'm using remote
> database which is in the LAN then the messages are writting into the queue
> but consumer can't dequeue them. In the eclipse console i get this message:
>
> ---
> Exception in thread "DefaultMessageListenerContainer-1"
> java.lang.NullPointerException
> at java.lang.String.indexOf(String.java:1564)
> at java.lang.String.indexOf(String.java:1546)
> at
> org.springframework.jms.support.JmsUtils.buildExceptionMessage(JmsUtils.java:255)
> at
> org.springframework.jms.listener.DefaultMessageListenerContainer.handleListenerSetupFailure(DefaultMessageListenerContainer.java:745)
> at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:897)
> at java.lang.Thread.run(Thread.java:595)
> ---
>
> I have debugged the DefaultMessageListenerContainer and there is a exception
> with information: "JMS-120: Dequeue failed.". I dont now what can it be.
> Everythink works when i'm using local database. I've tested many jdbc
> drivers "ojdbc*.jar" and oracle aq apis "aqapi*.jar" but nothing. I've
> privileges to dequeue the messages.
>
> Kind regards
> Sebastian