1 2 3 Previous Next 33 Replies Latest reply on Dec 8, 2010 5:30 PM by henk53

    WEB-INF/lib remains empty after deployment

    henk53

      Hi,

       

      I'm using Eclipse 3.5.2 with WTP and the JBoss AS tools 3.1cr2 server adapter with an EAR project that consists out of an EJB module and a web module. The web module has a bunch of jar files in [web module project root]/libraries/somedir, where "somedir" refers to several directories like apache-commons, jsf (for the richfaces libs, not jsf itself of course) etc.

       

      The jar files in that directory are added to the .classpath of that project and in project -> Java EE Module Dependencies -> Web Libraries, these are marked for being deployed to WEB-INF/lib. In .classpath, entries like this are added:

       

      <classpathentry kind="lib" path="libraries/apache-commons/commons-beanutils-1.7.0.jar" sourcepath="libraries/apache-commons/commons-beanutils-src.jar">
           <attributes>
                <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
           </attributes>
      </classpathentry>
      

       

      After deployment, these jar files are normally deployed to WEB-INF/lib directory of the war inside the ear. Until today...

       

      I did a new checkout of the project from SVN, and after publishing it to JBoss AS, the WEB-INF/lib remained empty. I did all the usual stuff, removing and adding the deployment, refreshing the workspace, adding and removing again, closing and opening Eclipse and doing all the previous stuff again. Republishing, cleaning, changing the deployment location from .metadata to the JBoss internal deployment folder, etc. Nothing helped... WEB-INF/lib would remain as empty as a beer closet in premises where painters have been at work. Or actually, even more empty since the entire /lib dir wasn't even there.

       

      A few hours later after dinner, I decided to try it again by first creating a trivial test project to see if the libs would be deployed for that one. They did. So, I deployed my original project again preparing my self for comparing all the config files of the test and original project, but low and behold, the libs were suddenly actually there!

       

      A prior suspicious change in the project is that the name of the web module was recently changed. However, most of my other co-workers who did a new check out from SVN after the name change had no problem at all with the libs not being deployed. Another suspicious thing is that unchecking the libraries in project -> Java EE Module Dependencies -> Web Libraries seems to have no effect on .classpath anymore (it normally removed the <attributes> tag beneath <classpathentry>). Maybe it changes some stuff in .metadata, but apparently not in the project.

       

      Has anyone else encountered an empty or missing WEB-INF/lib?

       

      This problem had cost me several hours with the worst of it that I have absolutely no idea what eventually fixed it and thus no idea what to do if it happens again. Any help or tips would be greatly appreciated.

        • 1. Re: WEB-INF/lib remains empty after deployment
          snjeza

          You may be faced the problem described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=279360 and https://jira.jboss.org/jira/browse/JBIDE-4817.

           

          A workaround for that problem is to change the Java output folder, open, close and redeploy the project



          • 2. Re: WEB-INF/lib remains empty after deployment
            henk53

            snjeza wrote:

             

            You may be faced the problem described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=279360 and https://jira.jboss.org/jira/browse/JBIDE-4817.

             

            A workaround for that problem is to change the Java output folder, open, close and redeploy the project

             

            Thanks a bunch for the pointer!

             

            Especially the bug at eclipse.org seems highly relevant to my problem. I'm pretty sure I didn't changed the Java output folder last time, although I had been fiddling with a lot of stuff. It will be the first thing I'll try again though should the problem resurface. The JBoss jira issue is a little bit cluttered with unrelated errors, so it's harder to see whether it applies.

             

            It suddenly hit me that in my previous post I left out one other important recent change I did: I upgraded to Eclipse 3.5.2 from 3.5.1 and from JBoss AS tools 3.1cr1 to 3.1cr2. Initially I didn't had the problem. Right after upgrading everything worked fine, but the checkout I did was the first checkout after the upgrade and then the problem manifested itself. Maybe this is handy to know for someone.

            • 3. Re: WEB-INF/lib remains empty after deployment
              henk53

              For anyone still interested in this, I keep having this problem but found a simpler workaround. If WTP/JBoss Tools fails to deploy WEB-INF/lib's content, just closing en re-opening the affected project and then executing a Clean on the JBoss Tools Runtime Server seems to solve the problem temporarily.

               

              I also encountered another problem, quite like this.

               

              From SVN I had some new incoming libraries. I performed a clean again in the hope that the deployer would pick up the new libs, but unfortunately it did not. I did deploy everything that was supposed to go in WEB-INF/lib and had been there before, but just not the new ones. I doubly checked that clean actually removed the old deployment and copied the jar files fresh to WEB-INF/lib. This indeed happened, but somehow, somewhere, WTP remembers which jars have been recently added to the project and it just skips those.

               

              Luckily, closing and re-opening the project and doing the clean solved the problem.

               

              I love Eclipse, I love WTP & JBoss Tools but at times it all can be a little maddening...

              • 4. Re: WEB-INF/lib remains empty after deployment
                dgolovin

                Does "Full Publish" help you to fix problem?

                 

                full-publish.png

                • 5. Re: WEB-INF/lib remains empty after deployment
                  henk53

                  Denis Golovin wrote:

                   

                  Does "Full Publish" help you to fix problem?

                   

                   

                  I don't think I have tried that specific command.

                   

                  I did try Publish directly on the JBoss Tools Runtime Server. If anything, I got the impression that this might even be causing the problem. Namely, as a precaution I executed that command a couple of times (instead of Clean) and in most if not all those cases the jar files wouldn't be deployed.

                  • 6. Re: WEB-INF/lib remains empty after deployment
                    dgolovin

                    "Publish" on server instance in server view always does Incremental Publishing, so if no changes have happened before in projects it it just do nothing. Full Publish nuke everything and do it from scratch.

                    • 7. Re: WEB-INF/lib remains empty after deployment
                      henk53

                      Denis Golovin wrote:

                       

                      "Publish" on server instance in server view always does Incremental Publishing, so if no changes have happened before in projects it it just do nothing. Full Publish nuke everything and do it from scratch.

                       

                      I see, but nuking everything and publishing from scratch, isn't that exactly what Clean does too? Intuitively it would seem to me that Clean does a full publish for all resources added to the server, right?

                      • 8. Re: WEB-INF/lib remains empty after deployment
                        dgolovin

                        I took Server->Clean for Project->Clean and it looks you're right they are the same. Which means we have to rename "Full Publish" in module context menu to "Clean..." to avoid using different names for the same operations.

                        • 9. Re: WEB-INF/lib remains empty after deployment
                          rob.stryker

                          If opening and closing the project fixes the situation, this would most-likely indicate a bug in upsteram's J2EEDeployableFactory and JEEDeployableFactory.   It would seem odd to me that the factory would return resources only after an open or close of the project, and otherwise would misplace them.

                           

                          If you have any small example test project that replicates this i'd be glad to test it.

                          • 10. Re: WEB-INF/lib remains empty after deployment
                            henk53

                            Rob Stryker wrote:

                             

                            If opening and closing the project fixes the situation, this would most-likely indicate a bug in upsteram's J2EEDeployableFactory and JEEDeployableFactory.

                             

                            As Sneza mentioned, it's probably this thing: https://bugs.eclipse.org/bugs/show_bug.cgi?id=279360 It would supposedly be fixed in WTP 3.2, but an interesting entry was added just today:

                             

                            It was not working for deploy because we never computed the variable and
                            external jar entries for a single root project.  However, I recently addressed
                            in issue with this in bug 306534 and now variables and external jars will be
                            returned as child modules as long as they qualify.  However, it is up to server
                            tools to get these child modules and process them properly.  Not sure if this
                            is happening in all cases.  Classpath containers, which get added into the
                            classpath file with the dependency attribute, are now checked in the single
                            root util.  If found it now returns false.

                             

                            Rob Stryker wrote:

                             

                            If you have any small example test project that replicates this i'd be glad to test it.

                             

                            At the moment I don't have such an example really. I tried to create a small test project, but here everything just worked and it 'seemed' (I'm not 100% sure) that publishing this to the server was also an impulse for the missing libs in the other project to be deployed again. As soon as I have something I will surely attach it here. Thanks for the offer to test it.

                            • 11. Re: WEB-INF/lib remains empty after deployment
                              henk53

                              As I just had it happening again, these are the steps I did this morning:

                               

                              • Started up Eclipse fresh (I usually let my computer sleep and don't restart Eclipse)
                              • Make a change to a .jsp file and .java file
                              • As part of my automatic ritual, executed Clean... on the Server runtime (the one that publishes from scratch)
                              • Started up the server in Debug

                               

                              As it appeared, all my files where there, but WEB-INF/lib was completely empty.

                               

                              I then did the following:

                               

                              • Closed the three projects that make up my EAR app (the ear, and the ejb + web modules)
                              • Re-opened those same three projects again
                              • Executed Clean... on the Server runtime

                               

                              Upon inspecting the deployment, all the files in WEB-INF/lib were back again.

                               

                              The workaround is thus pretty straightforward, but it can be very frustrating if you don't know this exact workaround.

                              • 12. Re: WEB-INF/lib remains empty after deployment
                                rob.stryker

                                >Which means we have to rename "Full Publish" in module context menu to "Clean..." to avoid using different names for the same operations.

                                 

                                I chose to use "Full Publish" because there are four publish constants in IServer: PUBLISH_INCREMENTAL, PUBLISH_FULL, PUBLISH_AUTO, and PUBLISH_CLEAN.

                                 

                                Now really an auto publish should be equivilent to incremental, and a clean publish should be similar to full. I guess we can rename it to clean if desired.

                                • 13. Re: WEB-INF/lib remains empty after deployment
                                  rob.stryker

                                  I still find this bug very confusing. Projects do not often change from single root to non-single root. if the project is singleroot, it will return those modules at all times, after a clean publish and after a restart. It will not publish them once, then ignore them the next.

                                   

                                  Because of this I am very curious what the root cause is. it's very hard for me to imagine when looking throught he code. Have you tried using our GA? There was this bug below which applied to a web project inside an ear project back in CR2. It's possible this issue is related to that, though this time occurring on the web project and it's child libs.

                                   

                                  This seems very very familiar to https://jira.jboss.org/jira/browse/JBIDE-6024

                                  • 14. Re: WEB-INF/lib remains empty after deployment
                                    henk53

                                    This seems very very familiar to https://jira.jboss.org/jira/browse/JBIDE-6024

                                     

                                    Indeed it does. However, we did just encounter exactly the same problem deploying to a Tomcat instance using the WTP supplied server adapter. We added libs to our project, outside of WEB-INF/lib. Added them to the .classpath and marked them as web library dependencies.

                                     

                                    After a redeploy, the new libs weren't deployed, but the old ones were. The simple close, open, redeploy cycle didn't help here. Eventually, after much trial and error suddenly the following seemed to fix the problem: close, open, remove deployment, clean, add deployment.

                                    1 2 3 Previous Next