Uploaded image for project: 'apiman (API Management)'
  1. apiman (API Management)
  2. APIMAN-1195

Unable to establish a connection with Oracle db

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 1.2.x
    • 1.2.x
    • Gateway, Management API
    • None

      There seems to be some issue when using Oracle as storage. Database initialisation will fail, probably because it was not possible to establish jdbc connection with given database. However the datasource seems to be be configured correctly as the test-connection operation will pass when invoked via WF cli or admin console.

      DS configuration

      <datasource jndi-name="java:jboss/datasources/amg" pool-name="amg" enabled="true" use-java-context="true">
        <connection-url>jdbc:oracle:thin:@db-12...redhat.com:1521:orcl</connection-url>
        <driver>oracle</driver>
        <pool>
          <max-pool-size>30</max-pool-size>
        </pool>
        <security>
          <user-name>dballo06</user-name>
           <password>dballo06</password>
        </security>
      </datasource>
      

      *Driver configuration
      *

      <driver name="oracle" module="oracle.jdbc">
         <driver-class&gt;oracle.jdbc.driver.OracleDriver</driver-class&gt;
      </driver>
      

      Driver module.xml

      <module xmlns="urn:jboss:module:1.1" name="oracle.jdbc" slot="main">
        <resources>
            <resource-root path="oracle12c-jdbc4-ojdbc7.jar"/>
        </resources>
        <dependencies>
            <module name="javax.api"/>
            <module name="javax.transaction.api"/>
        </dependencies>
      </module>
      

      Relevant part of amg.properties (manager component)

      apiman.jdbc.datasource.jndi-location=java:jboss/datasources/amg
      
      apiman-manager.storage.type=jpa
      apiman-manager.storage.jpa.initialize=True
      
      apiman.hibernate.connection.datasource=${apiman.jdbc.datasource.jndi-location}
      apiman.hibernate.dialect= io.apiman.manager.api.jpa.ApimanOracle12Dialect
      apiman.hibernate.hbm2ddl.auto=verify
      

      Exception observable in server.log

      05:04:40,172 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (Thread-91) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection
      	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:345)
      	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:352)
      	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287)
      	at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1320)
      	at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:496)
      	at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:617)
      	at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:589)
      	at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:590)
      	at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:429)
      	at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:747)
      	at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
      	at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)
      	at org.apache.commons.dbutils.AbstractQueryRunner.prepareConnection(AbstractQueryRunner.java:204)
      	at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:305)
      	at io.apiman.manager.api.jpa.JpaStorageInitializer.initialize(JpaStorageInitializer.java:126)
      	at io.apiman.manager.api.war.WarCdiFactory.initJpaStorage(WarCdiFactory.java:306)
      	at io.apiman.manager.api.war.WarCdiFactory.provideStorage(WarCdiFactory.java:127)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
      	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)
      	at org.jboss.weld.injection.producer.ProducerMethodProducer.produce(ProducerMethodProducer.java:99)
      	at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:161)
      	at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:181)
      	at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
      	at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
      	at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
      	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
      	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:99)
      	at io.apiman.manager.api.core.IStorage$816713466$Proxy$_$$_WeldClientProxy.beginTx(Unknown Source)
      	at io.apiman.manager.api.exportimport.manager.StorageImportDispatcher.start(StorageImportDispatcher.java:129)
      	at io.apiman.manager.api.war.WarApiManagerBootstrapperServlet.doImport(WarApiManagerBootstrapperServlet.java:101)
      	at io.apiman.manager.api.war.WarApiManagerBootstrapperServlet.access$200(WarApiManagerBootstrapperServlet.java:43)
      	at io.apiman.manager.api.war.WarApiManagerBootstrapperServlet$1.run(WarApiManagerBootstrapperServlet.java:71)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.sql.SQLRecoverableException: IO Error: Connection reset
      	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:752)
      	at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
      	at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
      	at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
      	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
      	... 37 more
      Caused by: java.net.SocketException: Connection reset
      	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
      	at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
      	at oracle.net.ns.DataPacket.send(DataPacket.java:209)
      	at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:215)
      	at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:302)
      	at oracle.net.ns.NetInputStream.read(NetInputStream.java:249)
      	at oracle.net.ns.NetInputStream.read(NetInputStream.java:171)
      	at oracle.net.ns.NetInputStream.read(NetInputStream.java:89)
      	at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123)
      	at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79)
      	at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:429)
      	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:397)
      	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
      	at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:437)
      	at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:954)
      	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:639)
      	... 41 more
      
      05:04:40,173 INFO  [stdout] (Thread-91) =======================================
      05:04:40,174 INFO  [stdout] (Thread-91) Initializing apiman Manager database.
      05:04:40,176 INFO  [stdout] (Thread-91) CREATE SEQUENCE hibernate_sequence;
      05:04:40,343 ERROR [stderr] (Thread-91) Exception in thread "Thread-91" java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: ORA-00933: SQL command not properly ended
      05:04:40,344 ERROR [stderr] (Thread-91)  Query: CREATE SEQUENCE hibernate_sequence; Parameters: []
      05:04:40,344 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.war.WarApiManagerBootstrapperServlet.doImport(WarApiManagerBootstrapperServlet.java:105)
      05:04:40,344 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.war.WarApiManagerBootstrapperServlet.access$200(WarApiManagerBootstrapperServlet.java:43)
      05:04:40,344 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.war.WarApiManagerBootstrapperServlet$1.run(WarApiManagerBootstrapperServlet.java:71)
      05:04:40,344 ERROR [stderr] (Thread-91) 	at java.lang.Thread.run(Thread.java:745)
      05:04:40,344 ERROR [stderr] (Thread-91) Caused by: java.lang.RuntimeException: java.sql.SQLException: ORA-00933: SQL command not properly ended
      05:04:40,344 ERROR [stderr] (Thread-91)  Query: CREATE SEQUENCE hibernate_sequence; Parameters: []
      05:04:40,345 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.jpa.JpaStorageInitializer.initialize(JpaStorageInitializer.java:156)
      05:04:40,345 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.war.WarCdiFactory.initJpaStorage(WarCdiFactory.java:306)
      05:04:40,345 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.war.WarCdiFactory.provideStorage(WarCdiFactory.java:127)
      05:04:40,345 ERROR [stderr] (Thread-91) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      05:04:40,345 ERROR [stderr] (Thread-91) 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      05:04:40,345 ERROR [stderr] (Thread-91) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      05:04:40,345 ERROR [stderr] (Thread-91) 	at java.lang.reflect.Method.invoke(Method.java:497)
      05:04:40,345 ERROR [stderr] (Thread-91) 	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.injection.producer.ProducerMethodProducer.produce(ProducerMethodProducer.java:99)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:161)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:181)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
      05:04:40,346 ERROR [stderr] (Thread-91) 	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
      05:04:40,347 ERROR [stderr] (Thread-91) 	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:99)
      05:04:40,347 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.core.IStorage$816713466$Proxy$_$$_WeldClientProxy.beginTx(Unknown Source)
      05:04:40,347 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.exportimport.manager.StorageImportDispatcher.start(StorageImportDispatcher.java:129)
      05:04:40,347 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.war.WarApiManagerBootstrapperServlet.doImport(WarApiManagerBootstrapperServlet.java:101)
      05:04:40,347 ERROR [stderr] (Thread-91) 	... 3 more
      05:04:40,347 ERROR [stderr] (Thread-91) Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended
      05:04:40,347 ERROR [stderr] (Thread-91)  Query: CREATE SEQUENCE hibernate_sequence; Parameters: []
      05:04:40,347 ERROR [stderr] (Thread-91) 	at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:393)
      05:04:40,348 ERROR [stderr] (Thread-91) 	at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:491)
      05:04:40,348 ERROR [stderr] (Thread-91) 	at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:421)
      05:04:40,348 ERROR [stderr] (Thread-91) 	at io.apiman.manager.api.jpa.JpaStorageInitializer.initialize(JpaStorageInitializer.java:152)
      05:04:40,348 ERROR [stderr] (Thread-91) 	... 23 more
      

              ewittman@redhat.com Eric Wittmann
              jcechace@redhat.com Jakub Čecháček
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: