title: not able to call servlet from struts2
body: <p>I am using crystal report viewer where viewer call servlet action to display the report. And I integrated user management which is using struts2 and hibernate at backend. Now when I call the crystal report viewer action getting error that action is not mapped in struts2, but that action is mapped in servlet in web.xml file. I am sharing below my web.xml and struts.xml file. please advice how I can call servlet action in struts2. </p>
  
  <p>error:</p>
  
  <pre><code>41057 [http-nio-8080-exec-1] WARN  org.apache.struts2.dispatcher.Dispatcher  - Could not find action or result
  There is no Action mapped for namespace / and action name CrystalReportViewerHandler. - [unknown location]
      at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177)
      at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
      at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
  </code></pre>
  
  <p>If I am not using struts2 then viewer action work perfectly but when I integrate struts2 logic then getting exception.</p>
  
  <p>I already tried below code in struts.xml but can not work.</p>
  
  <pre><code>&lt;constant name="struts.action.excludePattern" value="CrystalReportViewerHandler"/&gt;
  </code></pre>
  
  <p>web.xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- &lt;web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt; --&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;CrystalReport&lt;/display-name&gt;
    &lt;context-param&gt;
          &lt;param-name&gt;crystal_image_uri&lt;/param-name&gt;
          &lt;param-value&gt;/crystalreportviewers&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;crystal_image_use_relative&lt;/param-name&gt;
          &lt;param-value&gt;webapp&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;CrystalReportViewerServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.crystaldecisions.report.web.viewer.CrystalReportViewerServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;CrystalReportViewerServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/CrystalReportViewerHandler&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
    &lt;filter&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;filter-class&gt;
              org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      &lt;/filter-class&gt;
    &lt;/filter&gt;
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;com.xyz.scheduling.Listener&lt;/listener-class&gt;
    &lt;/listener&gt;
  
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;redirect.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Struts.xml</p>
  
  <pre><code>&lt;!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
  
  &lt;struts&gt;
      &lt;constant name="struts.action.excludePattern" value="CrystalReportViewerHandler"/&gt;
      &lt;action name="reportViwer" method="execute" class="com.xyz.abc.ReportMail"&gt;
              &lt;param name="reportId"&gt;&lt;/param&gt;
              &lt;result name="success"&gt;/Pages/Open-Report-viewer.jsp&lt;/result&gt;           
          &lt;/action&gt;
  &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p>expecting "CrystalReportViewerHandler" action would work.</p>