google-code-export / struts2-conversation

Automatically exported from code.google.com/p/struts2-conversation
2 stars 4 forks source link

Simple Example failed #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set up and deploy this example:
http://struts2-conversation.googlecode.com/svn/trunk/examples/simple-conversatio
n-support-example/

2. After deploy: access .../registration/begin.action 

3. Click submit button on the screen

What is the expected output? What do you see instead?
Expect contact.action screen displayed with no errors.  But got stacktrace:

Messages: Class cannot be casted to array 

File: com/google/code/rees/scope/util/RequestContextUtil.java 
Line number: 29 

--------------------------------------------------------------------------------

Stacktraces
java.lang.ClassCastException: Class cannot be casted to array 
    com.google.code.rees.scope.util.RequestContextUtil.getRequestContext(RequestContextUtil.java:29)
    com.google.code.rees.scope.struts2.StrutsConversationAdapter.getRequestContext(StrutsConversationAdapter.java:66)
    com.google.code.rees.scope.conversation.SimpleConversationManager.processConversation(SimpleConversationManager.java:56)
    com.google.code.rees.scope.conversation.SimpleConversationManager.processConversations(SimpleConversationManager.java:44)
    com.google.code.rees.scope.struts2.ConversationInterceptor.doIntercept(ConversationInterceptor.java:91)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    gov.usdoj.ojp.bvp.servlet.LoginFilter.doFilter(LoginFilter.java:114)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    gov.usdoj.ojp.bvp.servlet.CrossScriptingFilter.doFilter(CrossScriptingFilter.java:37)
    weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

What version of the product are you using? On what operating system?
struts2-conversation-scope-plugin-1.4.0.jar (I think same error with
1.4.1)

Original issue reported on code.google.com by tin...@gmail.com on 25 Apr 2012 at 8:22

GoogleCodeExporter commented 9 years ago
Also, the app is running on Weblogic 10.3.2 on Window XP.  Struts is 2.2.3.

Original comment by tin...@gmail.com on 25 Apr 2012 at 8:27

GoogleCodeExporter commented 9 years ago
Sorry, I only just noticed your issue.  I haven't actually run the example on 
WebLogic 10.3.2 before, but I have some 10.3.1 and a 10.3.5 domains setup for 
other projects already.  I will try it out tomorrow on those and see what's 
going on.  

In the mean time I put out a new release tonight with some performance and 
resource management improvements.  I updated the examples as well.  

Also, please see this [http://struts.apache.org/2.3.1.2/docs/s2-009.html post] 
on the Struts2 site.  If possible, you should definitely consider upgrading 
your Struts2 version to the latest release.

And thanks for letting me know about your issue -

Original comment by reesby...@gmail.com on 26 Apr 2012 at 4:05

GoogleCodeExporter commented 9 years ago
I've spent a little time looking into this.  I was able to deploy both the 
version of the example you used as well as the new version to WebLogic 10.3.1 
and 10.3.5 domains without any issues.

I've noticed that the exception is occurring when trying to cast a param map 
value to a String array.  Such as: 

Map paramMap = request.getParameterMap();
String[] someParamValue = (String[]) paramMap.get("someParamKey");

And your JVM is saying that the param value is not a String[].  

But the specification says that this should be a String[]:
http://docs.oracle.com/javaee/1.3/api/javax/servlet/ServletRequest.html#getParam
eterMap%28%29
http://docs.oracle.com/javaee/1.4/api/javax/servlet/ServletRequest.html#getParam
eterMap%28%29
http://docs.oracle.com/javaee/5/api/javax/servlet/ServletRequest.html#getParamet
erMap%28%29
http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getParamet
erMap%28%29

This makes me think that something else strange is going on.  Is this the only 
app you are deploying on the server?  Is there anything about your domain 
configuration that you can tell me, like are you using WebLogic Portal?  

I will look into this more a bit later-

Original comment by reesby...@gmail.com on 26 Apr 2012 at 8:10

GoogleCodeExporter commented 9 years ago
I kind of gave up on that example and tried Simple Annotation Example ( 
http://struts2-conversation.googlecode.com/svn/trunk/examples/simple-annotation-
example/ ) but still no real success -- the jsp input values are not persisted 
from begin to contact to preferences, empty values at the end.  I used struts 
2.3.1.2 (got deployment error where it cannot load the ConversationInterceptor) 
but I can still access the JSPs.  I also used my existing struts 2.2.3 app.  In 
both cases, I got error below: 

WARN   warn, Error setting expression 'preferences.instrument' with value '[Ljav
a.lang.String;@6d5de8'
ognl.OgnlException: target is null for setProperty(null, "instrument", [Ljava.la
ng.String;@6d5de8)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2239)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
        at ognl.SimpleNode.setValue(SimpleNode.java:301)
        at ognl.ASTChain.setValueBody(ASTChain.java:227)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
        at ognl.SimpleNode.setValue(SimpleNode.java:301)
        at ognl.Ognl.setValue(Ognl.java:737)
        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:209)
        at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStac
k.java:173)
        at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.j
ava:160)
...

Original comment by tin...@gmail.com on 26 Apr 2012 at 8:40

GoogleCodeExporter commented 9 years ago
I'm attaching a war that I have configured to run on WebLogic.  Try this, and 
if it doesn't work then we can peg your issue to a build problem, and if it 
doesn't work then there may be some kind of configuration issue.

Original comment by reesby...@gmail.com on 26 Apr 2012 at 10:08

Attachments:

GoogleCodeExporter commented 9 years ago
That is, if it DOES work then we can peg your issue to a build problem.  ;D

Original comment by reesby...@gmail.com on 26 Apr 2012 at 10:09

GoogleCodeExporter commented 9 years ago
Hooray!!! Your War file works and now mine as well.  Looks like when I used the 
new blank Struts app, I didn't have the log jars included which caused it to 
fail loading the ConversationInterceptor.  When I used the existing old Struts 
app it has the log jars so no loading error but the field values didn't get 
persisted which must be due to old Struts.  Now we know ;)  Thanks a lot!

Original comment by tin...@gmail.com on 27 Apr 2012 at 2:27

GoogleCodeExporter commented 9 years ago
Closing issue as "fixed".  Thanks for the reporting and feedback!

Original comment by reesby...@gmail.com on 27 Apr 2012 at 7:16