how to solve 404 Not found in tomcat7 server? - java

My spring-hibernate project working perfect in my local PC but when i am deploying .jsp files are running fine but controller are not running.
Its gives 404 Not found error.
And my another project will run perfect on server.
same directory structure of both project.
[live server directory structure : /home/fugen/public_html/myproject]
What are the issues? i have spent two days,but still i am facing.
Thank to all in advance.
my project is on cPanel.

Put your jsp file on WEB-INF directory and where you refer this directory refer its directly by jsp file name.
filePath="fileName.jsp"
But if your file in under any directory of WEB-INF put its full path, e.g. WEB-INF/jsp/filename.jsp

Related

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

java.io.filenotfoundexception jboss project localhost

I've been working on web project written in jsp and running on jboss. I have problem after deployment of project. I'm getting an error after hitting localhost:8080/Myapp : java.io.filenotfoundexception Null/easyfile.properties <Can't find easyfile.properties>. I have this file in conf folder in my app directory. For sure I need to properly point to this file or place it somewhere in jboss installation folder but unfortunately I'm new to Java and 've been working with PHP but I've been assigned to client who has home site written as one jsp site with some xml. I need to change their frontend a little bit but I'm trying to set up my local environment without success.
Any help would be great.
Regards Adam

Website directory structure different from eclipse

I am coding a website using java servlets and am using eclipse and tomcat. When I test it using localhost, it works fine. But when I am deploying it on my actual website, the directory structure is messed up and the files are not called properly.
My eclipse directory structure on localhost is
Project Name
.src/packageName/java files
.WebContent/HTML files.
When I make a call from the html files, I use the relative location and tomcat automatically knows to look in the src/packageName folder. For example, from the /WebContent/login.html page makes a onClick call as follows,
. This will automatically trigger the java file in /src/packageName/welcome
When I am deploying it in my actual website, the WebContent/login.html is throwing an error WebContent/welcome file is not found. How do I tell my website to search in /src/packageName folder?
Hmm...have you been sure to package the application as a war for deployment.

HTTP 404 when trying to run a jsp file in eclipse

I get 404 error when trying to run a jsp file eclipse. The confusing thing is the server is running and I can go to localhost:8080 without any problems. I have attached an image of my configuration of server, the jsp file and also the location of the file and the error.
I embed the image cause of the reputation thing so I have linked it
More information:
I am using TOMCAT 7, ECLIPSE KEPLER I have checked the location of helloworld.jsp its in WebContent. I have restarted the server. I have created another dynamic web project nothing works. I get the same problem I can go to localhost:8080 but I cant run an JSP file
SOLVED:
Okay guys its pretty simple to solve this problem. There are two things you need to try.
1)Right click your project and export the war file into C:\ProgramFiles\Tomcat7 folder
If this does not work then.
2) Right click your project and export the war file into some directory and copy the war file into C:\ProgramFiles\Tomcat7 then start the Tomcat server and there you go your JSP file work.
You will probably end up doing step 2 because of stupid windows file permissions
Also thanks for all the help guys really appreciate it.
Make sure that u have put your Jsp files into the WebRoot and check the location and even check your Web.xml and after that run and still if its not working then post your Web.xml here.
Unfortunately, user3135774's solution does not work for me, as am using an Apple computer.
I have read and researched another problem (Error 500: No Output Folder), which I have along with Error 404, carefully, and I think this is related to permission issues.
The JSP file is supposed to be compiled and then deployed under Tomcat/work/Catalina/localhost/YourProjectName. The 404 error message means that there is no files in that directory. Since Eclipse has no write permission to this directory, you have to change the access permissions. After changing the permission to 777, there we have the compiled .java and .class files.
Since you do not have any of them
index.html/index.htm/index.jsp/default.html/default.htm/default.jsp page
To run your jsp page :
In Eclipse:
=>goto Java Resource
=>right click on your jsp page
=>in that select Run as Server.
After applying everythings, it did not work for me to read image file in eclips.
Finally, It works! after that I change deploy path.
Server Locations>Deploy path(Set with "Workspace" of Eclipse)

Deploying sample GWT app to Tomcat

I'm trying to deploy a very basic GWT app to tomcat and running into problems. I took the sample GWT project in eclipse, tested it to make sure it ran, then right clicked and selected google > gwt compile. I then took the war file, zipped it up and renamed it gwtproject.war. I then went into tomcat and slected deploy from the menu, and deployed the project. Yet every time I navigate to localhost:808/GwtProject I get a 404 error.
From what I've gathered reading several posts this looks like its an .xml configuration issue. I have not changed the default xml file nor its location, but do I have to modify it and move it up to the root folder? If so, what exactly do I have to modify in it? This is my first time working with tomcat, and while I read the documentation I'm still at a loss, thanks for the help!
The problem is with this step:
I then took the war file, zipped it up and renamed it gwtproject.war
Do not make the war file zip and rename to war, because that is a war file in a non war file :)
war file has manifest, zip not.
Just take the original war file ( without zipping) and deploy that one.

Categories

Resources