Springboot 使用axis2时在tmp文件夹产生大量缓存文件,撑爆磁盘解决方法

       最近通过axis2开发webservice接口,每次调用都会产生一个临时文件,开发环境没注意,部署到生产环境后几个小时直接把服务器硬盘给撑爆了,然后就收到了服务器告警短信,经过排查发现产生大量的运行日志。
日志内容如下:


2018-06-22 01:03:02 INFO [org.apache.axis2.deployment.ModuleDeployer:82] Deploying module: addressing-1.6.2 - file:/app/SAP/vanke-icp-moudle-0.0.1-SNAPSHOT/lib/axis2-1.6.2.jar 
2018-06-22 01:03:02 INFO [org.apache.commons.httpclient.auth.AuthChallengeProcessor:101] basic authentication scheme selected 

在网上很多人都说往stub文件中加代码,可是我们这边的接口几十个呢,改起来贼麻烦,最后去查了axis2官网,发现此问题是1.6.2版本的bug,在1.7版本已经解决了!

最终解决方案,将原来的axis2版本1.6.2升级为 axis2-adb版本的1.7.8 ,完美解决!

调整前:

<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.2</version>
</dependency>

  调整后:

<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.7.8</version>
</dependency>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
你好!要在Spring Boot中集成Axis2,您可以按照以下步骤进行操作: 1. 添加Axis2依赖:在您的Spring Boot项目的pom.xml文件中,添加Axis2的依赖项。例如: ```xml <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2</artifactId> <version>1.7.9</version> </dependency> ``` 2. 配置Axis2 Servlet:在您的Spring Boot项目中,创建一个类继承自`org.apache.axis2.transport.http.AxisServlet`,并使用`@WebServlet`注解将其标记为Servlet。例如: ```java import javax.servlet.annotation.WebServlet; import org.apache.axis2.transport.http.AxisServlet; @WebServlet(urlPatterns = "/services/*", loadOnStartup = 1) public class Axis2Servlet extends AxisServlet { // 可以保持默认实现 } ``` 3. 配置Axis2服务:在您的Spring Boot项目中创建一个类,用于配置Axis2服务。您可以通过使用`org.apache.axis2.deployment.ServiceDeployer`类进行配置。例如: ```java import org.apache.axis2.deployment.ServiceBuilder; import org.apache.axis2.deployment.ServiceDeployer; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisConfiguration; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class Axis2Config { @Bean public ServletRegistrationBean<AxisServlet> axisServlet() { return new ServletRegistrationBean<>(new Axis2Servlet(), "/services/*"); } @Bean public ServiceDeployer serviceDeployer() { return new ServiceDeployer() { @Override public void deployServices(AxisConfiguration axisConfig) { // 在这里配置Axis2服务 AxisService service = new ServiceBuilder(axisConfig).populateService(getClass().getClassLoader() .getResourceAsStream("META-INF/axis2/services/YourService.xml")); axisConfig.addService(service); } }; } } ``` 在上面的示例中,您可以将`YourService.xml`替换为您的Axis2服务的配置文件。 4. 创建Axis2服务:创建您的Axis2服务的配置文件(`YourService.xml`),并将其放置在`src/main/resources/META-INF/axis2/services/`目录下。您可以在该配置文件中定义您的服务和操作。 5. 运行应用程序:现在,您可以启动Spring Boot应用程序,并访问`http://localhost:8080/services/`来访问您的Axis2服务。 请注意,上述步骤只提供了基本的集成方法。根据您的具体需求,您可能还需要进行其他配置和调整。希望对您有所帮助!如果您有任何问题,请随提问。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值