4

I am indexing PDF document using Lucene, I use Eclipse indigo as an IDE and tomcat7 as a servlet container , the problem is when I index the document and want to save the original document for later downloading, but eclipse put the documents in temporary directory in stead of the directory I have chosen.
here is what I am doing.

I have this param in my web.xml

    <context-param>
    <description>Location to store uploaded file also the location of files to be indexed</description>
    <param-name>file-upload</param-name>
    <param-value>
    folder\
 </param-value>
</context-param>

then calling it inside servlet init() methode like this

filePath = getServletContext().getRealPath("") + File.separator + getServletContext().getInitParameter("file-upload");

in short I am trying to store the document in directory called "folder" inside my project which is called "Search", but eclipse will store it in the temporary place like this:

C:\Users\Solid\Dropbox\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Search\folder\ir_overview.pdf

but the actual path is like this :

C:\Users\Solid\Dropbox\workspace\Search\WebContent\folder

any idea how to solve this??

solidfox
  • 581
  • 1
  • 6
  • 20

2 Answers2

4

Eclipse deploys the project to a working directory outside of the Project Workspace.

Default, Eclipse uses /workspace/.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps path to deploy web application.

It has to re-organize the files from the directory structure the Eclipse Workspace expects to the format a Web Application expects.

Click on > Servers Tab. Right Click on Servlet container (Tomcat 7 in your case) and Open (F3 is shortcut for eclipse).

You should be able to see Server Path option which contains

Specify the server path (i.e. catalina.base) and deploy path.

You can specify the deploy location here.

Note: Server must be published with no modules present to make changes.

So, undeploy your web applicaion and change the location.

EDIT:

Unrelated to Question : You should create separate directory out side webContent / webapp to store Lucene indexes. This practice would be useful when you deploy application to Tomcat production

Hardik Mishra
  • 14,779
  • 9
  • 61
  • 96
1

if you find the fields for the modification disabled on opening the server configuration page, just close your server and remove all the application by right clicking on server > add remove > remove all and after that again right click > then clean. it will un-deploy all the apps currently on the server and will allow you to modify the server settings.

Rajan Chauhan
  • 461
  • 2
  • 7
  • 18