13

I've got a Java Web Project which I'm deploying to a Tomcat embedded in Eclipse's Servers Plugin, alas, when I navigate to the location of that webapp after publishing/starting the server, the .class files are all missing. I can navigate as far as ProjectName\WEB-INF\classes\path\to\packages\ -> All packages are empty.

Any Idea how to solve this problem?

Edit

Build Automatically is checked and it compiles just fine for another web project I've just included, just not for the one specified

Edit 2

Reinstalled Eclipse (because why not) - nothing's changed, works for Project #2, doesn't work for Project #1. Not even the path to the packages is existant now. The content of the src folder (that's supposed to be moved to WEB-INF/classes) isn't there at all - but the resources (I've got a resources folder with the same deployment assembly command) are.

Dennis Röttger
  • 1,975
  • 6
  • 32
  • 51
  • Yes, figure out how to tell Eclipse to write the compiled .class files to your WEB-INF/classes directory. – duffymo Jul 11 '12 at 11:52
  • This has worked before, this issue has just arisen today without any input on my part (I believe). The deployment assembly in Eclipse is set accordingly. – Dennis Röttger Jul 11 '12 at 11:54
  • Apparently not. If it was, you'd have .class files. – duffymo Jul 11 '12 at 11:58
  • If only that were the case - I've got a Deployment Assembly mapping from "src" to "WEB-INF/classes", which was also there as default (and worked less than 24 hours ago for some reason that's completely eluding me). – Dennis Röttger Jul 11 '12 at 12:01
  • Something changed in the last 24 hours. You'd make progress faster if you'd stop insisting that everything is fine and accept the fact that you don't have a valid WAR file. – duffymo Jul 11 '12 at 12:04
  • I'd be the first to admit that I've done something terribly wrong if only it made me progress, alas I don't see what - it appears as though Eclipse isn't compiling my java files at all. Just a few minutes ago I pondered why my WebService isn't updating after editing the Implementation file - I was only able to access the "Old" version from yesterday. Then I cleaned my project and now no class files are available whatsoever (so Cleaning deleted the old class files without compiling anew) - now if only I could get assistance as to where to look, I can assure you my Deployment Assembly is fine. – Dennis Röttger Jul 11 '12 at 12:09
  • I use IntelliJ, so I can't help you much with Eclipse. It seems that Eclipse doesn't know to re-make the project before creating the deployment assembly. Perhaps that's a hint - there's a checkbox that needs to be ticked off or something. – duffymo Jul 11 '12 at 12:11
  • 4
    @duffymo : if you don't know Eclipse why are you even commenting here? – Konstantin Komissarchik Jul 11 '12 at 12:20
  • 1
    Knew Eclipse before I started using IntelliJ; the details escape me. Do you have an answer you'd like to share, Konstantin? – duffymo Jul 11 '12 at 12:21

2 Answers2

20

A few steps to perform to restore sanity...

  1. Refresh your project. It is possible that something was modified on the file system external to Eclipse.

  2. Kick of Project -> Clean.

  3. Now look at your project (not the deployed location) on the file system. Do you see the expected files in the /bin directory (or whatever you may have changed class output directory to)?

  4. Let's now try exporting a war using the wizard. File -> Export -> Web -> WAR or something like that. Check the WAR contents. Are you .class files there?

  5. If everything is good so far, there is nothing wrong with your project. The Tomcat server adapter just got confused.

  6. In the Servers view... Make sure Tomcat is running. Next right click on Tomcat and select add/remove projects. Remove your project. Confirm that your web app is no longer accessible.

  7. Now re-add your project via add/remove projects or invoke one of the run as actions.

The above should reset Tomcat server adapter and hopefully things should work as expected.

Konstantin Komissarchik
  • 28,879
  • 6
  • 61
  • 61
  • Thanks for your answer! In Step 4, when I export to WAR, I don't see the classes either (path to packages is existant, .class files aren't). I performed the other steps accordingly. – Dennis Röttger Jul 11 '12 at 12:33
  • 2
    That indicates that something is broken in your project. Do you see anything in the Problems View? What about Error Log view? – Konstantin Komissarchik Jul 11 '12 at 12:37
  • 1
    Indeed! The Problems-View has shown that a required libary is missing. Unfortunately it didn't occur to me to check this view as I work with Visual Studio which is a bit more "in-your-face" about errors. (I started programming in Java a few days ago) Thanks for the pointer! – Dennis Röttger Jul 11 '12 at 12:59
  • 1
    After building your project check /build folder (Not the deployed location), if it contains your compiled .class files or not? You can check that using **Navigator** view. – Parth Apr 01 '15 at 05:37
0

Check if you had deleted or moved your external JARs associated with the project on your IDE. I had moved it and ran into the same issue.