I developed dynamic web page in eclipse.I also configured apache tomcat in eclipse juno.In eclipse it run on server fine.I don't know how to deploy the dynamic web page in other system tomcat server.My folder structure.
Tomcat 7.0
-webapps
-Myproject-Folder
-WEB-INF
-classes
-lib
-web.xml
create a folder in your tomcat webapps folder
Then create another folder WEB-INF and index.html
Then in WEB-INF folder create three other folders classes,src,lib and web.xml
In classes folder keep all the .class files.
If you want to keep the source files then these should be placed in the src folder.
In the lib folder keep all the necessary jar files like activation.jar,mail.jar(if you are using java mail Api).
Now map correctly in web.xml
Now if your web.xml is correctly mapped then open a browser and type
http://localhost:8080/your_folder_name
8080 is the default port number.
just copy the "Myproject-Folder" to the "webapps" folder of any tomcat
Depending on how you want to deploy it, you can just copy the folder under "webapps" of your current Tomcat or package it into .war and put that under webapps folder of the target Tomcat.
Related
I have created a Microsoft azure web app and configured java version 8 and tomcat latest available. As per their documentation , I have uploaded my WAR file to d:\home\site\wwwroot\webapps\ROOT .
Screenshot of MY Directory
wen iam trying to access, giving me a 404 error.Please help me to fix this
as documentation say :
you can upload your application by placing your WAR in the webapps folder.
in tomcat's webapp folder you copy war files, tomcat detects the presence of one of those files and unzip it to a folder corresponding to the name you chose for your file, so if you copy toto.war to
$TOMCAT_HOME/webapps/
after tomcat deployed your war file the folder will look like
$TOMCAT_HOME/webapps/toto.war
$TOMCAT_HOME/webapps/toto (folder being the unzipped version of your file)
ROOT folder is just a special case of that for the webapplication that is served without using a context.
I currently have a working servlet created in Eclipse. When running it from the Tomcat plugin, everything works, and my app shows up at localhost:8080/project_name/. However, when I package the project into a .war file and place it in the /webapps directory of Tomcat and start the server, the servlet cannot be accessed. In Terminal, I can see Tomcat loading my project, and a temporary folder of the unarchived project is also created in /webapps. However, I simply cannot access my servlet.
Note:
I'm using Tomcat 7 and I don't have a web.xml file in my project.
How are you creating the war file? Check if your war files contain jar files under WEB-INF/lib folder and if the class files are not missing. You can easily verify it under tomcat/webapps/[project name] folder.
when I run my dynamic web project from eclipse it gets deployed to wtpwebapps. However I want to deploy a war file to tomcat so when I checked here in SO this came up
How to deploy a war file in Tomcat 7
It says I have to deploy to webapps folder in tomcat.
Can anybody please explain me the details between wtpwebapps folder and webapps folder in tomcat and also if I can deploy war files to wtwebpapps folder instead of webapps folder.
wtpwebapps is an eclipse-specific folder created when you run a dynamic web project on Tomcat within eclipse.
Webapps directory is within the Tomcat home and it's where you copy over your WAR files manually.
Recently, i've struggled with webapp strange behavior while debugging in Eclipse. I've noticed that it was double deployed.
My setup was:
web module with context path that differs from document base;
enabled autoDeploy in server.xml;
and deploy was set into webapps directory.
When checking tomcat-manager i've noticed that this webapp was deployed once with its context path name and once with document base name.
Here is what the documentation states (All credits goes to octopus, Tomcat docs):
If you want to deploy a WAR file or a directory using a context path that is not related to the base file name then one of the following options must be used to prevent double-deployment:
Disable autoDeploy and deployOnStartup and define all Contexts in server.xml
Locate the WAR and/or directory outside of the Host's appBase and use a context.xml file with a docBase attribute to define it.
And, i believe it's the main reason to use wtpwebapps instead of webapps for Tomcat with Eclipse.
I have created a web project which includes .jsp and Java beans pages. When I run this project with eclipse, using tomcat it works perfectly fine, I deployed the project successfully, the program runs and I receive a web page in the browser.
But when I try to deploy war file in webapps folder of tomcat6 and run on browser it gives error –
This is the error I see on the page:
HTTP status 404. Description: the requested resource is not available.
What might be the problem?
Check if you have file index.html/index.jsp in your war if it is not there then you have to either need to change the name of file that is opened in context "/" or you have to make changes in list.
To create WAR file using eclipse, follow the option File -> export -> Web > War File and finally select project and destination folder. To deploy war file in Tomcat, place the war file in Tomcat Installation Directory > webapps directory and start the Tomcat.
Hope this is useful for you !!
Can anyone guide me how to get Servlets working in Apache Tomcat server? I can run the Servlets from Netbeans without problems, but I don't know where to put the class files in Tomcat.
In tomcat:
class files must be in TOMCAT_DIR/webapps/<yourAppName>/WEB-INF/classes
jar files must be in TOMCAT_DIR/webapps/<yourAppName>/WEB-INF/lib
(and if course you'll need web.xml in WEB-INF)
They go in Tomcat/webapps folder. There are several ways to deploy a JSP/Servlet webapplication on Tomcat. They are all described in Tomcat Web Application Deployment HOW-TO.
If you already have developed the webapplication in Netbeans, then Netbeans should already have build a WAR file of it in the /dist folder. You just need to drop the WAR file in Tomcat/webapps folder and Tomcat will automatically deploy it during startup (or even while running, this is called hotdeploy).
If you want to develop without an IDE and/or don't want to create a WAR, then you just need to put a folder representing the context name in Tomcat/webapps, e.g. Tomcat/webapps/contextname. It will become the public web content. You can drop all JSP files and other static files in there. Then, for classes you need to create a Tomcat/webapps/contextname/WEB-INF/classes folder. There should go the package structure.