title: How to read Oracle OAQ queue from Camel
body: <p>I am writing a Camel app that reads LCR's from an Oracle oaq ("ANYDATA") queue.  We are not using Weblogic, and are running under Spring Boot.  Right now I'm trying to create a minimal app that reads the LCR's and dumps them to a log.  We are getting an exception (full trace shown at bottom) that says:</p>
  
  <pre><code>c.c.j.DefaultJmsMessageListenerContainer : Setup of JMS message listener invoker failed for destination 'AQADMIN.MULEBUS_ANYDATA_Q' - trying to recover. Cause: JMS-120: Dequeue failed; nested exception is oracle.jms.AQjmsException: JMS-224: Typemap is invalid - must be populated with SQLType/OraDataFactory mappings to receive messages from Sys.AnyData destinations
  </code></pre>
  
  <p>I think I need to grab the session and populate the type map.  The LCR's are in XML format; from 1 example on the web I saw I could probably do something like this:</p>
  
  <pre><code>((AQjmsSession) session).getTypeMap().put(("SYS.XMLTYPE", Class.forName("oracle.xdb.XMLType"));
  </code></pre>
  
  <p>.. but I am a Camel newbie (not to mention an ANYDATA newbie), and am not sure whether that will work or how to do it.  Also wondering whether I am using the wrong driver (I see stuff indicating the thin driver (which I am using), other stuff pointing to oci.  Note that we're connecting, as nothing happens till we generate an lcr.</p>
  
  <p>Any pointers on how to set up a minimal app to read the lcr in Camel and dump it to a log would be most gratefully appreciated. </p>
  
  <p>The route looks like this currently:</p>
  
  <p>from("oracleAQ:{{xyz.oracleaq.datasource.srcaq}}")
                  .to("log:out");</p>
  
  <p>.. and the referenced component is:</p>
  
  <pre><code> @Qualifier("oracleAQ")
      @Bean
      public Object oracleAQ() throws JMSException {
          LOG.info("OracleAQ startup - url={}, user={}", url, username);
  
          try {
              QueueConnectionFactory f = AQjmsFactory.getQueueConnectionFactory(url, new Properties());
              UserCredentialsConnectionFactoryAdapter adapter = new UserCredentialsConnectionFactoryAdapter();
              adapter.setTargetConnectionFactory(f);
              adapter.setUsername(username);
              adapter.setPassword(password);
              return JmsComponent.jmsComponent(adapter);
          } catch (JMSException jmse) {
              LOG.error("Error starting OracleAQ component: {}", jmse);
              throw jmse;
          }
      }
  </code></pre>
  
  <p>TIA.</p>
  
  <p>Stack trace follows:</p>
  
  <pre><code>2016-06-06 11:12:58.632  INFO 110904 --- [EBUS_ANYDATA_Q]] c.c.j.DefaultJmsMessageListenerContainer : Successfully refreshed JMS Connection
  2016-06-06 11:13:03.682  WARN 110904 --- [EBUS_ANYDATA_Q]] c.c.j.DefaultJmsMessageListenerContainer : Setup of JMS message listener invoker failed for destination 'AQADMIN.MULEBUS_ANYDATA_Q' - trying to recover. Cause: JMS-120: Dequeue failed; nested exception is oracle.jms.AQjmsException: JMS-224: Typemap is invalid - must be populated with SQLType/OraDataFactory mappings to receive messages from Sys.AnyData destinations
  
  oracle.jms.AQjmsException: JMS-120: Dequeue failed
      at oracle.jms.AQjmsError.throwEx(AQjmsError.java:315) ~[aqapi-11.2.0.3.jar:na]
      at oracle.jms.AQjmsConsumer.jdbcDequeue(AQjmsConsumer.java:1626) ~[aqapi-11.2.0.3.jar:na]
      at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:1035) ~[aqapi-11.2.0.3.jar:na]
      at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:960) ~[aqapi-11.2.0.3.jar:na]
      at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:938) ~[aqapi-11.2.0.3.jar:na]
      at oracle.jms.AQjmsConsumer.receive(AQjmsConsumer.java:790) ~[aqapi-11.2.0.3.jar:na]
      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:420) ~[spring-jms-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:300) ~[spring-jms-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:253) ~[spring-jms-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1164) ~[spring-jms-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1156) ~[spring-jms-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1053) ~[spring-jms-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]
  Caused by: oracle.jms.AQjmsException: JMS-224: Typemap is invalid - must be populated with SQLType/OraDataFactory mappings to receive messages from Sys.AnyData destinations
      at oracle.jms.AQjmsError.throwEx(AQjmsError.java:292) ~[aqapi-11.2.0.3.jar:na]
      at oracle.jms.AQjmsConsumer.convertAnydataToMessage(AQjmsConsumer.java:1791) ~[aqapi-11.2.0.3.jar:na]
      at oracle.jms.AQjmsConsumer.jdbcDequeue(AQjmsConsumer.java:1437) ~[aqapi-11.2.0.3.jar:na]
      ... 13 common frames omitted
  </code></pre>