[ 
https://issues.apache.org/jira/browse/XMLRPC-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105342#comment-13105342
 ] 

Jochen Wiedmann commented on XMLRPC-190:
----------------------------------------

Try replacing

URL url = this.getServletContext().getResource(realPath); 

with

URL url = Thread.currentThread().getContextClassLoader()getResource(realPath);

If this doesn't work either, please contact you application servers support 
forum. This issue is not related to XML-RPC.


> Cannot find XmlRpcServlet.properties file in war when packaged it in ear
> ------------------------------------------------------------------------
>
>                 Key: XMLRPC-190
>                 URL: https://issues.apache.org/jira/browse/XMLRPC-190
>             Project: XML-RPC
>          Issue Type: Wish
>    Affects Versions: 3.1.3
>         Environment: linux / windows
>            Reporter: zappee
>            Priority: Minor
>              Labels: Failed, XmlRpcServlet.properties, locate, resource, to
>             Fix For: 3.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org
For additional commands, e-mail: dev-h...@ws.apache.org

Reply via email to