1

I'm trying to deploy a simple web application built using Play framework with Scala. The application is working fine, when I run the application using sbt run command, however, when I tried to deploy the application, in my local server, using sbt dist command, I'm getting the following message

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/D:/Scala/SomeDomain/SomeProject/target/universal/SomeProject-1.0-SNAPSHOT/lib/com.google.inject.guice-4.2.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Oops, cannot start the server.
com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Error injecting constructor, java.io.IOException: Dictionary directory does not exist: D:\Scala\SomeDomain\SomeProject\target\universal\SomeProject-1.0-SNAPSHOT\bin\dict
  at initializer.ServiceInitializer.<init>(ServiceInitializer.scala:11)
  at initializer.ApplicationInitializer.configure(ApplicationInitializer.scala:12) (via modules: com.google.inject.util.Modules$OverrideModule -> initializer.ApplicationInitializer)
  while locating initializer.ServiceInitializer

I'm using Windows, I extracted the generated .zip file and executed the .bat file from the /bin directory.

build.sbt


version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala, LauncherJarPlugin)

scalaVersion := "2.12.10"

libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
libraryDependencies += "postgresql" % "postgresql" % "9.1-901-1.jdbc4"

plugins.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.0")
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.11.0")

1 Answer 1

1

Seems like some component of you application expects a directory to exist:

java.io.IOException: Dictionary directory does not exist: D:\Scala\SomeDomain\SomeProject\target\universal\SomeProject-1.0-SNAPSHOT\bin\dict

Ensure to create the directory, or add the missing files to your dist.

Sign up to request clarification or add additional context in comments.

5 Comments

hi @cbley, I tried to run the application in Linux (ubuntu), I'm able to run the application, through the script in bin directory (I do get the Warning, but there was no errors), the problem is when I try to deploy in Windows.
@gokul Does the directory exist or not? Where is the folder to be expected? Maybe you should start the app from the base folder with bin\start.bat (or however your bat file is called).
when I deployed the application in Linux, I didn't create any directory. I simply executed the shell script, instead of .bat I also tried executing the .bat from the base folder, I'm getting the same error. When I searched, for this issue, people were saying, it maybe because of java version, but in both the ubuntu and windows, I'm using JDK version 11.0.6
The warnings are because of the Java version, but the warnings are not the issue. The problem is because of the missing directory, which is not a Play thing, it is your code (I suppose) that expects the directory to be there. Where does ServiceInitializer.scala come from?
yes @cbley, the error was due to a dependency injection present in the ServiceInitializer file of the project, I sorted that out, now I'm able to run the application in windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.