Reputation: 47
Running a project on eclipse on Tomcat Server. I have two tomcat versions installed namely 7.0 and 9.0. I created two servers for the project. Stopped both servers. I want to run the project on 9.0. So I started server 9.0 But when I right click 'project-run as-run on server', it automatically starts 7.0 and because 9.0 is already using the port, 7.0 cannot start. Stopped 9.0. And run the project again now with both servers stopped. It automatically starts 7.0 but same error persists even with 9.0 stopped. (I have NOT set "always use this server for the project")
In targetted runtimes, configured the server I want to use for the project and applied the changes.
Run the project again, but the same error persists(BOTH servers in stop mode). How do I reconfig the servers?
Upvotes: 1
Views: 4298
Reputation: 17363
There are a couple of points in your post that don't sound quite right:
I want to run the project on 9.0. So I started server 9.0...
Don't start the server. There is no need since when you select Run As > Run On Server the server will be started automatically.
But when I right click 'project-run as-run on server', it automatically starts 7.0
That will only happen if you have already set Tomcat 7.0 as the default server for your web application. The server for your app must be set to <None>. In Project Explorer select your project, right-click and select Properties, and then select Server. Verify that the selection for Always use the following server when running this project is set to <None>:
As long as your web application has no default server then you can do the following to switch between Tomcat 7 and Tomcat 9:
I verified these instructions using Eclipse Oxygen.3a.
Upvotes: 3