#387 ✓ duplicate
Matthew Lloyd

Incompatibility with ANTLR parsers

Reported by Matthew Lloyd | November 6th, 2010 @ 03:19 AM | in 1.3

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

Framework version: 1.1
Platform you're using: Windows x64

Reproduction steps:

Details:

The PropertiesEnhancer is throwing the exception below when my code executes an ANTLR v3 generated parser. The GrammarParser is accessing a public field 'index' which is declared in its superclass Parser (part of the ANTLR runtime).

Internal Server Error (500) for request GET /

Execution exception (In /app/parsers/GrammarParser.java around line 2942)
NoSuchMethodException occured : parsers.GrammarParser.getInput()

play.exceptions.JavaExecutionException: parsers.GrammarParser.getInput()

    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:285)
    at Invocation.HTTP Request(Play!)

Caused by: java.lang.NoSuchMethodException: parsers.GrammarParser.getInput()

    at java.lang.Class.getMethod(Unknown Source)
    at play.classloading.enhancers.PropertiesEnhancer$FieldAccessor.invokeRe

adProperty(PropertiesEnhancer.java:181)

    at parsers.GrammarParser.shortcut_file(GrammarParser.java:2942)
    at users.ShortcutFile.load(ShortcutFile.java:31)
    at users.User.runCommand(User.java:118)
    at controllers.Application.index(Application.java:28)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:408)

    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:403)

    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:176)
    ... 1 more

Comments and changes to this ticket

  • opensource21
  • Matthew Lloyd

    Matthew Lloyd November 6th, 2010 @ 06:50 PM

    Thanks - looks like that bug has already been fixed. I'll try out the latest nightly build and see whether this bug is also fixed.

  • Matthew Lloyd

    Matthew Lloyd November 6th, 2010 @ 07:22 PM

    I'm still seeing this issue with the latest nightly build, 1.1RC2-111-gcf79c21. I wish there was a way to configure the PropertiesEnhancer to restrict its activities to specific packages or classes; it's a serious performance concern for my app that every public field reference in my entire application will go through an extra level of indirection.

  • Morten Kjetland

    Morten Kjetland June 8th, 2011 @ 10:29 PM

    Is this still a problem?

  • Nicolas Leroux

    Nicolas Leroux October 28th, 2011 @ 08:32 PM

    • Assigned user set to “Nicolas Leroux”
    • State changed from “new” to “duplicate”
    • Milestone set to 1.3
    • Milestone order changed from “217” to “0”

    I guess not. Reopen the bug if there is still an issue.

  • cifey

    cifey December 3rd, 2011 @ 05:50 AM

    I'm getting the same error with play 1.2.4,
    seems to be a different code path from the duplicate

    1. added antlr-3-2.jar to the ./lib/directory
    2. antlr generated a parser.java and put it into the app codebase.

    The problem seems like this:
    The child class in the app IS using the play class loader and thinks it should have a getInput() method.

    The parent class comes from the antlr-3-2.jar and does NOT use the play class loader.
    org.antlr.runtime.Parser classloader = sun.misc.Launcher$AppClassLoader@3093dee9

    see

    PropertiesEnhancer.java FieldAccessor {
    
    if (o.getClass().getClassLoader() == null || !o.getClass().getClassLoader().equals(Play.classloader)) 
    {
     return o.getClass().getField(property).get(o);  // should get into here but doesn't
    }
    

    ========

    =========== java.lang.NoSuchMethodException: com.prosrm.aware.antlrgenerated.RuleExpressionP
    arser.getInput()

        at java.lang.Class.getMethod(Class.java:1605)
        at play.classloading.enhancers.PropertiesEnhancer$FieldAccessor.invokeRe
    

    adProperty(PropertiesEnhancer.java:212)

        at com.prosrm.aware.antlrgenerated.RuleExpressionParser.root(RuleExpress
    

    ionParser.java:120)

    ....

    /**/
    public class Parser extends org.antlr.runtime.BaseRecognizer {
        public org.antlr.runtime.TokenStream input;
    
    ....
        public final RuleExpressionParser.root_return root() throws RecognitionException {
            RuleExpressionParser.root_return retval = new RuleExpressionParser.root_return();
            retval.start = input.LT(1);
    /**/
    

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 »

Play framework

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 http://www.playframework.org website.

Source code is hosted on github

Check out our repository at http://github.com/playframework/play

Contributing, creating a patch

Please read the contributor guide

Reporting Security Vulnerabilities

Since all bug reports are public, please report any security vulnerability directly to guillaume dot bort at gmail dot com.

Creating a bug report

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.

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

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.

Shared Ticket Bins

Pages