Problem connecting java backend to oracle db in docker container

  docker, hikaricp, java, oracle11g, playframework

I have a Java backend developed with play framework in a vps (CentOs 7), inside the vps i have a docker with a oracle 11g. im using hikaricp for the connection:

driverClassName=oracle.jdbc.driver.OracleDriver
jdbcUrl=jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1600))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
username=test
password=123456
maximumPoolSize=8
minimumPoolSize=4
connectionTimeout=30000
idleTimeout=300000
maxLifetime=1800000
registerMbeans=false

the docker container is running like this:

CONTAINER ID        IMAGE                                       COMMAND                  CREATED             STATUS                 PORTS                                            NAMES
37ef1a013dc4        oracle11g-installed                         "/assets/entrypoint.…"   3 hours ago         Up 3 hours             8080/tcp, 0.0.0.0:1600->1521/tcp                 brave_almeida

I can connect to the database using sql developer, and using my local computer (mac), but in the vps when i start the server always get the error:

Configuration error: Configuration error[Cannot connect to database [default]]
    at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:92)
    at play.api.Configuration.reportError(Configuration.scala:570)
    at com.edulify.play.hikaricp.HikariCPPlugin$$anonfun$onStart$2.apply(HikariCPPlugin.scala:46)
    at com.edulify.play.hikaricp.HikariCPPlugin$$anonfun$onStart$2.apply(HikariCPPlugin.scala:37)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at com.edulify.play.hikaricp.HikariCPPlugin.onStart(HikariCPPlugin.scala:37)
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:88)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:88)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:88)
    at play.utils.Threads$.withContextClassLoader(Threads.scala:18)
    at play.api.Play$.start(Play.scala:87)
    at play.core.StaticApplication.<init>(ApplicationProvider.scala:52)
    at play.core.server.NettyServer$.createServer(NettyServer.scala:280)
    at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:316)
    at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:311)
    at scala.Option.map(Option.scala:145)
    at play.core.server.NettyServer$.main(NettyServer.scala:311)
    at play.core.server.NettyServer.main(NettyServer.scala)

Any ideas what is the problem?

Source: StackOverflow

LEAVE A COMMENT