7 Replies Latest reply on Oct 2, 2012 6:02 AM by fbricon

    jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE

    rfinlayson

      Hi,

       

      Eclipse Indigo 3.6 latest 2011/12/29

      m2e latest

      m2e-wtp latest

      jBossTools latest

       

      Maven project is jboss-sar packaging configured with jboss-packaging-maven-plugin.

       

      Import Maven Project:

       

      java.lang.NullPointerException

          at org.jboss.ide.eclipse.as.wtp.core.vcf.ExportedClassFolderReferenceResolver.canResolve(ExportedClassFolderReferenceResolver.java:36)

          at org.eclipse.wst.common.componentcore.resolvers.ReferenceResolverUtil.getResolver(ReferenceResolverUtil.java:43)

          at org.eclipse.wst.common.componentcore.internal.StructureEdit.createVirtualReference(StructureEdit.java:326)

          at org.jboss.ide.eclipse.as.wtp.core.vcf.JBTVirtualComponent.getHardReferences(JBTVirtualComponent.java:106)

          at org.jboss.ide.eclipse.as.wtp.core.vcf.JBTVirtualComponent.getReferences(JBTVirtualComponent.java:76)

          at org.maven.ide.eclipse.wtp.overlay.internal.servers.OverlayResourceChangeListener.hasOverlayChanged(OverlayResourceChangeListener.java:117)

          at org.maven.ide.eclipse.wtp.overlay.internal.servers.OverlayResourceChangeListener.resourceChanged(OverlayResourceChangeListener.java:60)

          at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)

      ...

       

      Seems that "ReferencedComponent.getHandle()" returns null.

       

      Project builds with mvn OK, project import doesn't complete with NPE above, in Eclipse Indigo, m2e and m2e-wtp, with jBoss Tools Maven integration.

       

      Other projects in workspace (EAR, WAR, Dynamic Web Modules) import and build OK and work with m2e-wtp OK.

       

      How can I resolve this?

        • 1. Re: jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE
          fbricon

          Have you installed the JBoss Packaging Maven configurators feature from the JBoss tools update site?

          Do you see the JBoss Sar facet available from any project properties > Project facets (indicates SAR support is installed/started)

           

          Also, can you please create a bug report at https://issues.jboss.org/browse/JBIDE, attaching a test project so we can reproduce the problem

          • 2. Re: jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE
            rob.stryker

            Judging by the stack trace, he has a reference with a null url.  This almost always violates spec, unless the reference is consumed rather than used. Either way, it's obvious that ExportedClassFolderReferenceResolver should at least guard against the possibility of a null reference url.

             

            I'm committing a simple guard check. The logic here is that if the url is null, it cannot possibly be an ExportedClassFolderReferenceResolver reference, since all such references have a url beginning with module:/org.jboss.ide.eclipse.as.wtp.core.vcf.exportedClassFolders

             

            A null reference url cannot be an ExportedClassFolderReferenceResolver. The null check will ensure this method returns false.

            • 3. Re: jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE
              chmanosh

              Hi,

               

              I also have the same issue, I could not use maven SAR project inside eclipse (Tried Helios, indigo and even Juno with latest jboss tools dev build). Infact I have to close SAR project in order to add any other web/esb projects to JBoss EAP. Has this ever been resolved?

               

              I am also attaching the maven code to recreate the issue. One thing I observed is maven jboss packaging m2e plugin is not generating the eclipse files correctly for SAR. Contents of the "org.eclipse.wst.common.component", in .setting folder, is missing an attribute 'handle'(in this case it should be handle="module:/resource/test-common/test-common"). With out the "handle" attribute, i could not open "deployment Assembly" page in properties (right click on sar project -> properties -> Deployment Assembly). Once I have the handle defined i could open Deployment Assembly page and can add SAR project shows up in the list to add to the server.

               

              Here is the .settings/"org.eclipse.wst.common.component" file contents

              <?xml version="1.0" encoding="UTF-8"?>

              <project-modules id="moduleCoreId" project-version="1.5.0">

                  <wb-module deploy-name="test-sar">

                      <wb-resource deploy-path="/" source-path="/src/main/resources"/>

                      <wb-resource deploy-path="/" source-path="/src/main/java"/>

                      <wb-resource deploy-path="/" source-path="/src/test/java"/>

                      <dependent-module archiveName="test-common-1.0-SNAPSHOT.jar" deploy-path="/lib">

                          <dependency-type>uses</dependency-type>

                      </dependent-module>

                      <property name="java-output-path" value="target/classes"/>

                  </wb-module>

              </project-modules>

               

               

              Can someone please take a look into it. Please let me know if you need any more details.

              • 4. Re: jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE
                fbricon

                Thanks for the test project, now I can reproduce the problem.

                Please open a bug on JBT's maven component https://issues.jboss.org/browse/JBIDE/component/12312576,  while I'm looking into it.

                • 5. Re: jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE
                  fbricon

                  Until this is fixed (JBT 4.0.0.Beta1), here's a workaround for you :

                   

                  • right click on the sar dependency
                  • click on Project Facets, convert to Faceted form
                  • add the Utility Facet.
                  • repeat for all your sar dependencies
                  • in the navigator view, open <sar-project>/.settings/org.eclipse.wst.common.component and remove all <dependent-module>s
                  • update the maven configuration of <sar-project>
                  • 6. Re: jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE
                    dgolovin

                    Rob, it seems the error still in the same, you added check s != null at line 37, but actual problem is onle line above, because reference to non-faceted module has null handler. So line 36 still sthows NullPointerException.

                    • 7. Re: jboss-packaging-maven-plugin jboss-sar + m2e + JBT = NPE
                      fbricon

                      A fixed jboss-sar configurator is available on the nightly build update site : http://download.jboss.org/jbosstools/builds/staging/jbosstools-4.0_trunk.component--maven/all/

                      It requires m2e-wtp 0.16.0