2

I have created a Java Dynamic Web Project using Eclipse and selected Tomcat version 5.5.

It works fine under Tomcat version 5.5 and now I wish to switch it to version 7.

I tried to change the tomcat version using project properties as per the snapshots below, and every time I try to run the project under Tomcat 7, I get error "Server Tomcat v7.0 Server at localhost failed to start."

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

tarekahf
  • 738
  • 1
  • 16
  • 42
  • Configuration looks ok. Are both Tomcat servers running at the same time ? – Cristian Meneses Jun 08 '16 at 18:55
  • No, I only start Tomcat 7, and only if the project "SimpleForm" is added to this server, it will fail to start. – tarekahf Jun 08 '16 at 19:04
  • Also, under Project Facets, Dynamic Web Module version is 2.4 and I cannot change it to 3.0. See new snapshot added to the main post above. – tarekahf Jun 08 '16 at 19:10
  • Yes, I also use Eclipse and I've faced this many times. The Dynamic Web facet locks, and the only way to "convert a project" is to actually create a new one, use the proper facet level, and copy/paste all resources into the new project. Changing the web.xml definition won't help changing the facet :( – Cristian Meneses Jun 08 '16 at 19:12
  • Is there any server output in the `Console` view that you can show? – nitind Jun 08 '16 at 19:39
  • After several trial and error steps, I managed to switch from Tomcat 5.5 to Tomcat 7.0 and vise versa. I will shortly add the details as an answer to this question. – tarekahf Jun 08 '16 at 20:06

1 Answers1

1

General idea to switch is to create a new project with the Target Version and then copy the configuration of the relevant sections to the project you want to switch it's Tomcat version.

High level steps:

  • Project Properties / Target Runtime / select the Target runtime
  • Project Properties / Java Build Paths / Edit Apache Tomcat entry and select the run time to add to classpath
  • Project Properties / Project Facets / Select Dynamic Web Module and change the version
  • Web Perspective / Navigator / ".settings" folder / copy the relevant lines from the file "org.eclipse.wst.common.project.facet.core.xml"
  • Project Explorer / go to folder WebContent/WEB-INF and copy relevant parts from web.xml
  • Stop the server, remove and add back the project, and R click on the project under the server, and select Clean Work Directory
  • Run project under the target Tomcat version.

See snapshots below for more details.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

tarekahf
  • 738
  • 1
  • 16
  • 42