Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem accessing a file resource from a web app on Tomcat server

Status
Not open for further replies.

prabu143

Programmer
Jan 13, 2012
1
IE
Hi ,

I want to develop a web app using grails ,which should invoke/execute a VBScript file. I have placed VBScript file in WEB_INF/resources folder.

I am using Runtime.getRuntime().exec() to invoke the VBscript .

I am accessing the VBSCript either by using

def vbPath = getServletContext().getRealPath("WEB-INF/resources/" + "calling.vbs");

or

String path = new File(getServletContext().getRealPath("WEB-INF/resources/" + "calling.vbs")).getAbsolutePath()


The above path values are working fine on Jetty server. but the same is not working on Tomcat. Though the above path values are returring the corrct values on both cases.

For local(Jetty) deployment the path value returning is :
C:\Grails\workspace\MyProject\web-app\WEB-INF\resources\calling.vbs


On Tomcat deployment tha path vaue returning is :
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\MyProject-0.1\WEB-INF\resources\calling.vbs



I have even tried by placing the VBScript file in
C:\Test

folder, but it always works on Jetty, but not on tomcat server

I am thinking that, we can not access a file from Servlet/Web on Tomcat .
Could you please some one advise me how to accesss a file from a webservice on tomcat. It may be a local resource or WEB-INF folder resource on deployment machine.


Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top