【发布时间】:2012-01-17 12:26:45
【问题描述】:
我使用的是 Axis2 1.6。在每个请求客户端都生成临时文件,从而导致磁盘空间问题。
我可以请人帮我看一些如何解决这个问题的文章吗?
问候, 琥珀色
【问题讨论】:
-
据我所知,axis2 库不会创建临时文件。您了解这些文件的来源吗?
-
文件来自被提取使用的 Axis2 模块 (.mar) 文件。
标签: axis2
我使用的是 Axis2 1.6。在每个请求客户端都生成临时文件,从而导致磁盘空间问题。
我可以请人帮我看一些如何解决这个问题的文章吗?
问候, 琥珀色
【问题讨论】:
标签: axis2
我在使用 Axis2 1.6.3 时遇到了这个问题。我正在使用Addressing 模块 (org.apache.axis2:addressing:1.6.3:jar:classpath-module)。
我的整个阴影 JAR 都被复制到临时目录中,并且在 Java 进程崩溃时不会被删除,因此磁盘使用量增长未得到控制。
我解决这个问题的方法是手动向 Axis2 注册模块,而不是让它自动注册,因此它会跳过将临时 JAR 写入磁盘。
我使用了 Axis2 的 ModuleDeployer.deploy() 和 DeploymentEngine.addNewModule() 的逻辑。
ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
MyExampleStub myExampleStub = new MyExampleStub(context, mySoapUri);
myExampleStub._getServiceClient().engageModule("addressing");
ConfigurationContext context = ConfigurationContextFactory.createDefaultConfigurationContext();
AxisConfiguration axisConfiguration = context.getAxisConfiguration();
AxisModule addressing = new AxisModule("addressing");
addressing.setParent(axisConfiguration);
addressing.setModuleClassLoader(getClass().getClassLoader());
InputStream moduleXmlInputStream = getClass().getResourceAsStream("META-INF/module.xml");
new ModuleBuilder(moduleXmlInputStream, addressing, axisConfiguration).populateModule();
DeploymentEngine.addNewModule(addressing, axisConfiguration);
MyExampleStub myExampleStub = new MyExampleStub(context, mySoapUri);
myExampleStub._getServiceClient().engageModule("addressing");
现在我仍然在我的传出请求<Header> 中看到预期的<wsa:To>、<wsa:MessageID> 和<wsa:Action> 元素,但我的临时目录不包含任何axis2-tmp-6160203768737879650.tmp 目录或axis2-tmp-6160203768737879650.tmp.lck 文件。
【讨论】:
这个接缝是 1.7.0 版修复的 bug。
【讨论】: