12 Replies Latest reply on Jan 23, 2015 5:21 AM by xcoulon

    Problem adding JPA facet to maven project

    daxxy

      IMPORTANT NOTE: I can only access the internet with IE.  Not with eclipse. Not with any git client.  If you answer, PLEASE PLEASE PLEASE do not .suggest anything that involves the eclipse marketplace or any update or install sites.  (can you tell I've been down that path before. :-) ). Thanks in advance

       

      If this is not a JBDS issue, please point me in the right direction.

       

      I just downloaded JBDS 7.1.0 GA so I would have the latest version.

      I imported a simple maven project with only hibernate core as a dependency.  Once it's imported I want to add JPA 2.0 facet.

       

      Attempt #1:

      I went into Project Facets and select Java facet 1.6 (it was 1.4 by default) and JPA 2.0.  I clicked on Targeted Runtimes tab and select jboss-eap 6.1 runtime.  I clicked on "further configuration available" link and it took me to the JPA configuration page where I selected Hibernate 2.0 for platform and under JPA Implementation selected Library provided by targeted runtime.  Failed with NPE, details from .log below:

       

      !ENTRY org.eclipse.wst.common.project.facet.core 4 0 2014-01-12 10:15:19.598

      !MESSAGE Failed while installing JPA 2.0.

      !STACK 0

      java.lang.NullPointerException

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.defaultResourceLocation(JpaFacetInstallDelegate.java:143)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createPersistenceXml(JpaFacetInstallDelegate.java:113)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createProjectXml(JpaFacetInstallDelegate.java:103)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.execute_(JpaFacetInstallDelegate.java:62)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetActionDelegate.execute(JpaFacetActionDelegate.java:35)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$5.run(FacetedProject.java:1099)

              at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChanges(FacetedProject.java:1109)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy.commitChanges(FacetedProjectWorkingCopy.java:2020)

              at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$4.run(FacetsPropertyPage.java:232)

              at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

              at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$5.run(FacetsPropertyPage.java:246)

              at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

       

       

      Attempt 2:

      Used Hibernate 4.3.0.Final as maven dependency which includes JPA 2.1 implementation.  I told JPA Facet to use maven dependencies which are in class path.  Got the same result.

       

      !ENTRY org.eclipse.wst.common.project.facet.core 4 0 2014-01-12 10:29:41.860

      !MESSAGE Failed while installing JPA 2.1.

      !STACK 0

      java.lang.NullPointerException

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.defaultResourceLocation(JpaFacetInstallDelegate.java:143)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createPersistenceXml(JpaFacetInstallDelegate.java:113)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createProjectXml(JpaFacetInstallDelegate.java:103)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.execute_(JpaFacetInstallDelegate.java:62)

              at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetActionDelegate.execute(JpaFacetActionDelegate.java:35)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$5.run(FacetedProject.java:1099)

              at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChanges(FacetedProject.java:1109)

              at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy.commitChanges(FacetedProjectWorkingCopy.java:2020)

              at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$4.run(FacetsPropertyPage.java:232)

              at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

              at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$5.run(FacetsPropertyPage.java:246)

              at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

        • 1. Re: Problem adding JPA facet to maven project
          dgolovin

          I cannot replicate this with fresh just downloaded JDBS 7.1.0.GA. Stacktrace doesn't match with JPA included into JBDS 7.1.0.GA which is

           

                Dali Java Persistence Tools - JPA Support3.3.1.v201308261920-7V7_5FC7sRe5TdgZcI05646dorg.eclipse.jpt.jpa.feature.feature.groupEclipse Web Tools Platform

           

          the source of JpaFacetInstallDelegate is here and it has only 125 lines.

           

          Are you sure you are on JBDS 7.1.0.GA?

          • 2. Re: Problem adding JPA facet to maven project
            daxxy

            I do have 2 installations on my desktop and I could have SWORN I tried this with the version I'm discussinghere.  But apparently not. When I went back to try it AGAIN and definitely with 7.1.0.GA everything worked like a dream.

             

            TDR

            • 3. Re: Problem adding JPA facet to maven project
              dgolovin

              Good :) I hate to ask "Are you sure ..." like questions, but I was trying to identify what version are you using and checked all 3.x and 2.x branches of Webtools. There is no matching source. I am curious, one JBDS install is 7.1.0.GA and what is second one?

              • 4. Re: Problem adding JPA facet to maven project
                daxxy

                Denis,

                 

                In answer to your question, I was going to send you the version of my previous installation It was a 7.0.0 Alpha build), but then I was able to reproduce the problem in 7.1.0.GA.

                 

                The original pom I tried had a parent pom.  Once I removed the parent, the facet-add worked.  Here is the pom that failed with NPE (logs to follow). well not the whole pom, just this section:

                 

                <parent>

                    <groupId>gov.ssa.dne.nmst</groupId>

                    <artifactId>dne-main</artifactId>

                    <version>1.2.0</version>

                  </parent>

                <artifactId>test-2-jpa</artifactId>

                  <version>0.0.1-SNAPSHOT</version>

                 

                 

                When I changed the pom to this, the thing worked:

                 

                <groupId>gov.ssa.dne.nmst</groupId>

                  <artifactId>test-2-jpa</artifactId>

                  <version>0.0.1-SNAPSHOT</version>

                 

                And... here is all the version info:

                 

                Version: 7.1.0.GA

                Build id: GA-v20131208-0703-B592

                Build date: 20131208-0703

                 

                Dali Java Persistence Tools - JPA Support

                3.3.1.v201308261920-7V7_5FC7sRe5TdgZcI05646d

                 

                well, some of it.  Let me know what, if any more, you need.

                 

                And here is the full NPE stack trace. I tried it twice. I included both (probably redundant):

                 

                !ENTRY org.eclipse.wst.common.project.facet.core 4 0 2014-01-20 07:19:34.438

                !MESSAGE Failed while installing JPA 2.0.

                !STACK 0

                java.lang.NullPointerException

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.defaultResourceLocation(JpaFacetInstallDelegate.java:123)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createPersistenceXml(JpaFacetInstallDelegate.java:107)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createProjectXml(JpaFacetInstallDelegate.java:100)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.execute_(JpaFacetInstallDelegate.java:61)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetActionDelegate.execute(JpaFacetActionDelegate.java:35)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$5.run(FacetedProject.java:1099)

                        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChanges(FacetedProject.java:1109)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy.commitChanges(FacetedProjectWorkingCopy.java:2020)

                        at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$4.run(FacetsPropertyPage.java:232)

                        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

                        at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$5.run(FacetsPropertyPage.java:246)

                        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

                 

                !ENTRY org.eclipse.wst.common.project.facet.core 4 0 2014-01-20 07:22:10.944

                !MESSAGE Failed while installing JPA 2.0.

                !STACK 0

                java.lang.NullPointerException

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.defaultResourceLocation(JpaFacetInstallDelegate.java:123)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createPersistenceXml(JpaFacetInstallDelegate.java:107)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.createProjectXml(JpaFacetInstallDelegate.java:100)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate.execute_(JpaFacetInstallDelegate.java:61)

                        at org.eclipse.jpt.jpa.core.internal.facet.JpaFacetActionDelegate.execute(JpaFacetActionDelegate.java:35)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$5.run(FacetedProject.java:1099)

                        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChanges(FacetedProject.java:1109)

                        at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy.commitChanges(FacetedProjectWorkingCopy.java:2020)

                        at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$4.run(FacetsPropertyPage.java:232)

                        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)

                        at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$5.run(FacetsPropertyPage.java:246)

                        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121

                • 5. Re: Problem adding JPA facet to maven project
                  dgolovin

                  What were your exact steps? Have you imported parent pom first then dependent pom or all them at once?

                  • 6. Re: Problem adding JPA facet to maven project
                    dgolovin

                    I was able to get the same exception but it is still not clear what are exact steps to replicate the problem. Any suggestions are welcome. For now it looks like upstream issue to me.

                    • 7. Re: Problem adding JPA facet to maven project
                      daxxy

                      I do not import the parent.  I have a bunch of maven projects that all have the same parent and I never import the parent.   What do you mean by upstream issue?   Dali issue?  or m2e issue?

                       

                      The steps are exactly as I described them in the original posting.

                       

                      Is there any other information I can send to help figure this out?

                       

                      Tanya

                      • 8. Re: Problem adding JPA facet to maven project
                        dgolovin

                        It looks like Dali issue, but I could not find scenario that would let stable replication for it. I'll try again with originally reported steps. Here are some questions to help me replicate the issue. How many maven projects do you have in workspace? Does this issue happen right after eclipse was started or after you work for a while? How your preferences look like in these categories: - Maven -> Java EE Integration - JBoss Tools - > JBoss Maven Integration Is workspace created in the previous version of JBDS?

                        • 9. Re: Problem adding JPA facet to maven project
                          daxxy

                          I tried something else and now I can't get the facet to add no matter what I do.

                          I created a brand new workspace with the new version 7.1.0.GA.   (I had been using a previously created workspace)

                          I created a data source and connected to it. (mysql)

                          I created an EAP 6.1 server.

                          I imported a simple hibernate project. only one hibernate artifact WITH that parent pom in place

                          Converted to faceted form

                          Tried to add JPA facet as I describe above

                          NPE!

                           

                          Same result when I remove the parent pom. NPE

                           

                          When I look at JBoss Maven Integeraton, I see everything checked.  That is the default. I didn't configure anything there.

                           

                          Want me to zip up my workspace and attach it here?  There is only the one test project in it. ( just looked at it - > 100MB?! I didn't expect it to be so large.)

                           

                          I'm happy to do more if you let me know what I can do.

                          • 10. Re: Problem adding JPA facet to maven project
                            dgolovin

                            Let me try it again with these steps and see if issue can be replicated. thanks

                            • 11. Re: Problem adding JPA facet to maven project
                              maxandersen

                              seems this or very similar issue is occurring at "random": see https://jira.jboss.org/jira/browse/JBIDE-17710

                              • 12. Re: Problem adding JPA facet to maven project
                                xcoulon

                                I got the same problem today with JBDS 8.0.2, when starting from a fresh workspace and creating a Maven project using the widlfly-javaee7-webapp-blank-archetype archetype.