Uploaded image for project: 'XML-RPC'
  1. XML-RPC
  2. XMLRPC-190

Cannot find XmlRpcServlet.properties file in war when packaged it in ear

    XMLWordPrintableJSON

Details

    Description

      Cannot find XmlRpcServlet.properties file in war when packaged it in ear.

      Workaround:
      -------------------
      You have to extend the original org.apache.xmlrpc.webserver.XmlRpcServlet class and overwrite newXmlRpcHandlerMapping() method. After it you may use your new class file in web.xml instead of the original org.apache.xmlrpc.webserver.XmlRpcServlet class.

      MyXmlRpcServlet.java:
      public class MyXmlRpcServlet extends org.apache.xmlrpc.webserver.XmlRpcServlet
      {
      @Override
      protected XmlRpcHandlerMapping newXmlRpcHandlerMapping() throws XmlRpcException
      {
      String packageName = this.getClass().getPackage().getName().replaceAll("
      .", "/");
      String realPath = "/WEB-INF/classes/" + packageName + "/XmlRpcServlet.properties";

      try
      {
      URL url = this.getServletContext().getResource(realPath);
      if (url == null)

      { throw new XmlRpcException("Failed to locate resource XmlRpcServlet.properties"); }

      return newPropertyHandlerMapping(url);
      }
      catch (IOException e)

      { throw new XmlRpcException("Failed to load resource " + realPath + ": " + e.getMessage(), e); }

      }
      }

      web.xml:
      <servlet>
      <servlet-name>XmlRpcServlet</servlet-name>
      <servlet-class>com.remal.xmlrpc.webserver.MyXmlRpcServlet</servlet-class>
      <init-param>
      <param-name>enabledForExtensions</param-name>
      <param-value>true</param-value>
      <description>
      Sets, whether the servlet supports vendor extensions for XML-RPC.
      </description>
      </init-param>
      </servlet>
      <servlet-mapping>
      <servlet-name>XmlRpcServlet</servlet-name>
      <url-pattern>/xmlrpc</url-pattern>
      </servlet-mapping>

      This solution is working in standalone war and/or war when packaged it in ear.

      regards, Arnold Somogyi

      Attachments

        Activity

          People

            Unassigned Unassigned
            zappee13 zappee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified