Jersey客户端创建错误

时间:2014-12-21 12:33:03

标签: java linux jersey

经过一个小时的流量后,我有以下异常,我需要检查什么? 这段代码可以在一小时内正常运行。我认为有些系统文件夹已满。

Dec 21, 2014 2:27:32 PM com.sun.jersey.multipart.impl.MultiPartReaderClientSide createMimeConfig
WARNING: Cannot create temporary files. Multipart attachments will be limited to 4096 bytes.
java.io.IOException: No space left on device
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(File.java:1006)
        at java.io.File.createTempFile(File.java:1989)
        at java.io.File.createTempFile(File.java:2040)
        at com.sun.jersey.multipart.impl.MultiPartReaderClientSide.createMimeConfig(MultiPartReaderClientSide.java:120)
        at com.sun.jersey.multipart.impl.MultiPartReaderClientSide.<init>(MultiPartReaderClientSide.java:109)
        at sun.reflect.GeneratedConstructorAccessor83.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:210)
        at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:180)
        at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166)
        at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
        at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:283)
        at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:163)
        at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
        at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
        at com.sun.jersey.api.client.Client.init(Client.java:343)
        at com.sun.jersey.api.client.Client.access$000(Client.java:119)
        at com.sun.jersey.api.client.Client$1.f(Client.java:192)
        at com.sun.jersey.api.client.Client$1.f(Client.java:188)
        at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
        at com.sun.jersey.api.client.Client.<init>(Client.java:188)
        at com.sun.jersey.api.client.Client.<init>(Client.java:171)
        at com.sun.jersey.api.client.Client.create(Client.java:683)

异常显示"Client client = Client.create(config);"代码语句无法执行。

private static boolean callFileDownloadDelete(User user, String fileUrl, boolean isDownloadCompleted) {
    ClientConfig config = new DefaultClientConfig();
    Client client = Client.create(config);
    client.addFilter(new HTTPBasicAuthFilter(user.getUserName(), user.getPassword()));

我正在模拟客户端 - 服务器交互,就像真实用户执行操作一样,我是否必须为每个用户创建一个客户端实例,或者每次执行操作时应该创建客户端吗?

2 个答案:

答案 0 :(得分:2)

我的消息出现了类似的错误:

  

警告:无法创建临时文件。多部分附件将限制为4096字节。   java.io.IOException:没有这样的文件或目录

这是因为${APACHE_HOME}/temp文件夹不存在。

创建丢失的文件夹并重新启动tomcat后,错误消息停止显示。

答案 1 :(得分:1)

我发现${APACHE_HOME}/temp文件夹中有大约20亿个临时文件,删除后所有问题都解决了。