Closed svenwiegand closed 8 years ago
:+1:
Below is stack-trace for issue, anybody can solve it and pull request or give me the way to solve it?
I'm java not scala tho.
play.api.UnexpectedException: Unexpected exception[ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.AbstractMethodError: com.github.mmizutani.playgulp.Gulp.play$api$mvc$Results$_setter_$TooManyRequests_$eq(Lplay/api/mvc/Results$Status;)V
at com.github.mmizutani.playgulp.Gulp.<init>(Gulp.scala:44)
while locating com.github.mmizutani.playgulp.Gulp
for parameter 1 at router.Routes.<init>(Routes.scala:72)
while locating router.Routes
while locating play.api.inject.RoutesProvider
while locating play.api.routing.Router
for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:200)
while locating play.api.http.JavaCompatibleHttpRequestHandler
while locating play.api.http.HttpRequestHandler
for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:220)
at play.api.DefaultApplication.class(Application.scala:220)
while locating play.api.DefaultApplication
while locating play.api.Application
for parameter 0 at play.DefaultApplication.<init>(DefaultApplication.java:30)
at play.DefaultApplication.class(DefaultApplication.java:30)
while locating play.DefaultApplication
while locating play.Application
1 error]
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:170)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:126)
at scala.Option.map(Option.scala:146)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:126)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:124)
at scala.util.Success.flatMap(Try.scala:231)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:124)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:116)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.AbstractMethodError: com.github.mmizutani.playgulp.Gulp.play$api$mvc$Results$_setter_$TooManyRequests_$eq(Lplay/api/mvc/Results$Status;)V
at com.github.mmizutani.playgulp.Gulp.<init>(Gulp.scala:44)
while locating com.github.mmizutani.playgulp.Gulp
for parameter 1 at router.Routes.<init>(Routes.scala:72)
while locating router.Routes
while locating play.api.inject.RoutesProvider
while locating play.api.routing.Router
for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:200)
while locating play.api.http.JavaCompatibleHttpRequestHandler
while locating play.api.http.HttpRequestHandler
for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:220)
at play.api.DefaultApplication.class(Application.scala:220)
while locating play.api.DefaultApplication
while locating play.api.Application
for parameter 0 at play.DefaultApplication.<init>(DefaultApplication.java:30)
at play.DefaultApplication.class(DefaultApplication.java:30)
while locating play.DefaultApplication
while locating play.Application
1 error
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405)
at play.inject.DelegateInjector.instanceOf(DelegateInjector.java:22)
at play.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.java:127)
at play.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.java:34)
at play.api.ApplicationLoader$JavaApplicationLoaderAdapter$1.load(ApplicationLoader.scala:67)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:158)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1$$anonfun$2.apply(DevServerStart.scala:155)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:155)
... 14 common frames omitted
Caused by: java.lang.AbstractMethodError: com.github.mmizutani.playgulp.Gulp.play$api$mvc$Results$_setter_$TooManyRequests_$eq(Lplay/api/mvc/Results$Status;)V
at play.api.mvc.Results$class.$init$(Results.scala:605)
at com.github.mmizutani.playgulp.Gulp.<init>(Gulp.scala:44)
at com.github.mmizutani.playgulp.Gulp$$FastClassByGuice$$64f5951a.newInstance(<generated>)
at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405)
at play.api.inject.RoutesProvider$$anonfun$2.apply(BuiltinModule.scala:82)
at play.api.inject.RoutesProvider$$anonfun$2.apply(BuiltinModule.scala:82)
at scala.Option.fold(Option.scala:158)
at play.api.inject.RoutesProvider.get$lzycompute(BuiltinModule.scala:82)
at play.api.inject.RoutesProvider.get(BuiltinModule.scala:78)
at play.api.inject.RoutesProvider.get(BuiltinModule.scala:77)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
... 24 common frames omitted
There is a problem for upgrading this plugin for Play 2.5. If you are hurry, mimic this non-plugin version https://github.com/mmizutani/play-gulp-standalone in stead of using this plugin. Copy two files
This plugin is consists of an sbt plugin and a tiny Play subproject. Since sbt and sbt plugins are built based on Scala 2.10, the Play subproject of this plugin has been cross compiled for Scala 2.10 and 2.11 up to date. The problem is that Play 2.5 has dropped support for Scala 2.10, this building method is no longer possible. I have been trying to port this plugin to a Play module.
Cool, u'll try that if you sure it will work, but any estimation about when this issue will be fixed?
And what about the another warning in another issue that i opened?
What about replacement for those routes, I spend really bad times trying your suggested solution, specially I'm Java not Scala developer, and Scala make no sense for me to understand how things working inside :
routes:
GET /ui com.github.mmizutani.playgulp.Gulp.index
GET /ui/view/*any controllers.Application.redirectToUI(any)
GET /ui/view com.github.mmizutani.playgulp.Gulp.redirectRoot(base="/ui/")
-> /ui/ gulp.Routes
GET / com.github.mmizutani.playgulp.Gulp.redirectRoot(base="/ui/")
In my Application :
public Action<AnyContent> redirectToUI(String any) {
return com.github.mmizutani.playgulp.Gulp.at("index.html");
}
OK finally I make my things working:
in routes I made the following:
# Home page
GET /ui controllers.GulpAssets.index
GET /ui/view/*any controllers.Application.redirectToUI(any)
GET /ui/view controllers.GulpAssets.redirectRoot(base="/ui/")
# The following 2 lines is a replace for: "-> /ui/ gulp.Routes"
GET /ui/ controllers.GulpAssets.index
GET /ui/*file controllers.GulpAssets.at(file)
GET / controllers.GulpAssets.redirectRoot(base="/ui/")
In The GulpAssets I added this :
def redirectRoot(base: String = "/ui/") = Action {
request =>
if (base.endsWith("/")) {
Redirect(base)
} else {
Redirect(base + "/")
}
}
In my Application.java controller:
private GulpAssets gulpAssets;
@Inject
public Application(GulpAssets gulpAssets) {
this.gulpAssets = gulpAssets;
}
public Action<AnyContent> redirectToUI(String any) {
return gulpAssets.at("index.html");
}
In build.sbt :
first line : import PlayGulp._
then add .settings(playGulpSettings)
:
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean).settings(playGulpSettings)
This is workaround using stand-alone files for my exist project, well, for me seems i'll keep them for current project, but I hope in next project rest of issues will be solved for this plugin.
P.S: anybody going to to upgrade from 2.4 to 2.5 you need a lot of migrations.
Thanks.
@mmizutani just want to say that play-grunt got update : https://github.com/tuplejump/play-yeoman
Please use the version 0.1.1, which now supports Play 2.5.
@svenwiegand
Gulp does not necessarily write things out to ui/dist
directory. If the Gulp task of your frontend project places build output into, say, ui/build
directory, you can tell SBT to use this directory by overriding the unmanagedResourceDirectories
SettingKey in build.sbt
:
import PlayGulpPlugin._
import PlayGulpKeys._
...
unmanagedResourceDirectories in Assets <+= (gulpDirectory in Compile)(base => base / "build")
@mmizutani: Okay, thanks for the hint.
At first: Many thanks for providing this great plug-in. After fiddling around for hours with half working sbt-web plug-ins it was a joy to use gulp and get back the full configuration capabilities for all the asset processing steps.
The only drawback was, that I needed to downgrade my project to play 2.4 as the plugin does not work for play 2.5.
Tip: A hint in the documentation that the gulp script must write the results to the
ui/dist
directory would have been useful.