• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

deploying a jsf application to tomcat

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 https://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.
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic