當eclipse不能識別一個web project的時候如果使用run as configurationtomcat 則會拋出以下異常
javalangNoClassDefFoundError: org/apache/catalina/startup/Bootstrap
將java project change to web project:
Once a project is created in Eclipse Europa of a certain type its not the most straight forward process of changing the project to a different type For example you have a project that Eclipse considers to be a Java project but its actually a Web Project you dont get to take advantage of all of the features available for Web Projects such as deploying to a local tomcat server unless Eclipse is aware that its a web project This has to do with the project settings and what eclipse considers the Nature of the project
Sometime we just need to convert our Java Project to Web Project in Eclipse IDE
Here is some of the reasons you may need to convert Java Project to Web Project
) Create / import a wrong project type
) Initial java project migrate to java web project
) Maven create a Java Project (eclipse:eclipse) but we need a web project feature
) Others…?
No mater what reasons we need to convert java project to web project Eclipse does not provide a feature to convert it automatically We have to do it manually
Here is the steps to convert Java Project to Web Project in Eclipse
) Create a empty dynamic web project and click on the project file
) Copy web project facet buildCommand and paste within java project project buildSpec tag
<buildCommand>
<name>mrebuilder</name>
<arguments>
</arguments>
</buildCommand>
) Copy web project facet nature and paste within java project project natures tag
<nature>mrenature</nature>
PS Be careful of the project xml tag make sure you paste into a correct location
) Save it
) Right click on Java Project click properties
) Select Project Facets and click modify project button
) Click Dynamic Web Module and Java check box
Finished
Now your java project has been converted into a web project
From:http://tw.wingwit.com/Article/program/Java/ky/201311/27992.html