0

I am trying to access the files under the resource folder while running streamlets. Below is my sbt structure.

enter image description here

i want to access files under streamlets -> src -> main -> resources.

i use getClass.getClassLoader.getResource(s"file.txt") running locally, it's working, but while running in cluster getting error, no file and directory. Please assist .

adding build.sbt :-


lazy val root = project.in(file(".")).aggregate(streamlets, app)

lazy val streamlets = project.in(file("streamlets"))
  .enablePlugins(CloudflowAkkaPlugin, ScalaxbPlugin)
  .settings(
    name := s"$baseName-streamlets",
    libraryDependencies ++= Seq(
      "ch.qos.logback" %  "logback-classic" % logbackVersion,
      "org.scalactic" %% "scalactic" % "3.1.1" % "test",
      "org.scalatest" %% "scalatest" % "3.1.1" % "test",
      "com.lightbend.akka" %% "akka-stream-alpakka-s3" % alpakkaVersion,
      "com.typesafe.akka" %% "akka-stream" % akkaVersion,
      "com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
      "com.typesafe.akka" %% "akka-http-xml" % akkaHttpVersion,
      "org.glassfish.jaxb" % "jaxb-runtime" % jaxbVersion, // for JDK11
    )
  )

lazy val app = project.in(file("app"))
  .enablePlugins(CloudflowApplicationPlugin)
  .settings(
    name := s"$baseName-dev",
    runLocalConfigFile := Some("app/src/main/resources/local.conf")
  )
  .dependsOn(streamlets)

roshan panda
  • 69
  • 2
  • 8
  • Are you creating a jar file or using sbt-assemble? – Felipe Dec 26 '20 at 17:29
  • Does this answer your question? [How to read files from resources folder in Scala?](https://stackoverflow.com/questions/27360977/how-to-read-files-from-resources-folder-in-scala) – Felipe Dec 26 '20 at 17:43
  • What is the error you are getting? How did you create the that runs in the cluster? Can you attach your `build.sbt`? – Tomer Shetah Dec 27 '20 at 07:06
  • added the sbt structure. i use travis ci to build and create image in jfrog. that image is pulled by cloudflow to run in cluster pod – roshan panda Dec 28 '20 at 07:53

0 Answers0