How to deploy a website to Tomcat

Recently, someone was learning DreamWeaver to make web pages, and then I thought why not deploy it to Tomcat, then it would not be just a homework, but a website that can be accessed online. My cloud server still has a period of time to expire, and I have a public IP in my hand, which I can use.

Tomcat is an open source server architecture using the Apache system, which can be downloaded directly from the official website. I downloaded Tomcat7, here it should be noted that the downloaded Tomcat version should be matched with the myeclipse version, the latest version of Tomcat may not be recognized in myeclipse. The whole process is basically divided into the following steps:

1. Create a new web project in myeclipse and configure Tomcat to myeclipse;

2. Transfer the web files and materials edited with DreamWeaver to the newly created web project in myeclipse (specifically, the webroot folder);

3. Export and package the web project into a war package in myeclipse . The war package is placed in the webapps folder of Tomcat . After starting Tomcat, the war package will be automatically decompressed and all the web project files in it will be run.

I have installed Tomcat and myeclipse locally before, how to configure Tomcat in myeclipse, I have explained in the previous blog, I will not describe it here. I don't have Tomcat installed on my remote server , so I need to reinstall Tomcat on the remote host . There are still some problems in the middle, here is a brief description of the installation process. Tomcat can be downloaded directly from the official website. The current Tomcat version no longer needs to configure system variables. After decompression, open the bin folder, and double-click the batch file startup.bat to start it directly. However , the operation of Tomcat requires JVM support, so it is necessary to re-install the Java virtual machine on the remote host. The JVM can be downloaded from the official website. The configuration of JVM environment variables is another process that tests patience and care. There is a lot of information on the Internet. If you check more information, although many are written differently, you can understand it by comparing. After installing the JVM, start Tomcat.

At this time, double-clicking startu.bat will cause a flashback problem. If there is a problem with the web file, it is very difficult to debug. Therefore, you need to open the startup.bat file and add pause before the last sentence end , so that you can stop there.

When deploying a web project on Tomcat , one of the main problems I encountered was that when debugging, a warning message appeared, as follows:

org.apache.catalina.util.SessionId GeneratorBase.create SecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [253,251] milliseconds.

At first, I didn't know what was the problem except for the problem. I observed the debugging information and found that all the web files under webapps ( Tomcat has several built-in web project files) were started, and no other warning messages appeared. I tried to visit these webpages again under the browser, and they were all successful, indicating that it was indeed the cause of this warning message. Carefully analyze the warning message and find that there is util. Util is a package in Java, and the reason for this should have nothing to do with the web project file. At the beginning , I was able to access it when I accessed it locally with Tomcat. So there must be something wrong with Tomcat running with the JVM. Find a main reference as follows:

http://www.jb51.net/article/117086.htm  

It has been detailed here that the cause of the problem is that the random number ID of the session process timed out, and two solutions are described in detail. At first, I solved it in the JVM environment and changed it to

securerandom.source=file:/dev/./urandom is not easy to use, the reason may be that the bug has been fixed in jdk1.7 at the end . It should still be changed to file:/dev/urandom. This time I made modifications both in the Tomcat environment and in the JVM environment to make sure that the error will not go wrong again. Start Tomcat again, and finally the warning message no longer appears. The URL link is as follows: http://111.231.92.178:8080/moban1542/

111.231.92.178 is my public IP and 8080 is the default port of Tomcat. Moban1542 is the web project file name. Welcome everyone to visit, the website made by my friend is still beautiful, right ...

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325682586&siteId=291194637