Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jersey Client creation Error

Tags:

java

linux

jersey

I have following exception after an hour of traffic, What I have to check? This code works properly whithin an hour. I think some system folders are getting full.

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)

Exception shows that "Client client = Client.create(config);" code statement cannot executed.

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()));

I am simulating the client-server interaction as if a real User performed an action, Do I have to create one instance of client per User, or Should at each performing of action Client be created?

like image 298
Ahmet Karakaya Avatar asked Sep 30 '22 04:09

Ahmet Karakaya


2 Answers

I had a a similar error with the message:

WARNING: Cannot create temporary files. Multipart attachments will be limited to 4096 bytes. java.io.IOException: No such file or directory

It was because the folder ${APACHE_HOME}/temp didn't exists.

After creating the missing folder and restarting the tomcat, the error message stopped showing.

like image 119
AlikElzin-kilaka Avatar answered Oct 02 '22 15:10

AlikElzin-kilaka


I have found out that ${APACHE_HOME}/temp folder has around 2 billion temp files, after deleting them all problem is resolved.

like image 41
Ahmet Karakaya Avatar answered Oct 02 '22 15:10

Ahmet Karakaya