Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

366
Vistas
Implementing AWS Secret Manager in Java Play Framework

I am trying to implement aws secret manager in java play framework. I followed the steps in this article https://www.geekyhacker.com/2020/05/09/getting-database-credentials-from-aws-secrets-manager-in-spring-boot/ to implement it in springboot first which worked perfectly.

Now, I am following the same steps in play framework.

Step 1: I added following dependencies in build.sbt

libraryDependencies ++= Seq(
  "com.amazonaws" % "aws-java-sdk" % "1.12.122",
  "com.amazonaws.secretsmanager" % "aws-secretsmanager-jdbc" % "1.0.6",
  "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.2"
)

Other relevant dependencies includes:

libraryDependencies ++= Seq(
  "mysql" % "mysql-connector-java" % "8.0.21"
)
libraryDependencies ++= Seq(
  javaJpa,
  "org.hibernate" % "hibernate-core" % "5.4.21.Final", // it is JPA implementation
  "javax.validation" % "validation-api" % "2.0.1.Final" // added this because an issue was coming while running
)

Step 2: updated the conf file

Old config (which is working perfectly fine)

play.db {
  default = unclassified
}
base_db_url = "jdbc:mysql://{my_rds_endpoint}/"
db_annotations= "?createDatabaseIfNotExist=true"
base_db_user_name= "{rds_user_name}"
base_db_password= "{rds_password}"

db {
  unclassified.driver = com.mysql.cj.jdbc.Driver//com.mysql.cj.jdbc.Driver
  unclassified.jndiName = UnclassifiedDS
  unclassified.url= ${base_db_url}"unclassified_"${serverEnvironment}${db_annotations}
  unclassified.username=${base_db_user_name}
  unclassified.password=${base_db_password}
}

New config:

play.db {
      default = unclassified
    }
    base_db_url = "jdbc-secretsmanager:mysql://{my-rds-endpoint}/"
    db_annotations= "?createDatabaseIfNotExist=true"
    base_db_user_name= "{secret-name in secret manager}"
db {    
    unclassified.driver=com.amazonaws.secretsmanager.sql.AWSSecretsManagerMySQLDriver
    unclassified.jndiName = UnclassifiedDS
    unclassified.url= ${base_db_url}"unclassified_"${serverEnvironment}${db_annotations}
    unclassified.username=${base_db_user_name}
}

But getting the error: Configuration error [Cannot initialize to database] Caused by: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required.

Can anyone help me here?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda