Search code examples
javamultithreadingstruts2ognl

Access to static variable is blocked


In my Struts2 application, which involves some multi-threading, I get the following warning in my logs:

Access to static [private static final java.lang.String ...] is blocked!

What does this warning mean and how can I avoid it?


Solution

  • Static access is disabled by default. Here you can learn more about static accessors.

    OGNL allows execution of methods, but the static access is disabled by default, so you cannot use static method in expressions. However, you can teach OGNL which classes needs to access the static methods.