[Play 2.4 java] There is no started application

2,030 views
Skip to first unread message

Paul Fauchon

unread,
Jun 11, 2015, 10:03:58 AM6/11/15
to play-fr...@googlegroups.com

Hi, 

I'm trying to set up some file path based on the Play.application().path() in a controller like following:

private final String PNG_PATH = "cache/windowsTiles/";
private final String FULL_PNG_PATH = Play.application().path().getPath() + "/" + PNG_PATH;


but i'm having the following error:

play.api.UnexpectedException: Unexpected exception[ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.RuntimeException: There is no started application
at controllers
.WindowsTiles.<init>(WindowsTiles.java:31)
while locating controllers.WindowsTiles
for parameter 2 at router.Routes.<init>(Routes.scala:60)
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:197)
while locating play.api.http.JavaCompatibleHttpRequestHandler
while locating play.api.http.HttpRequestHandler
for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:240)
at play
.api.DefaultApplication.class(Application.scala:240)
while locating play.api.DefaultApplication
while locating play.api.Application


It was working in Play 2.3.


Anyone got an idea of how I can instantiate a bunch of constants after the application has started ?


 To be honest I'm having a hard time making the transition to 2.4 and the dependency injection system even though I read the documentation, it's really not clear for me.


Regards,

Paul.

Igmar Palsenberg

unread,
Jun 14, 2015, 6:41:52 AM6/14/15
to play-fr...@googlegroups.com

 
I'm trying to set up some file path based on the Play.application().path() in a controller like following:

private final String PNG_PATH = "cache/windowsTiles/";
private final String FULL_PNG_PATH = Play.application().path().getPath() + "/" + PNG_PATH;

@Inject Configuration, and use that. In general, avoid using Play.* at all.



Igmar

Paul Fauchon

unread,
Jun 18, 2015, 10:44:36 AM6/18/15
to play-fr...@googlegroups.com
That was it, thank you very much !
Reply all
Reply to author
Forward
0 new messages