Hello Everyone!

I am trying to upgrade from Struts 2.0.14 to Struts 2.1.8 and have hit a
small snag which I can't seem to resolve through some Google searching.
Following is part of my defined Inteceptor (the intercept method):

...
public String intercept(ActionInvocation invocation)
      throws Exception
   {
      // Get the action context from the invocation so we can access the
      // HttpServletRequest and HttpSession objects.
      final ActionContext context = invocation.getInvocationContext();
      HttpServletRequest request = (HttpServletRequest)
context.get(ServletActionContext.HTTP_REQUEST);
      HttpSession session = request.getSession(true);
      ...
      return invocation.invoke();
   }
...

As soon as I upgraded to version 2.1.8, I started seeing the following error
when trying to pull the HttpServletRequest object from the context object:

java.lang.NoSuchMethodError:
com.opensymphony.xwork2.ActionContext.get(Ljava/lang/Object;)Ljava/lang/Object;
        
com.mcs.therapist.interceptors.SchemaInterceptor.intercept(SchemaInterceptor.java:38)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
        
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
        
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
        
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
        
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
        
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
        
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
        
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
        
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
        
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)
        
com.mcs.therapist.filters.AuditLogFilter.doFilter(AuditLogFilter.java:51)


I looked at the ActionContext API and it appears that the "get(Object)"
method is still valid, but I'm still missing something.  With this new
version of struts, how do I ultimately get access to the HttpSession?

Thanks for the help.

Daniel Stephenson
dan.stephen...@gmail.com
208.498.2033 - Fax

Reply via email to