Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scalate cannot compile template when part of executable jar #104

Open
kgignatyev opened this issue Sep 9, 2017 · 4 comments
Open

scalate cannot compile template when part of executable jar #104

kgignatyev opened this issue Sep 9, 2017 · 4 comments

Comments

@kgignatyev
Copy link

Here is project that reproduces the issue
https://github.com/kgignatyev/scalate-test

Traditional app works

creating assembly
mvn clean  install appassembler:assemble
trying it
bash target/appassembler/bin/ctrl

but when the same application is packaged by spring-boot into a single executable jar, ssp compiler does NOT work

Packaging all the jars into executable jar
mvn -f pom-executable-jar.xml clean install

Trying it
java -jar target/scalate-test-1.0-SNAPSHOT.jar 

I see this error:
Exception in thread "main" java.lang.reflect.InvocationTargetException
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:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.fusesource.scalate.TemplateException: object scala in compiler mirror not found.
at org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:886)
at org.fusesource.scalate.TemplateEngine.compileAndLoadEntry(TemplateEngine.scala:745)
at org.fusesource.scalate.TemplateEngine.liftedTree1$1(TemplateEngine.scala:446)
at org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:440)
at org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:495)
at org.fusesource.scalate.TemplateEngine.layout(TemplateEngine.scala:593)
at com.inspurusa.consul.apigateway.integration.NginxController.createNginxConfig(NginxController.scala:33)
at com.inspurusa.consul.apigateway.integration.NginxController.generateConfigFile(NginxController.scala:46)
at com.inspurusa.consul.apigateway.integration.ServicesControl$.delayedEndpoint$com$inspurusa$consul$apigateway$integration$ServicesControl$1(ServicesControl.scala:58)
at com.inspurusa.consul.apigateway.integration.ServicesControl$delayedInit$body.apply(ServicesControl.scala:41)
at scala.Function0.apply$mcV$sp(Function0.scala:34)
at scala.Function0.apply$mcV$sp$(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App.$anonfun$main$1$adapted(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:389)
at scala.App.main(App.scala:76)
at scala.App.main$(App.scala:74)
at com.inspurusa.consul.apigateway.integration.ServicesControl$.main(ServicesControl.scala:41)
at com.inspurusa.consul.apigateway.integration.ServicesControl.main(ServicesControl.scala)
... 8 more
Caused by: scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
at scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$4(Mirrors.scala:54)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:54)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
at scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:169)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage(Definitions.scala:169)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass$lzycompute(Definitions.scala:170)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass(Definitions.scala:170)
at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1449)
at scala.tools.nsc.Global$Run.(Global.scala:1154)
at org.fusesource.scalate.support.ScalaCompiler.compile(ScalaCompiler.scala:92)
at org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:809)
... 26 more

@roland-ewald
Copy link

The same error message appears when running code with the IntelliJ classpath option JAR manifest enabled (but it works with any other option).

@onema
Copy link

onema commented Sep 12, 2018

Any updates on this?

@LeonardMeyer
Copy link

Had a similar error with Scala 2.12.8 (Object not found), and using the 1.9.1-RC1 fixed it

@rafalmag
Copy link

rafalmag commented Jun 6, 2023

I have the same issue with Scala 2.13.10 and Scalate 1.9.8, JDK 11.0.12.
I wonder if the problem is related to classpath. Some good summary or related materials at https://stackoverflow.com/a/75651072/252363 TL;DR - maybe related to flags: "--release 8" and "-javabootclasspath" or "settings.usejavacp.value = true"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants