This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deploying a jsf application to tomcat

 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Smitha H Rao
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic