#1153 new
Cheong Chung Onn


Reported by Cheong Chung Onn | October 8th, 2011 @ 08:44 AM

I am getting IllegalAccessError, the cause seems to point to all anonymous inner class. When I replaced the anonymous inner class with a public static class the problem goes away. Also when I create a plain vanilla app with an anonymous inner class and it works. Application is ran in Test mode. However if app is in Prod mode, the IllegalAccessError does not appear even though there is anonymous inner class.

I thought I had the problem only with 1.2.3 but it seems to happen now with 1.2.2. My app was previously running. Any idea? Below is the output of the error message.

Framework version:
Platform you're using: OSX 10.7.1, Java 6, Play 1.2.2, Play 1.2.3

Internal Server Error (500) for request GET /voyager/tng/sunbeam/admin/sbrolemgmt

Execution exception (In {module:rbac}/app/models/rbac/Space.java around line 340)
IllegalAccessError occured : tried to access class models.rbac.Space$1 from class models.rbac.Space

play.exceptions.JavaExecutionException: tried to access class models.rbac.Space$1 from class models.rbac.Space

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

Caused by: java.lang.IllegalAccessError: tried to access class models.rbac.Space$1 from class models.rbac.Space

    at models.rbac.Space.sortSpacesWithPartition(Space.java:340)
    at models.rbac.Space.findSortedPossilbeParentSpaces(Space.java:647)
    at controllers.SbAdminWorkbench.sbRoleMgmt(SbAdminWorkbench.java:300)
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:543)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:499)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:475)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:470)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:158)
    ... 1 more

^C~ ... Running in Play test mode

Comments and changes to this ticket

  • Cheong Chung Onn

    Cheong Chung Onn October 8th, 2011 @ 12:27 PM

    I confirmed the problem is not caused by anonymous class. I have convert the anonymous inner class to a static inner class and it still have problem (see below) however when after it is declared as a public static inner class it worked again.

    Is this caused by some Play's enhanced class thingy?

    IllegalAccessError occured : tried to access class models.rbac.Space$SpaceComparator from class models.rbac.Space

  • Cheong Chung Onn

    Cheong Chung Onn October 9th, 2011 @ 02:33 AM

    I found a workaround for this. Set play.bytecodeCache=false in application.conf

  • Cheong Chung Onn

    Cheong Chung Onn October 9th, 2011 @ 09:23 AM

    The workaround didn't seems to work. :(

    Any tips on how I could disable the bytecode manipulation?

  • Cheong Chung Onn

    Cheong Chung Onn October 9th, 2011 @ 03:05 PM

    I have made the following observations. I made the above class as a top level class with package access modifier and I still encounter the problem - IllegalAccessError. Next I set the logger to trace level and I found the above class is already being compiled before the message "Listening for HTTP on port 9000 (Waiting a first request to start) ...". And when I start continue the app, the class is being being enhanced.

    I forgot to mentioned earlier that the above class is in a separate PluginModule. I managed to trace that ApplicationClassLoader#loadApplicationClass is the method that throws the IllegalAccessError when a new instance of the SpaceComparator is to be created.

  • Richard Wise

    Richard Wise November 11th, 2011 @ 11:55 AM

    I have recently encountered this problem with Play 1.2.4-RC2 under Ubuntu x64 11.04. Unfortunately, it is not reproducable - restarting play caused the error to go away. My code uses an anonymous inner class that accessed a local method variable, which normally works fine. I am concerned about the reliability of the play framework for use in production environments when there appears to be differences in each execution.

  • Lowery Lee

    Lowery Lee September 29th, 2017 @ 05:10 AM

    Java is the famous programming language and pretty close to human language. As a java programmer all time we face such problems with coding and need the solution of problems. Here on essay writing services website, I found pretty helpful material thank for sharing.

  • Jacky8888

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.