Struts 2
  1. Struts 2
  2. WW-2653

Struts 2 tag does not get invoked inside the JSP result from a REST contoller class in Websphere 6.1.0.15

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.1.1, 2.1.2, 2.1.3
    • Fix Version/s: 2.1.3
    • Labels:
      None
    • Environment:

      windows, Websphere 6.1.0.15, application uses Struts 2, Spring 2.5, JP, Hibernate, Struts2-REST plugin and Sitemesh / JSP.

    • Flags:
      Patch, Important

      Description

      We have a application that uses Struts 2, Spring 2.5, JP, Hibernate, Struts2-REST plugin and Sitemesh / JSP. We originally used Maven 2 to build this project and everything worked fine in Jetty and Tomcat!
      When we deployed to Websphere we had 2 major issues.
      First one is an "Unable to load config class org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor at interceptor - wsjar:file:/C:/RAD7/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/struts2-rest-showcaseEAR.ear/struts2-rest-showcase.war/WEB-INF/lib/struts2-core-2.1.3-SNAPSHOT.jar!/struts-default.xml:145:127 probably due to a missing jar, which might be fine if you never plan to use the validation interceptor"
      error even though all other interceptors get loaded and works fine. I have created a separate jira issue for this and it works fine if i remove this AnnotationValidationInterceptor from the Struts-default.xml inside Struts-core.jar and Struts-plugin.xml file inside rest-plugin.jar. I tried using 2.1.1-SNAPSHOT and 2.1.3-SNAPSHOT.

      Then I got a "404- file not found" error for accessing any of the rest controllers that are deployed in in websphere 6.1 from the Browser. I got a patch from IBM and that fixed this issue (http://www-1.ibm.com/support/docview.wss?uid=swg24014758)

      However, now I consistently get java.lang.reflect.InvocationTargetException at (com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java::118).
      I can reproduce this error simply by deploying the Struts2-rest-showcase example application in latest Websphere 6.1.0.15.
      One more interesting observation is that when I remove the struts 2 tags from the JSP, this last exception also goes away and everything works. In my opinion just the filter chaining and Struts 2 tags in jsp result are not working with Websphere 6.1

      I have included the full exception stack trace for your review:-

      [5/21/08 10:23:30:517 EDT] 00000024 ServletWrappe I SRVE0242I: [struts2-rest-showcaseEAR] [/struts2-rest-showcase] [/orders-editNew.jsp]: Initialization successful.
      [5/21/08 10:23:30:517 EDT] 00000024 ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: /orders-editNew.jsp. Exception thrown : java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:290)
      at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:470)
      at com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:508)
      at com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:507)
      at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:558)
      at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:506)
      at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
      at com.ibm._jsp._orders_2D_editNew._jspx_meth_s_form_0(_orders_2D_editNew.java:153)
      at com.ibm._jsp._orders_2D_editNew._jspService(_orders_2D_editNew.java:73)
      at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1074)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1009)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:771)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:539)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
      at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
      at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:225)
      at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:278)
      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:321)
      at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:140)
      at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
      at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:355)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:88)
      at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
      at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
      at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:124)

        Issue Links

          Activity

          Hide
          musachy added a comment -

          xwork rv1784

          Show
          musachy added a comment - xwork rv1784
          Hide
          Michael Watson added a comment -

          Change in x-work trunk looks good.

          Show
          Michael Watson added a comment - Change in x-work trunk looks good.
          Hide
          musachy added a comment -

          I committed the fix to xwork trunk, could you please test and verify that the issue is solved?

          Show
          musachy added a comment - I committed the fix to xwork trunk, could you please test and verify that the issue is solved?
          Hide
          James Holmes added a comment -

          The trick will be to open a ticket over at the XWork project. We will then have to do a new XWork release that Struts 2.1.3 (or later) depends on. Struts 2.1.2 is currently labeled Beta, but will most likely not make it to GA status because of this issue. Hopefully we can get this fix in and have 2.1.3 go GA.

          We will leave this ticket open so that we can track the issue on the Struts 2 side until XWork is fixed.

          Here's the link for opening a ticket over at the XWork project:

          http://jira.opensymphony.com/secure/Dashboard.jspa

          Show
          James Holmes added a comment - The trick will be to open a ticket over at the XWork project. We will then have to do a new XWork release that Struts 2.1.3 (or later) depends on. Struts 2.1.2 is currently labeled Beta, but will most likely not make it to GA status because of this issue. Hopefully we can get this fix in and have 2.1.3 go GA. We will leave this ticket open so that we can track the issue on the Struts 2 side until XWork is fixed. Here's the link for opening a ticket over at the XWork project: http://jira.opensymphony.com/secure/Dashboard.jspa
          Hide
          Michael Watson added a comment - - edited

          Ok so I've managed to fix this problem. By modifying com.opensymphony.xwork2.validator.DefaultValidatorFactory I was able to get to order/new, add an order and see it in the orders list.

          Below is the method I modified, note the check for file scheme, this lets it skip the resource bundles that were killing it previously:

          private void parseValidators() {
          if (LOG.isDebugEnabled())

          { LOG.debug("Loading validator definitions."); }

          List<File> files = new ArrayList<File>();
          try {
          // Get custom validator configurations via the classpath
          Iterator<URL> urls = ClassLoaderUtil.getResources("", DefaultValidatorFactory.class, false);
          while (urls.hasNext()) {
          URL u = urls.next();
          URI uri = new URI(u.toExternalForm().replaceAll(" ", "%20"));
          if ((null != uri) && ("file".equalsIgnoreCase(uri.getScheme()))) {
          File f = new File(uri);
          FilenameFilter filter = new FilenameFilter() {
          public boolean accept(File file, String fileName)

          { return fileName.contains("-validators.xml"); }

          };
          files.addAll(Arrays.asList(f.listFiles(filter)));
          }
          }
          } catch (URISyntaxException e)

          { e.printStackTrace(); // swallow }

          catch (IOException e)

          { throw new ConfigurationException("Unable to parse validators", e); }

          // Parse default validator configurations
          String resourceName = "com/opensymphony/xwork2/validator/validators/default.xml";
          retrieveValidatorConfiguration(resourceName);

          // Overwrite and extend defaults with application specific validator configurations
          resourceName = "validators.xml";
          retrieveValidatorConfiguration(resourceName);

          // Add custom (plugin) specific validator configurations
          for (File file : files)

          { retrieveValidatorConfiguration(file.getName()); }

          }

          Now how do we go about getting this fix in to xwork -> struts2 asap?

          I've got the ok to use a non-GA struts2 release but we've been instructed not to maintain our own version of this stuff. Since this is critical to anyone wanting to run Struts2 on Websphere 6.1 can we get the fix above included urgently?

          Show
          Michael Watson added a comment - - edited Ok so I've managed to fix this problem. By modifying com.opensymphony.xwork2.validator.DefaultValidatorFactory I was able to get to order/new, add an order and see it in the orders list. Below is the method I modified, note the check for file scheme, this lets it skip the resource bundles that were killing it previously: private void parseValidators() { if (LOG.isDebugEnabled()) { LOG.debug("Loading validator definitions."); } List<File> files = new ArrayList<File>(); try { // Get custom validator configurations via the classpath Iterator<URL> urls = ClassLoaderUtil.getResources("", DefaultValidatorFactory.class, false); while (urls.hasNext()) { URL u = urls.next(); URI uri = new URI(u.toExternalForm().replaceAll(" ", "%20")); if ((null != uri) && ("file".equalsIgnoreCase(uri.getScheme()))) { File f = new File(uri); FilenameFilter filter = new FilenameFilter() { public boolean accept(File file, String fileName) { return fileName.contains("-validators.xml"); } }; files.addAll(Arrays.asList(f.listFiles(filter))); } } } catch (URISyntaxException e) { e.printStackTrace(); // swallow } catch (IOException e) { throw new ConfigurationException("Unable to parse validators", e); } // Parse default validator configurations String resourceName = "com/opensymphony/xwork2/validator/validators/default.xml"; retrieveValidatorConfiguration(resourceName); // Overwrite and extend defaults with application specific validator configurations resourceName = "validators.xml"; retrieveValidatorConfiguration(resourceName); // Add custom (plugin) specific validator configurations for (File file : files) { retrieveValidatorConfiguration(file.getName()); } } Now how do we go about getting this fix in to xwork -> struts2 asap? I've got the ok to use a non-GA struts2 release but we've been instructed not to maintain our own version of this stuff. Since this is critical to anyone wanting to run Struts2 on Websphere 6.1 can we get the fix above included urgently?
          Hide
          Michael Watson added a comment -

          I see the exact same behaviour on Webshpere with the rest showcase.

          This is a complete show stopper for the project I'm working on. Any idea when this might be looked at in any detail?

          Show
          Michael Watson added a comment - I see the exact same behaviour on Webshpere with the rest showcase. This is a complete show stopper for the project I'm working on. Any idea when this might be looked at in any detail?
          Hide
          Jay added a comment -

          FYI, I am also raising a PMR with IBM Websphere 6.1.0.15 for this issue to get their side of the story.

          Show
          Jay added a comment - FYI, I am also raising a PMR with IBM Websphere 6.1.0.15 for this issue to get their side of the story.

            People

            • Assignee:
              Unassigned
              Reporter:
              Jay
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development