#1908 ✓resolved
Emily Crutcher

@OnApplicationStart fails if you disable the JPAPlugin

Reported by Emily Crutcher | January 19th, 2015 @ 03:34 PM | in 1.3.1 (closed)

You can reproduce the problem by adding the following to any application.conf

I have a sample project showing it as well, but the zip got rejected by the issue tra

Comments and changes to this ticket

  • Guylian Pot

    Guylian Pot January 20th, 2015 @ 09:28 AM

    Can confirm this. Also confirmed that it seems to be something specific to the JPAPlugin, disabling the DBPlugin works fine.

  • Guylian Pot

    Guylian Pot January 20th, 2015 @ 01:28 PM

    Interesting: if I add plugins.disable=play.db.Evolutions, everything works fine again. So there probably is some uncaught error in the Evolutions plugin - with regards to the absence of the JPAPlugin - that doesn't even show up in TRACE, but does prevent the JobsPlugin from doing its job.

    Some more nosing around reveals EvolutionQuery.java to have a direct dependency on JPAPlugin. However, why it would break anything without throwing errors or raising exceptions I don't know.

  • R.Rettig

    R.Rettig February 17th, 2015 @ 03:30 AM

    Any application.conf? I cannot reproduce it on yabe sample app.

    ./play run samples-and-tests/yabe


    ~ play! 1.3.x-1.3.0RC1-39-g78ce6f4, http://www.playframework.com Listening for transport dt_socket at address: 8000
    04:21:20,949 INFO ~ Starting /home/rrettig/git/play1/samples-and-tests/yabe
    :: loading settings :: url = jar:file:/home/rrettig/git/play1/framework/lib/ivy-2.3.0.jar!/org/apache/ivy/core/settings/ivysettings.xml 04:21:21,341 INFO ~ Module crud is available (/home/rrettig/git/play1/modules/crud)
    04:21:21,341 INFO ~ Module secure is available (/home/rrettig/git/play1/modules/secure)
    04:21:22,028 WARN ~ You're running Play! in DEV mode
    04:21:22,118 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...

    ~ Server is up and running

    04:21:31,654 INFO ~ Plugin disabled: class play.db.jpa.JPAPlugin
    04:21:33,017 INFO ~ Connected to jdbc:h2:mem:play;MODE=MYSQL for default
    04:21:33,024 INFO ~ Application 'Yet Another Blog Engine' is now started !


    ./play status samples-and-tests/yabe


    Play framework:

    Version: 1.3.x-1.3.0RC1-39-g78ce6f4
    Path: /home/rrettig/git/play1
    ID: (not set)
    Mode: DEV
    Tmp dir: /home/rrettig/git/play1/samples-and-tests/yabe/tmp


    Path: /home/rrettig/git/play1/samples-and-tests/yabe
    Name: Yet Another Blog Engine
    Started at: 02/17/2015 04:21

    Jobs execution pool:

    Pool size: 0
    Active count: 0
    Scheduled task count: 0
    Queue size: 0

    Scheduled jobs (1):

    Bootstrap run at application start. (last run at 02/17/2015 04:21:33)

  • Guylian Pot

    Guylian Pot February 17th, 2015 @ 09:32 AM

    I just checked, getting the status for one where it goes wrong still comes up in the status output as if it ran. However, add something like logging to your bootstrap job and you'll notice that it doesn't show up.

    I made a test case here: https://github.com/gpgekko/PlayJobTest. Run it without any ID, and you'll see an output of the application configuration including a build.number entry that gets read from a file during application startup. Now run it with id --%broken and you'll notice the entry isn't there. Now run it with id --%works and it is there again. In the configuration you'll find the cases as I described them in my previous comment.

  • R.Rettig

    R.Rettig February 17th, 2015 @ 11:50 AM

    • Assigned user set to “Alex”
  • R.Rettig

    R.Rettig February 17th, 2015 @ 12:20 PM

    For some reason I reverted the previous commit. Here is the PR

    Please think about the filter construct in general. Why the 'play.libs.F.Function0.apply()' method executes 'play.Invoker.Invocation.execute()' through the JPA/JPAPlugin?
    Has the JPA/JPAPlugin such knowledge/priority to make a decision of when to execute the InvocationContext? I think not! For now it just works but I personally think this is a design problem.

    See the call hierachy:

    • apply() : R - play.libs.F.Function0
      • withinFilter(Function0) : T - play.db.jpa.JPA
      • withinFilter(Function0) : Object - play.db.jpa.JPAPlugin.TransactionalFilter
        • withinFilter(Function0) : V - play.jobs.Job
        • withinFilter(Function0) : void - play.Invoker.Invocation
        • run() : void - play.Invoker.Invocation
      • withTransaction(String, boolean, Function0) : T - play.db.jpa.JPA (2 matches)
      • withinFilter(Function0) : T - play.db.jpa.JPA
        • withinFilter(Function0) : Object - play.db.jpa.JPAPlugin.TransactionalFilter ..

    As an example consider a database migration plugin like play.db.Evolutions or might be a better one like liquibase based database migration plugin. Through play.plugins priority system such a plugin which is located after JPAPlugin has no control over execution. Such Plugins need JPAPlugin but for necessary administration tasks or database migrations such plugins dont want that JPA executes the context yet.


  • Play Duck

    Play Duck February 25th, 2015 @ 01:19 AM

    (from [df7f5c4fabce1bec201f6e93ccacff97af1c08ce]) [#1908] fixes: @OnApplicationStart fails if you disable the JPAPlugin

    framework/src/play/Invoker.java https://github.com/playframework/play1/commit/df7f5c4fabce1bec201f6...

  • Play Duck

    Play Duck February 25th, 2015 @ 01:19 AM

    (from [f675a3514d70afb4bfe46a152d4ad2df676a7302]) Merge pull request #849 from flybyray/lighthouse-1908-patch

    [#1908] fixes: @OnApplicationStart fails if you disable the JPAPlugin https://github.com/playframework/play1/commit/f675a3514d70afb4bfe46...

  • Alex

    Alex February 25th, 2015 @ 01:29 AM

    • Tag set to plugin
    • Milestone set to 1.3.1

    @Guylian Pot, which version of play did you used?

  • Guylian Pot
  • Alex

    Alex February 25th, 2015 @ 12:51 PM

    Ok thanks, So that means there is another issue, the PR was not enough.
    I will check with your example

  • Play Duck

    Play Duck March 3rd, 2015 @ 06:19 AM

    (from [6b850281e34fa1b710358db513bd6af11ad32c71]) [#1908] fix(job): @OnApplicationStart fails if no plugin with filter found (ex JPAPlugin disabled) https://github.com/playframework/play1/commit/6b850281e34fa1b710358...

  • Play Duck

    Play Duck March 3rd, 2015 @ 06:19 AM

    (from [d2adc286c459e9c85a30d50a821f077dec853813]) Merge pull request #852 from xael-fry/1908_applicationStartFails

    [#1908] fix(job): @OnApplicationStart fails if no plugin with filter found (ex JPAPlugin disabled) https://github.com/playframework/play1/commit/d2adc286c459e9c85a30d...

  • Alex

    Alex March 3rd, 2015 @ 06:20 AM

    • State changed from “new” to “resolved”

    Pull request 852 Merged in 1.3.x.


Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2>Play framework</h2>

Play makes it easier to build Web applications with Java. It is a clean alternative to bloated Enterprise Java stacks. It focuses on developer productivity and targets RESTful architectures. Learn more on the <a href="http://www.playframework.org">http://www.playframework.org</a> website.<br><br>

<h2>Source code is hosted on github</h2>Check out our repository at <a href="http://github.com/playframework/play">http://github.com/playframework/play</a><br><br>

<h2>Contributing, creating a patch</h2> Please read the <a href="http://play.lighthouseapp.com/projects/57987/contributor-guide">contributor guide</a><br><br>

<h2>Reporting Security Vulnerabilities</h2> Since all bug reports are public, please report any security vulnerability directly to <em>guillaume dot bort at gmail dot com</em>.<br><br>

<h2>Creating a bug report</h2> Bug reports are incredibly helpful, so take time to report bugs and request features in our ticket tracker. We’re always grateful for patches to Play’s code. Indeed, bug reports with attached patches will get fixed far quickly than those without any.<br><br>

Please include as much relevant information as possible including the exact framework version you're using and a code snippet that reproduces the problem.<br><br>

Don't have too much expectations. Unless the bug is really a serious "everything is broken" thing, you're creating a ticket to start a discussion. Having a patch (or a branch on Github we can pull from) is better, but then again we'll only pull high quality branches that make sense to be in the core of Play.