简体   繁体   English

axis2 .aar 文件的应用程序根路径是什么

[英]What is the application root path of an axis2 .aar file

I have an axis2 archive file(aar) which I would like to deploy to a axis2 web app.我有一个axis2 存档文件(aar),我想将其部署到axis2 Web 应用程序。 Usually in a .war archive, we can get access to application root path using request.getServletContext().getRealPath("/") .通常在.war存档中,我们可以使用request.getServletContext().getRealPath("/")访问应用程序根路径。 I understand there is something for the web service to access files in the server.我知道 Web 服务需要访问服务器中的文件。 I tried using ConfigurationContext.getRealPath("/") .我尝试使用ConfigurationContext.getRealPath("/") But it doesn't seem to work.但它似乎不起作用。

You may refer to my case.你可以参考我的情况。

https://community.jboss.org/thread/221937 https://community.jboss.org/thread/221937

If you use Windows 7, aar seems to regard user account folder as a root.如果您使用 Windows 7,aar 似乎将用户帐户文件夹视为根目录。

For your Axis2 to work, you don't need an aar file.要使 Axis2 正常工作,您不需要aar文件。

services.xml file can be in either of the below locations for the Axis2 to work. services.xml文件可以位于以下任一位置,以便 Axis2 工作。

  1. repository/services/SimpleService/meta-inf/services.xml存储库/服务/SimpleService/meta-inf/services.xml
  2. WEB-INF/services/SimpleService/meta-inf/services.xml WEB-INF/services/SimpleService/meta-inf/services.xml

This will help us in avoiding an extra step of generating the aar file.这将帮助我们避免生成 aar 文件的额外步骤。

ServiceDeployer.java服务部署者.java

 * <p>
 * Standard Axis2 service Deployer which use services.xml file to build
 * services. ServiceDeployer can be used with Axis2 archive (.aar) or exploded
 * directory structure. Some of the example formats given below.
 * </p>
 * <p>Examples : <p>
 *        <ul>
 *          <li>repository/services/SimpleService.aar/meta-inf/services.xml</li>
 *          <li>repository/services/SimpleService/meta-inf/services.xml</li>
 *          <li>WEB-INF/services/SimpleService.aar/meta-inf/services.xml</li>
 *          <li>WEB-INF/services/SimpleService/meta-inf/services.xml</li>
 *       </ul>
 
     InputStream servicexmlStream = serviceClassLoader
            .getResourceAsStream("META-INF/services.xml");
    if (servicexmlStream == null) {
        servicexmlStream = serviceClassLoader.getResourceAsStream("meta-inf/services.xml");
    } else {
        metainf = "META-INF";
    }

https://axis.apache.org/axis2/java/core/apidocs/org/apache/axis2/deployment/ServiceDeployer.html https://axis.apache.org/axis2/java/core/apidocs/org/apache/axis2/deployment/ServiceDeployer.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM