ImageIO.write Permission denied issue Ubuntu Java -
i using struts2,java webapplication, ubuntu server
i trying upload image in application,it works perfect in local machine (ubuntu), using same code trying upload image in ubuntu server machine . throws error,i have image resize code in application imageio.write
used.the following code used
thumbnail=scalr.resize(image,scalr.method.speed,scalr.mode.fit_to_width,480,10,scalr.op_antialias); imageio.write(thumbnail, ext, resizefile); fileutils.copyfile(resizefile, desfile);
while reaching imageio.write point following exception thrown
java.io.filenotfoundexception: 1342e10.jpg (permission denied) @ java.io.randomaccessfile.open(native method) @ java.io.randomaccessfile.<init>(randomaccessfile.java:236) @ javax.imageio.stream.fileimageoutputstream.<init>(fileimageoutputstream.java:69) @ com.sun.imageio.spi.fileimageoutputstreamspi.createoutputstreaminstance(fileimageoutputstreamspi.java:55) @ javax.imageio.imageio.createimageoutputstream(imageio.java:409) @ javax.imageio.imageio.write(imageio.java:1520) @ com.platinum.uac.biz.fileupload.fileupload(fileupload.java:124) @ com.platinum.uac.biz.fileuploadbyajaxaction.ajaxfileuploadaction(fileuploadbyajaxaction.java:98) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:622) @ com.opensymphony.xwork2.defaultactioninvocation.invokeaction(defaultactioninvocation.java:441) @ com.opensymphony.xwork2.defaultactioninvocation.invokeactiononly(defaultactioninvocation.java:280) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:243) @ com.opensymphony.xwork2.interceptor.conversionerrorinterceptor.intercept(conversionerrorinterceptor.java:122) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ com.opensymphony.xwork2.interceptor.parametersinterceptor.dointercept(parametersinterceptor.java:195) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:87) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ com.opensymphony.xwork2.interceptor.parametersinterceptor.dointercept(parametersinterceptor.java:195) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:87) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ org.apache.struts2.interceptor.multiselectinterceptor.intercept(multiselectinterceptor.java:75) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ org.apache.struts2.interceptor.checkboxinterceptor.intercept(checkboxinterceptor.java:94) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ com.opensymphony.xwork2.interceptor.prepareinterceptor.dointercept(prepareinterceptor.java:138) @ com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:87) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ org.apache.struts2.interceptor.servletconfiginterceptor.intercept(servletconfiginterceptor.java:164) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ com.opensymphony.xwork2.interceptor.exceptionmappinginterceptor.intercept(exceptionmappinginterceptor.java:176) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ org.apache.struts2.interceptor.fileuploadinterceptor.intercept(fileuploadinterceptor.java:306) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:237) @ org.apache.struts2.impl.strutsactionproxy.execute(strutsactionproxy.java:52) @ org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:488) @ org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:77) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:91) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:235) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:233) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:191) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:127) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:102) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) @ org.apache.coyote.http11.http11processor.process(http11processor.java:859) @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:602) @ org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) @ java.lang.thread.run(thread.java:701) exception apple java.lang.nullpointerexception
whether file created when execute imageio.write.if yes location? user @ time?
i guessing write permission may restricted. how can solve this?
imageio.write write file, yes. depends on file name give it: if it's absolute file name, should obvious. if it's not, depends on current directory, depends on start program.
Comments
Post a Comment