7 Replies Latest reply on Sep 6, 2011 9:24 AM by danydyn

    M2E missed dependencies in WTP project deployment

    danydyn

      Hi,

       

      I am using  Eclipse 3.7 + m2e + m2e-wtp + tomcat6.

      When I make code or resource changes on a web project and start tomcat, sporadically I get ClassNotFound exceptions.

      When I then inspect the tomcat deploy dir, I notice that the WAR file is missing some jars.

      The workaround is to always right-click on the tomcat instance and choose 'clean'. However, this is quite frustrating, since the publish should be incremental and automatic.

       

      I have also came around this issue https://issues.sonatype.org/browse/MECLIPSEWTP-160, might be related.

       

      Any thoughts on this?

       

      Thanks in advance,

       

      Daniel

        • 1. Re: M2E missed dependencies in WTP project deployment
          fbricon

          This looks like the same bug indeed. The problem is it's random, can't be reproduced.  So it's very hard to understand why deployment is failing.

          This happens on resource changes, not pom.xml/dependency changes? Are you using the overlay feature?

           

          If you know a way to reproduce the bug reliably, please let me know.

          • 2. Re: M2E missed dependencies in WTP project deployment
            danydyn

            Dear Fred,

             

            First of all, thanks a lot for your continued support, we really appreciate you work.

            This happens on code changes to the web project, as well as code changes to dependencies.

            We are  not using the overlay feature.

             

            I will let you know of any findings.

             

            Thanks

             

            Daniel

            • 3. Re: M2E missed dependencies in WTP project deployment
              danydyn

              Hi Fred,

               

              Hereby I attach a zip file containing a web project and a jar project dependency.

              To reproduce on a tomcat 6 server and Indigo:

               

              1. Deploy the web project to tomcat 6

              2. Run tomcat in debug mode

              3. While tomcat is in debug mode, add an empty method to TestJar on test-jar project, say test4() method and save.

              4. Restart tomcat in debug (restart, not stop-start).

               

              I then get the error popup:

               

              Publishing failed with multiple errors

              Could not delete C:/Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/test-web/WEB-INF/lib. May be locked by another process.

              Could not delete C:/Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/test-web/WEB-INF. May be locked by another process.

               

              Now, if I look into C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\test-web\WEB-INF, there is no classes directory, and the lib directory is empty.

               

              Now kill tomcat, and right-click on it and choose 'clean'. Everything is back to normal.

               

              Regards,

              Daniel

              • 4. Re: M2E missed dependencies in WTP project deployment
                fbricon

                Have you tried the same thing using stock WTP projects? See if it's a WTP problem or caused by m2e-wtp

                • 5. Re: M2E missed dependencies in WTP project deployment
                  danydyn

                  I have tried it now without the maven Nature, with the same project hierarchy, and the same log4j dependency, the problem doesn't exist in this case.

                  Interesting to note, that in the M2E environment, if I remove the log4j dependency from the test-jar project, the problem is gone.

                  • 6. Re: M2E missed dependencies in WTP project deployment
                    fbricon

                    My guts tell me WTP doesn't handle proper dependency (re)deployment from a classpath library (The maven one in this case).

                    m2e-wtp doesn't do anything with regard to deployment, that's pure WTP's magic.

                    There's probably a way to reproduce the problem using maven-less projects but that probably requires some more head scratching.

                    Was the error popup a symptom in your initial observations (missing jars)?

                     

                    Anyway can you please open a bug for the jar locking issue during redeployment at https://issues.sonatype.org/browse/MECLIPSEWTP?

                    I'll follow up with the WTP team when I can investigate.

                    • 7. Re: M2E missed dependencies in WTP project deployment
                      danydyn

                      The popup occured sporadically in my initial post about the missing jars.

                      Bug opened under https://issues.sonatype.org/browse/MECLIPSEWTP-166

                       

                      Thanks in advance

                       

                      Daniel