0

This is a Windows 7 development environment where Tomcat 7 is set to autostart in c:\tomcat7 folder. That does work fine but I want to test my Java (.JSP) code right inside Eclipse Neon interface. So I configure Tomcat inside Eclipse by pointing to c:\tomcat7 folder but I get the port 8080 already in use error.

I know what's happening: Tomcat is trying to start but it is already running. So I duplicated the c:\tomcat7 folder to a c:\tomcat7_for_eclipse folder, pointed Eclipse to that, then changed the port to 8081 via Eclipse but I now get an error:

Tomcat couldn't start;

and doing that actually stops the port 8080 instance of Tomcat.

There must be a simpler way to quickly deploy to the actual Tomcat to test applications or to do the port route as I tried above?

I am very new to Java, Eclipse, and Tomcat. So please bear with me: I have looked at online solutions but nothing helping so far.

Thanks!

Vaibhav Bajaj
  • 1,934
  • 16
  • 29
IrfanClemson
  • 1,699
  • 6
  • 33
  • 52
  • I also use eclipse and tomcat, and I personally use a standalone tomcat application. I advise against using tomcat as a windows service, you should be able to disable the autostart feature in the list of window services. To be able to launch tomcat via eclipse, just download the [latest tomcat archive (.zip)](http://tomcat.apache.org/download-90.cgi), and configure eclipse to use that one. – zoom Aug 03 '16 at 20:45
  • Thanks. But I do need to keep Tomcat running as a Service while Eclipse can either quickly use that instance or launch another instance. – IrfanClemson Aug 03 '16 at 20:46
  • 1
    You should be able to point Eclipse at your current Tomcat installation and deploy a WAR file there. https://www.mulesoft.com/tcat/tomcat-eclipse – OneCricketeer Aug 03 '16 at 20:47
  • Additionally, I have had success with this plugin. https://marketplace.eclipse.org/content/eclipse-tomcat-plugin – OneCricketeer Aug 03 '16 at 20:48
  • Thanks. Yes, but that would require to deploy the WAR file after every little code change and then look inside an external browser. – IrfanClemson Aug 03 '16 at 20:48
  • Right... You have to compile the Java code regardless. Static resources like JS, CSS, and HTML, you don't need to do that, though – OneCricketeer Aug 03 '16 at 20:49
  • cricket_007: will the Tomcat plugin make this work like I am trying to? – IrfanClemson Aug 03 '16 at 20:51
  • @Meengla My project uses Velocity templates instead of JSP, but it seems to be running okay on Jersey JAX-WS – OneCricketeer Aug 03 '16 at 21:14
  • may be this can help you to ensure you have setup tomcat properly on eclipse http://stackoverflow.com/questions/8046871/how-to-add-tomcat-server-in-eclipse – JavaHopper Aug 03 '16 at 21:15
  • Hi all, before I could try JavaHopper solution I think I have found a solution and posted that as an Answer. I will let this page know if there are issues with my Answer. Thanks again! – IrfanClemson Aug 03 '16 at 21:26

1 Answers1

0

I think I got the two instances of Tomcat working simultaneously. Here is what I ended up doing:

1) Left the original instance of Tomcat on port 8080 as such

2) Inside Eclipse, added a new Server and this time downloaded to a c:\tomcat7_for_eclipse2 folder.

3) Inside Eclipse, changed the ports to 8081 etc for the newly downloaded instance of Tomcat

This seems to be working fine: Both the regular instance of Tomcat continues to run while I can now launch the new instance of Tomcat right from inside Eclipse and quickly view my .JSP file's dynamic code.

This is sort of like what Microsoft Visual Studio does. I know it's not some 'best practices' but it keeps my development environment simpler.

Thanks to all for their help!

IrfanClemson
  • 1,699
  • 6
  • 33
  • 52