Hello. I have recently upgraded to Eclipse Luna. In my previous version of eclipse, I ran Tomcat via the Tomcat "plugin". Using the plugin, it was easy for me to add eclipse java projects to the Tomcat classpath. This saved me from having to create and export jar files to my WEB-INF/lib directories from the eclipse java projects. It also hot-loaded my changes of java and HTML files.
In the latest version of eclipse, Luna, I am trying to configure Tomcat to run in its "Servers" project. I have tried MANY configurations and various instructions to try and add my java projects to the Tomcat server classpath. I can get it to partially work. I can change java files in eclipse and see the changes, but ONLY after tomcat has loaded them from the jar first. Also, I used to be able to hot reload HTML files that are in the java project, now I cant seem to do that.
Here's what I am trying to get back to :
1) Use the java project instead of the jar file in WEB-INF/lib. In the old eclipse using the tomcat plugin I did not even need the jar file in WEB-INF/lib, it just knew to use my java project because it was configured on the tomcat classpath. Now, if the jar file does not exist, it never finds my class files in my eclipse project.
2) When I make a change to a java file, I should be able to immediately see the change take effect (when I refresh the browser for example).
Simply put, I want Tomcat to use my java project ALL the time, and never the jar file.
Has anyone had the same troubles, and if so any advice? Much appreciated.
Same here, I still have the old plugin installed in eclipse Mars since I keep my workspace from version to version of eclipse (my workspace must be 10 years old ;-). Anyway, I do not use the plugin anymore, I use the built-in tomcat interface now and it works pretty well!
To provide the hot reload functionality you have to start tomcat by clicking on "Debug". If you click on "Start", hot reload won't work. This is documented somewhere but it took me a while to find it...
You appear to have an extreme case of IDE dependency. I.e. you have no idea what you are actually doing. Or (more importantly) why the things that worked actually "worked". More or less.
Eclipse is not some program for running Tomcat and it is certainly not some program running webapps. No sane IT shop in the world would be running production web services on Eclipse. Eclipse is a developer's tool and like most developer's tools it is not supposed to be part of the production environment.
I recommend that you shut down Eclipse and pick up a good book on J2EE. Learn what a WAR is and how it's structured. Once you understand that, you can go study the Eclipse documentation on how to use Eclipse to produce WARs. Tomcat works with WARs, just like all good J2EE servers do. There are some "magic tricks" that can be used with Tomcat/Eclipse to work with the intermediate products that WARs are built from but to properly understand how they work you first need to understand how WARs work without all the trickery. And, I should add, that the "Run on Server" plugin for Tomcat that comes with the J2EE edition of Eclipse does pretty horrible things to Tomcat anyway, which is why I don't use it and use the "mongrel" third-party Tomcat plugin instead.
Dumping classes willy-nilly into Tomcat's own classpath is not the way to do it. At best it will make Tomcat -and the webaapp - itself unreliable. At worst you could corrupt the whole system.
Sometimes the only way things ever got fixed is because people became uncomfortable.