java - Read and Write Image file inside web-app in grails -


i reading image web-app/images , creating duplicate of same in same location different name. grails application.

i getting real path of file using follwing code,

    def serveletcontext = servletcontextholder.servletcontext     def filepath = serveletcontext.getrealpath( "web-app/images" )     def actfile= new file(filepath+ "myimg.png")     final bufferedimage image = imageio.read(actfile) 

this working fine in devlopment environment. both read , write happening fine. when deploying war of application in tomcat i'm getting exception

java.lang.reflect.undeclaredthrowableexception @ bootstrap$_closure1.docall(bootstrap.groovy:39) @ grails.util.environment.evaluateenvironmentspecificblock(environment.java:308) @ grails.util.environment.executeforenvironment(environment.java:301) @ grails.util.environment.executeforcurrentenvironment(environment.java:277) @ java.util.concurrent.executors$runnableadapter.call(executors.java:471) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:745) caused by: javax.imageio.iioexception: can't read input file!

please tell me how resolve this. or can same using relative path instead real path in anyway?

if tested on local , if working. might due server issue related permission setting.

please check the permission on tomcat webapps directory @ least make sure read , writeable 755.

chmod u+x / 755 webapps

if not please add more code , inspect bug ,,, if have used other plugin also?


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -