Eclipse creates a dynamic web project

Source: Internet
Author: User
Preface

Since we used to create a web project on myeclipse in the past, we downloaded an eclipse for Java EE today (the version should be later than 3.6, and it has the deployment Assembly function to directly add the Lib package, in previous versions, you need to change the configuration file and configure it on the Internet) and install the maven plug-in. Now you are using this tool. I want to try it.

The body is now being downloaded from eclipse3.6 online, so it cannot be replaced by newer versions of machines. Decompress the package, open eclipse, and create a dynamic web project (Click Create a project, and select Dynamic Web project under the Web). The directory structure is the same as that on myeclipse, for us, we need to pay attention to the SRC and webcontext directories under Java source. After I create a test project and start Tomcat, an error occurs.
Logging ing application listener of class org. springframework. Web. Context. contextloaderlistener: I found that my project is not in the Tomcat webapps directory. After Google found that Tomcat configuration needs to be changed ------------------------------------------------------------------------------------------------

Symptoms:

Tomcat can be started normally in eclipse, but http: // localhost: 8080/cannot be accessed in the browser, and Error 404 is reported. Other project pages cannot be accessed.

Close tomcat in eclipse and double-click STARTUP. bat under the tomcat installation directory to manually start the Tomcat server. Access htt: // localhost: 8080/to access the Tomcat Management page.

Symptom cause:

Eclipse redirects the Tomcat project release directory (webapp In the Tomcat directory), so you will find that your project file cannot be found in the webapp directory under the tomcat installation directory.

Solution:

Reconfigure the Tomcat server:

On the server page in eclipse, double-click the Tomcat service and you will see the configuration page:

You can see that the use workspace metadata (does not modify Tomcat installion) is selected in the red circle)

If a project is deployed in Tomcat, the options in the red circle will be grayed out and cannot be modified. to modify the options, you must first remove all deployed services in Tomcat.

Right-click the Tomcat server and choose add and remove. In the displayed dialog box, remove the deployed project. After you have removed the settings, you can see that the options panel is editable.

Select use tomcat installation (Task Control of Tomcat installation) to select the tomcat installation directory as the release directory of the project.

Then, in the next four lines, do you see "deploy path? The default value is "wtpwebapps". Change it to "webapps", that is, tomcat.

The name of the folder where the publish project is located. After modification, close the page and save the configuration. In this way, the project is deployed to the webapp under the tomcat installation directory.

Restart the Tomcat server and access http: // localhost: 8080, And the deployed project can be accessed normally.

Bytes ------------------------------------------------------------------------------------

Reprinted: http://blog.csdn.net/wqjsir/article/details/7169838

After the configuration is modified, the project in the webapps directory of Tomcat does not have a lib package. Therefore, right-click the properties -- deployment Assembly function on the project and find that the Lib package is not added to the package structure, click "add", for example:


Select "Java build path entried", add the corresponding lib package, and start Tomcat again to find the following error:

Java. Lang. noclassdeffounderror: ORG/aspectj/Weaver/bcexception

Since I created struts2, hibernate3.6, and spring3.1 manually, I only referenced the relevant jar packages in the release package, but spring3.1 no longer packages the dependent third-party jar packages.

After many explorations, in addition to introducing org. springframework. aop-3.1.1.RELEASE.jar under the Spring framework Dist directory,

You also need to download the third-party dependency package by yourself:

Aspectjrt. Jar (http://www.java2s.com/Code/Jar/a/Downloadaspectjrtjar.htm)

Aspectjweaver. Jar (http://www.java2s.com/Code/Jar/a/Downloadaspectjweaverjar.htm)

And aopalliance. Jar (the latest version is 1.0, release /)

After the preceding jar package is introduced, you can program AOP Using @ aspect and other annotation methods. Similarly, you can right-click the properties -- deployment Assembly function on the project, the LIB package is not added to the package structure;


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.