Downloading file using Tomcat - java

I am trying to do a little project where I download a file through the browser. I want to use Tomcat for that.
I installed and ran Tomcat, on addresss http://localhost:8080/ I have main Tomcat site. I placed file test.txt into webapps/test/ and I am trying to enter http://localhost:8080/test/test.txt, but it does not work. All I see is Error 404, requested resource is not available. What do I I need to do? Create some application not only directory in webapps? Or should I set some mapping from URL to file?

Related

can't see website after deploying a .war file to tomcat

I have created a java web application and created the file thymeleaf.war to deploy it on a tomcat server.
I access the tomcat manager using www.lux-systems.com/manager/html and have uploaded the thymeleaf.war file on this page.
Now i can see /thymeleaf in the application list, but when i click on that link (www.lux-systems.com/thymeleaf) I only see the directory listing instead of the web-page I want to see.
The problem is that I can't find the url to the working web page, and I am wondering why www.lux-systems.com/thymeleaf is only showing the directory listing.

Run JSP from netbeans project in Tomcat Server

Hi I already develop my application using Netbeans IDE.
Now I want to run my application in Tomcat server for actual use. I already copy my project to tomcat/webapps.
But when I tried to run my application:
http://localhost:8081/myAppFolder/
it gives me an error message :The requested resource (/Opportunities-Registration/) is not available.
I should change the url to make it work:
http://localhost:8081/Opportunities-Registration/web/index.jsp
How can I open my application using http://localhost:8081/myAppFolder/ insteand of http://localhost:8081/Opportunities-Registration/web/index.jsp ?
Update:
All my servlet is also become 404 not found
Thank you
SOLVED
Solution:
1. copy .war file which is contained in dist folder of your netbeans project
2. Place your .war file to tomcat/webapps
3. Start your tomcat
4. You are good to go

Tomcat 404 for a folder in webapps

I have a folder called attachments in my webapps folder in my Apache Tomcat directory, in which I need to save some files and images. When I'm giving the local path i.e. in C:/ the files needed are being saved in the correct location.
However I need to load these images from the server at runtime so I'm trying to access the image by the localhost url /attachments/img.png. The image is not being found (404 error).
I tried opening Tomcat's manager to see if attachments is listed. It is there however when I click it a 404 error is being thrown too. Other deployed web applications are being found.
What could be the cause of this?
You cannot just create a folder in $CATALINA_HOME/webapps like this and access it from web browser.
webapps folder is supposed to be home for all web applications with proper J2EE web app like directory structure e.g. WEB-INF/web.xml, WEB-INF/classes, WEB-INF/lib, META-INF etc.
Read more about Web Application Directory Stricture

guacamole vnc viewer - how to?

i have my tomcat server running, i downloaded the guacamole vnc viewer, and i followed the instructions on : http://guacamole.sourceforge.net/
however when i type :http://localhost:8080/guacamole/ i get error message : http status 404 The requested resource () is not available.
anyone using guacamole, plz can you explain the steps to follow? i moved the xml files and the war file as instructed, but there is this folder: "guacamole-src.tar" where do i unzip it to?
what are the steps to follow to make it work?
thx a lot:)
Once you've copied guacamole.war, start the server and check if a folder /guacamole is created at the same place (that means the server has found your web application and is trying to deploy it).
Also, please check your Tomcat logs.
You don't need to use guacamole-src.tar, that file only contains the project sources, but it is not needed.

new File not found in Webcontent. Need to refresh

Hello i have a java backend running on tomcat. java creates a .txt File that is saved locally in the Webcontent Folder. But the file is not found on the client side, altought it exists on the Webserver. After a refresh of my java workspace the file is found. Is there a way to tell tomcat to refresh / redeploy using java?
greetings!
Tomcat does not see your WebContents folder, but a copy create by the Tomcat server connector. Refreshing updates the copy.
What generates the .txt file? A separate program or code embedded in your web application?
There are a number of cases where the app would have to generate the file to be immediately available to the browser. For example, an image upload window. When the server creates the file from within WTP, it will have to also create the file at the published location where Tomcat is expected to pick it up. Open the server properties, tomcat arguments, catalina root parameter to find out where this location is. When the application is deployed this functionality will need to be disabled, of course.

Categories

Resources