aspose file tools*
The moose likes JSF and the fly likes deploying a jsf application to tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "deploying a jsf application to tomcat" Watch "deploying a jsf application to tomcat" New topic
Author

deploying a jsf application to tomcat

sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
My directory structure for a jsf file upload application is as follows:



When I deploy this as a war file get.war to Tomcat I am getting 404s

When I use Eclipse to run the index.jsp on the server, I am able to view
the page with:




Can someone help me understand why?

Thanks,

Sonia

Christian Nicoll
Ranch Hand

Joined: Mar 09, 2008
Posts: 106
Hi Sonia,

you use two different url's, the first one contains a get, the second one not.

Take also care that files which are located directly under the WEB-INF folder are not directly accessible. For more information see also http://www.coderanch.com/t/293252/JSP/java/Accessing-JSP-under-WEB-INF.

If you want to use a JSF application then i think that you 've to access you your view-elements with an suffix .jsf or .faces, dependent on your web.xml, and not .jsp.

Hoping it helps.


SCJP 5, SCJD 5, SCWCD 5, SCBCD 5, SCJDWS 5
My SCBCD-Notes - My Hello World Webservice
Smitha H Rao
Ranch Hand

Joined: Oct 20, 2007
Posts: 50
Sonia,

The directory stucture you have listed looks like a eclipse work directory. When you deploy it in tomcat, a new deployable testUpload directory will be created with contents of only webcontent folder and classes compiled.
Suppose your eclipse working directory is something say E:/java/myEclipseWork and you tomcat deployed directory is say c:/tomcat

then when you deploy the application from eclipse a directory c:/tomcat
c:/tomcat/webapp/testUpload will be created and this is actually the directory from which the tomcat picks up the file when you request something.

If you want to download something, you have to specify path for upload at c:/tomcat/webapp/testUpload folder.




Free Mock tests Interview questions
sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
The index.jsp and upload.jsp are under the WebContent directory not the WEB-INF,
and I use get in the url because the war file was deployed as a get.war in Tomcat
WebApps directory which it implodes to the directory structure listed above under
the get directory.

Sonia.
sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
Smitha,

Look at my example above. When I create a get.war directory which contains the testUpload directory in tomcat it is deployed as




I am trying to use the url



I am getting a 404
Smitha H Rao
Ranch Hand

Joined: Oct 20, 2007
Posts: 50
This means inside webapp you have
get war which intern have
testUpload
testUpload /WEB-INF etc

Then your setting is wrong.

you must have the WEB-INF directory exactly inside get.war (it should not be inside another directory testUpload )
You should know tomcat webapplication directory structure.

sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
It works on Eclipse. If I select the file index.jsp and right click and run on Server, I can see the upload page.
I have tried a simple example and it works. But I can't apply it to this, and I am trying to understand why.

Sonia
sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
Well, I thought I would post the partial solution so hopefully it would help someone.

If you create the war file using Eclipse it deploys correctly.

But I still have a problem. Still trying to figure out what I did wrong.

When I point my browser to:



I get an error : cannot find FacesContext.



correctly forwards the page to upload.jsp.

Thanks,

Sonia
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deploying a jsf application to tomcat