Earlier I tried get a simple Struts 2 application running under GAE/J
and hit a IllegalAccessError when try to set a property on the Action
POJO. Apparently, the restrictions on reflection is preventing Struts
2 from working.
On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net> wrote:
> Earlier I tried get a simple Struts 2 application running under GAE/J
> and hit a IllegalAccessError when try to set a property on the Action
> POJO. Apparently, the restrictions on reflection is preventing Struts
> 2 from working.
I am running locally using the Eclipse plugins. The first exception I get is:
WARNING: Caught OgnlException while setting property 'location' on type 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
java.lang.IllegalAccessException: Method [public void org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.Str ing)] cannot be accessed.
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
When I try to invoke an action directly I get:
SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction: Error setting expression 'name' with value '[Ljava.lang.String;@24de7d'
package com.ociweb.gaestruts2;
import com.opensymphony.xwork2.ActionSupport;
public class HelloAction extends ActionSupport {
private String name;
private String backwardsName;
public String execute() {
int nameLen = name.length();
StringBuffer sb = new StringBuffer(nameLen);
char[] nameArray = name.toCharArray();
for (int i = 0; i < nameLen; i++) {
sb.append(nameArray[nameLen - i - 1]);
}
backwardsName = sb.toString();
return SUCCESS;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String getBackwardsName() {
return backwardsName;
}
}
Earlier, I saw a message regarding an IllegalAccessException trying to invoke setName on an HelloAction object. I'm certain that is the underlying exception in the in the message above. I have the Struts 2 jar and dependencies under the /war/WEB-INF/lib directory. Please let me know if you need more info.
> Can you please post the exception? You should be able to reflect on pretty
> much any class you upload with your app.
> Thanks,
> Max
> On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net> wrote:
> > Earlier I tried get a simple Struts 2 application running under GAE/J
> > and hit a IllegalAccessError when try to set a property on the Action
> > POJO. Apparently, the restrictions on reflection is preventing Struts
> > 2 from working.
1) Try deploying your app to prod and see if you get the same exception.
There are a couple of areas where the local environment and the prod
environment do things a little bit differently.
2) Run your app locally with
--jvm_flag="-Djava.security.debug=access,failure" and send us the output.
This should make it pretty clear what check is failing.
On Wed, Apr 8, 2009 at 12:34 PM, <dalto...@charter.net> wrote:
> I am running locally using the Eclipse plugins. The first exception I
> get is:
> WARNING: Caught OgnlException while setting property 'location' on type
> 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
> java.lang.IllegalAccessException: Method [public void
> org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.Str ing)]
> cannot be accessed.
> at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
> at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
> When I try to invoke an action directly I get:
> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction: Error
> setting expression 'name' with value '[Ljava.lang.String;@24de7d'
> package com.ociweb.gaestruts2;
> import com.opensymphony.xwork2.ActionSupport;
> public class HelloAction extends ActionSupport {
> private String name;
> private String backwardsName;
> public String execute() {
> int nameLen = name.length();
> StringBuffer sb = new StringBuffer(nameLen);
> char[] nameArray = name.toCharArray();
> for (int i = 0; i < nameLen; i++) {
> sb.append(nameArray[nameLen - i - 1]);
> }
> backwardsName = sb.toString();
> return SUCCESS;
> }
> Earlier, I saw a message regarding an IllegalAccessException trying to
> invoke setName on an HelloAction object. I'm certain that is the
> underlying exception in the in the message above. I have the Struts 2
> jar and dependencies under the /war/WEB-INF/lib directory. Please let me
> know if you need more info.
> Thanks,
> Tim
> ---- Max Ross <maxr+appeng...@google.com <maxr%2Bappeng...@google.com>>
> wrote:
> > Can you please post the exception? You should be able to reflect on
> pretty
> > much any class you upload with your app.
> > Thanks,
> > Max
> > On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net> wrote:
> > > Earlier I tried get a simple Struts 2 application running under GAE/J
> > > and hit a IllegalAccessError when try to set a property on the Action
> > > POJO. Apparently, the restrictions on reflection is preventing Struts
> > > 2 from working.
> 1) Try deploying your app to prod and see if you get the same exception.
> There are a couple of areas where the local environment and the prod
> environment do things a little bit differently.
> 2) Run your app locally with
> --jvm_flag="-Djava.security.debug=access,failure" and send us the output.
> This should make it pretty clear what check is failing.
> Thanks,
> Max
> On Wed, Apr 8, 2009 at 12:34 PM, <dalto...@charter.net> wrote:
> > I am running locally using the Eclipse plugins. The first exception I
> > get is:
> > WARNING: Caught OgnlException while setting property 'location' on type
> > 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
> > java.lang.IllegalAccessException: Method [public void
> > org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.Str ing)]
> > cannot be accessed.
> > at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
> > at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
> > When I try to invoke an action directly I get:
> > SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> > caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction: Error
> > setting expression 'name' with value '[Ljava.lang.String;@24de7d'
> > package com.ociweb.gaestruts2;
> > import com.opensymphony.xwork2.ActionSupport;
> > public class HelloAction extends ActionSupport {
> > private String name;
> > private String backwardsName;
> > public String execute() {
> > int nameLen = name.length();
> > StringBuffer sb = new StringBuffer(nameLen);
> > char[] nameArray = name.toCharArray();
> > for (int i = 0; i < nameLen; i++) {
> > sb.append(nameArray[nameLen - i - 1]);
> > }
> > backwardsName = sb.toString();
> > return SUCCESS;
> > }
> > Earlier, I saw a message regarding an IllegalAccessException trying to
> > invoke setName on an HelloAction object. I'm certain that is the
> > underlying exception in the in the message above. I have the Struts 2
> > jar and dependencies under the /war/WEB-INF/lib directory. Please let me
> > know if you need more info.
> > Thanks,
> > Tim
> > ---- Max Ross <maxr+appeng...@google.com <maxr%2Bappeng...@google.com>>
> > wrote:
> > > Can you please post the exception? You should be able to reflect on
> > pretty
> > > much any class you upload with your app.
> > > Thanks,
> > > Max
> > > On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net> wrote:
> > > > Earlier I tried get a simple Struts 2 application running under GAE/J
> > > > and hit a IllegalAccessError when try to set a property on the Action
> > > > POJO. Apparently, the restrictions on reflection is preventing Struts
> > > > 2 from working.
The issue seems to be that Ognl expects OgnlInvokePermission to be granted,
and since it isn't, the reflection call fails (Ognl checs for this perm
before every reflection call it makes). Let me see if we can find a
workaround for you.
On Wed, Apr 8, 2009 at 12:34 PM, <dalto...@charter.net> wrote:
> I am running locally using the Eclipse plugins. The first exception I
> get is:
> WARNING: Caught OgnlException while setting property 'location' on type
> 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
> java.lang.IllegalAccessException: Method [public void
> org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.Str ing)]
> cannot be accessed.
> at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
> at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
> When I try to invoke an action directly I get:
> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction: Error
> setting expression 'name' with value '[Ljava.lang.String;@24de7d'
> package com.ociweb.gaestruts2;
> import com.opensymphony.xwork2.ActionSupport;
> public class HelloAction extends ActionSupport {
> private String name;
> private String backwardsName;
> public String execute() {
> int nameLen = name.length();
> StringBuffer sb = new StringBuffer(nameLen);
> char[] nameArray = name.toCharArray();
> for (int i = 0; i < nameLen; i++) {
> sb.append(nameArray[nameLen - i - 1]);
> }
> backwardsName = sb.toString();
> return SUCCESS;
> }
> Earlier, I saw a message regarding an IllegalAccessException trying to
> invoke setName on an HelloAction object. I'm certain that is the
> underlying exception in the in the message above. I have the Struts 2
> jar and dependencies under the /war/WEB-INF/lib directory. Please let me
> know if you need more info.
> Thanks,
> Tim
> ---- Max Ross <maxr+appeng...@google.com <maxr%2Bappeng...@google.com>>
> wrote:
> > Can you please post the exception? You should be able to reflect on
> pretty
> > much any class you upload with your app.
> > Thanks,
> > Max
> > On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net> wrote:
> > > Earlier I tried get a simple Struts 2 application running under GAE/J
> > > and hit a IllegalAccessError when try to set a property on the Action
> > > POJO. Apparently, the restrictions on reflection is preventing Struts
> > > 2 from working.
It involves creating a servlet context listener that invokes OgnlRuntime.setSecurityManager(null). I've incorporating such changes and have deployed to gaestruts2.appspot.com.
Code snippet for Listener:
package com.ociweb.gaestruts2;
// imports
public class InitListener implements ServletContextListener, HttpSessionListener, HttpSessionAttributeListener {
public InitListener() {
}
public void contextInitialized(ServletContextEvent sce) {
OgnlRuntime.setSecurityManager(null);
}
// ... all other methods stubbed out to do nothing
Max Ross wrote:
> The issue seems to be that Ognl expects OgnlInvokePermission to be granted, and since it isn't, the reflection call fails (Ognl checs for this perm before every reflection call it makes). Let me see if we can find a workaround for you.
> Max
> On Wed, Apr 8, 2009 at 12:34 PM, <dalto...@charter.net> wrote:
> I am running locally using the Eclipse plugins. The first exception I
> get is:
> WARNING: Caught OgnlException while setting property 'location' on type
> 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
> java.lang.IllegalAccessException: Method [public void
> org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.Str ing)]
> cannot be accessed.
> at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
> at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
> When I try to invoke an action directly I get:
> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction: Error
> setting expression 'name' with value '[Ljava.lang.String;@24de7d'
> package com.ociweb.gaestruts2;
> import com.opensymphony.xwork2.ActionSupport;
> public class HelloAction extends ActionSupport {
> private String name;
> private String backwardsName;
> public String execute() {
> int nameLen = name.length();
> StringBuffer sb = new StringBuffer(nameLen);
> char[] nameArray = name.toCharArray();
> for (int i = 0; i < nameLen; i++) {
> sb.append(nameArray[nameLen - i - 1]);
> }
> backwardsName = sb.toString();
> return SUCCESS;
> }
> Earlier, I saw a message regarding an IllegalAccessException trying to
> invoke setName on an HelloAction object. I'm certain that is the
> underlying exception in the in the message above. I have the Struts 2
> jar and dependencies under the /war/WEB-INF/lib directory. Please let me
> know if you need more info.
> Thanks,
> Tim
> ---- Max Ross <maxr+appeng...@google.com> wrote:
> > Can you please post the exception? You should be able to reflect on pretty
> > much any class you upload with your app.
> > Thanks,
> > Max
> > On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net> wrote:
> > > Earlier I tried get a simple Struts 2 application running under GAE/J
> > > and hit a IllegalAccessError when try to set a property on the Action
> > > POJO. Apparently, the restrictions on reflection is preventing Struts
> > > 2 from working.
> It involves creating a servlet context listener that invokes
> OgnlRuntime.setSecurityManager(null). I've incorporating such changes and
> have deployed to gaestruts2.appspot.com.
> Code snippet for Listener:
> package com.ociweb.gaestruts2;
> // imports
> public class InitListener implements ServletContextListener,
> HttpSessionListener, HttpSessionAttributeListener {
> public InitListener() {
> }
> public void contextInitialized(ServletContextEvent sce) {
> OgnlRuntime.setSecurityManager(null);
> }
> // ... all other methods stubbed out to do nothing
> }
> Max Ross wrote:
> > The issue seems to be that Ognl expects OgnlInvokePermission to be
> granted, and since it isn't, the reflection call fails (Ognl checs for this
> perm before every reflection call it makes). Let me see if we can find a
> workaround for you.
> > Max
> > On Wed, Apr 8, 2009 at 12:34 PM, <dalto...@charter.net> wrote:
> > I am running locally using the Eclipse plugins. The first exception I
> > get is:
> > WARNING: Caught OgnlException while setting property 'location' on
> type
> > 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
> > java.lang.IllegalAccessException: Method [public void
> org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.Str ing)]
> > cannot be accessed.
> > at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
> > at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
> > When I try to invoke an action directly I get:
> > SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> > caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction:
> Error
> > setting expression 'name' with value '[Ljava.lang.String;@24de7d'
> > package com.ociweb.gaestruts2;
> > import com.opensymphony.xwork2.ActionSupport;
> > public class HelloAction extends ActionSupport {
> > private String name;
> > private String backwardsName;
> > public String execute() {
> > int nameLen = name.length();
> > StringBuffer sb = new StringBuffer(nameLen);
> > char[] nameArray = name.toCharArray();
> > for (int i = 0; i < nameLen; i++) {
> > sb.append(nameArray[nameLen - i - 1]);
> > }
> > backwardsName = sb.toString();
> > return SUCCESS;
> > }
> > Earlier, I saw a message regarding an IllegalAccessException trying
> to
> > invoke setName on an HelloAction object. I'm certain that is the
> > underlying exception in the in the message above. I have the Struts 2
> > jar and dependencies under the /war/WEB-INF/lib directory. Please let
> me
> > know if you need more info.
> > Thanks,
> > Tim
> > ---- Max Ross <maxr+appeng...@google.com<maxr%2Bappeng...@google.com>>
> wrote:
> > > Can you please post the exception? You should be able to reflect
> on pretty
> > > much any class you upload with your app.
> > > Thanks,
> > > Max
> > > On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net>
> wrote:
> > > > Earlier I tried get a simple Struts 2 application running under
> GAE/J
> > > > and hit a IllegalAccessError when try to set a property on the
> Action
> > > > POJO. Apparently, the restrictions on reflection is preventing
> Struts
> > > > 2 from working.
> It involves creating a servlet context listener that invokes OgnlRuntime.setSecurityManager(null). I've incorporating such changes and have deployed to gaestruts2.appspot.com.
> Code snippet for Listener:
> package com.ociweb.gaestruts2;
> // imports
> public class InitListener implements ServletContextListener, HttpSessionListener, HttpSessionAttributeListener {
> public InitListener() {
> }
> public void contextInitialized(ServletContextEvent sce) {
> OgnlRuntime.setSecurityManager(null);
> }
> // ... all other methods stubbed out to do nothing
> Max Ross wrote:
> > The issue seems to be that Ognl expects OgnlInvokePermission to be granted, and since it isn't, the reflection call fails (Ognl checs for this perm before every reflection call it makes). Let me see if we can find a workaround for you.
> > Max
> > On Wed, Apr 8, 2009 at 12:34 PM, <dalto...@charter.net> wrote:
> > I am running locally using the Eclipse plugins. The first exception I
> > get is:
> > WARNING: Caught OgnlException while setting property 'location' on type
> > 'org.apache.struts2.dispatcher.ServletDispatcherResult'.
> > java.lang.IllegalAccessException: Method [public void
> > org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.Str ing)]
> > cannot be accessed.
> > at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
> > at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
> > When I try to invoke an action directly I get:
> > SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> > caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction: Error
> > setting expression 'name' with value '[Ljava.lang.String;@24de7d'
> > package com.ociweb.gaestruts2;
> > import com.opensymphony.xwork2.ActionSupport;
> > public class HelloAction extends ActionSupport {
> > private String name;
> > private String backwardsName;
> > public String execute() {
> > int nameLen = name.length();
> > StringBuffer sb = new StringBuffer(nameLen);
> > char[] nameArray = name.toCharArray();
> > for (int i = 0; i < nameLen; i++) {
> > sb.append(nameArray[nameLen - i - 1]);
> > }
> > backwardsName = sb.toString();
> > return SUCCESS;
> > }
> > Earlier, I saw a message regarding an IllegalAccessException trying to
> > invoke setName on an HelloAction object. I'm certain that is the
> > underlying exception in the in the message above. I have the Struts 2
> > jar and dependencies under the /war/WEB-INF/lib directory. Please let me
> > know if you need more info.
> > Thanks,
> > Tim
> > ---- Max Ross <maxr+appeng...@google.com> wrote:
> > > Can you please post the exception? You should be able to reflect on pretty
> > > much any class you upload with your app.
> > > Thanks,
> > > Max
> > > On Wed, Apr 8, 2009 at 11:13 AM, TimDalton <dalto...@charter.net> wrote:
> > > > Earlier I tried get a simple Struts 2 application running under GAE/J
> > > > and hit a IllegalAccessError when try to set a property on the Action
> > > > POJO. Apparently, the restrictions on reflection is preventing Struts
> > > > 2 from working.- Hide quoted text -