Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-7720

"Open Source File" and "Open Mapping File" don't work for m2eclipse multi-module project

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.2.0.CR1
    • 3.1.1
    • hibernate
    • None
    • Hide

      I'm using a jboss to resolve the classpath dependencies for jpa. I'm not absolutely sure if it works exactly the way below because I encountered some trial, error and undo.

      Steps to reproduce without example workspace:
      1. Switch to new workspace
      2. Create parent project
      – File->New->Project...
      – Select Maven->"Maven Project", "Next >"
      – Check "Create a simple project", "Next >"
      – Under Artifact: "Group Id" = "mypackage", "Artifact Id" = "mpm", Packaging = "pom", "Next >", "Finish"
      2. Create child project
      – File->New->Project...
      – Select Maven->"Maven Module", "Next >"
      – Check "Create a simple project"
      – Press "Browse..."-Button for "Parent Project", Select "mpm", "OK"
      – "Next >"
      – Under Artifact: "Group Id" = "mypackage", "Artifact Id" is disabled, Packaging = "ejb", "Next >", "Finish"
      3. Add and configure JPA Facet
      – Select "mpm-ejb" in Package Explorer
      – Project->Properties->"Project Facets"
      – Change Version for Java from 1.4 to 5.0
      – Check "Java Persistence"
      – Click on "Further configuration available..."
      – Type = "Disable Library Configuration"
      – Check "Discover annotated classes automatically"
      – Click on "Add connection ...", Select "Derby", Name = "MyDerby", "Next >"
      – Drivers = "Derby Client JDBC Driver 10.2 Default", "Database" = "mpm-db", "Finish"
      – Check "Add driver library to build path"
      – "OK" to leave further configuration
      – "OK" to leave facet selection
      4. Create entity bean
      – File->New->Other...
      – Select JPA->Entity
      – "Class name" = MyClass, "Finish" (Ignore NPE with message "Apply changes to persistence XML")
      5. Add id for entity bean
      – Paste "@Id"
      – Paste "@GeneratedValue(strategy=GenerationType.AUTO)"
      – Paste "private long id;"
      6. Create JBoss runtime
      – Window->Preferences->Server->"Runtime Environments"
      – "Add..."
      – "JBoss Community"->"JBoss 4.2 Runtime", "Nect >"
      – Point "Home Directory" to the installation path, e.g. "C:\java\jboss\jboss-4.2.2.GA"
      7. Add JBoss to resolve classpath dependencies (otherwise the hibernate perspective will not work)
      – Select "mpm-ejb" in Package Explorer
      – Project->Properties...->"Java Build Path"
      – "Add library..."
      – "Server Runtime", "Next >"
      – "JBoss 4.2 Runtime", "Finish"
      8. Create database
      – File->New->Project...
      – Select General->Project, "Next >"
      – "Project name" = "mpm-db", "Finish"
      – Right-click on mpm-db, "Apache Derby"->"Add Apache Derby nature"
      9. Mount database
      – Right-click on mpm-db, "Apache Derby"->"Start Derby Network Server"
      10. Open Error Log
      – Window->"Show View">Other... General>"Error Log"
      11. Use Hibernate Perspective
      – Window->"Open Perspective">"Other...">Hibernate
      – In the view "Hibernate Configurations" press "[+]"
      – Type = "JPA", Project = "mpm-ejb", "Database connection" = "MyDerby"
      – Under "Classpath": "Add External JARs..." chose <path to derby plugin location>\plugins\org.apache.derby.core_10.6.2\derbyclient.jar
      – Under "Options": "Database dialect" = "Derby"
      – "OK"
      – Expand "hibernate" in under "Hibernate Configurations"
      – Expand "Configuration"
      – Double-click on MyClass
      – See the exception in the error log view

      Steps to reproduce using the example workspace in workspace.zip:

      • Adjust path in the JBoss server runtime to your local JBoss installation
      • Perform last three steps from above
      Show
      I'm using a jboss to resolve the classpath dependencies for jpa. I'm not absolutely sure if it works exactly the way below because I encountered some trial, error and undo. Steps to reproduce without example workspace: 1. Switch to new workspace 2. Create parent project – File->New->Project... – Select Maven->"Maven Project", "Next >" – Check "Create a simple project", "Next >" – Under Artifact: "Group Id" = "mypackage", "Artifact Id" = "mpm", Packaging = "pom", "Next >", "Finish" 2. Create child project – File->New->Project... – Select Maven->"Maven Module", "Next >" – Check "Create a simple project" – Press "Browse..."-Button for "Parent Project", Select "mpm", "OK" – "Next >" – Under Artifact: "Group Id" = "mypackage", "Artifact Id" is disabled, Packaging = "ejb", "Next >", "Finish" 3. Add and configure JPA Facet – Select "mpm-ejb" in Package Explorer – Project->Properties->"Project Facets" – Change Version for Java from 1.4 to 5.0 – Check "Java Persistence" – Click on "Further configuration available..." – Type = "Disable Library Configuration" – Check "Discover annotated classes automatically" – Click on "Add connection ...", Select "Derby", Name = "MyDerby", "Next >" – Drivers = "Derby Client JDBC Driver 10.2 Default", "Database" = "mpm-db", "Finish" – Check "Add driver library to build path" – "OK" to leave further configuration – "OK" to leave facet selection 4. Create entity bean – File->New->Other... – Select JPA->Entity – "Class name" = MyClass, "Finish" (Ignore NPE with message "Apply changes to persistence XML") 5. Add id for entity bean – Paste "@Id" – Paste "@GeneratedValue(strategy=GenerationType.AUTO)" – Paste "private long id;" 6. Create JBoss runtime – Window->Preferences->Server->"Runtime Environments" – "Add..." – "JBoss Community"->"JBoss 4.2 Runtime", "Nect >" – Point "Home Directory" to the installation path, e.g. "C:\java\jboss\jboss-4.2.2.GA" 7. Add JBoss to resolve classpath dependencies (otherwise the hibernate perspective will not work) – Select "mpm-ejb" in Package Explorer – Project->Properties...->"Java Build Path" – "Add library..." – "Server Runtime", "Next >" – "JBoss 4.2 Runtime", "Finish" 8. Create database – File->New->Project... – Select General->Project, "Next >" – "Project name" = "mpm-db", "Finish" – Right-click on mpm-db, "Apache Derby"->"Add Apache Derby nature" 9. Mount database – Right-click on mpm-db, "Apache Derby"->"Start Derby Network Server" 10. Open Error Log – Window->"Show View" >Other... General >"Error Log" 11. Use Hibernate Perspective – Window->"Open Perspective" >"Other..." >Hibernate – In the view "Hibernate Configurations" press " [+] " – Type = "JPA", Project = "mpm-ejb", "Database connection" = "MyDerby" – Under "Classpath": "Add External JARs..." chose <path to derby plugin location>\plugins\org.apache.derby.core_10.6.2\derbyclient.jar – Under "Options": "Database dialect" = "Derby" – "OK" – Expand "hibernate" in under "Hibernate Configurations" – Expand "Configuration" – Double-click on MyClass – See the exception in the error log view Steps to reproduce using the example workspace in workspace.zip: Adjust path in the JBoss server runtime to your local JBoss installation Perform last three steps from above

    Description

      Maven multi-module projects have directory structures like <parent-project>/<child-project>, e.g. mpm/mpm-ejb. m2eclipse shows <child-project> in the workspace at the root node next to <parent-project>.

      When defining a Hibernate configuration in the Hibernate perspective, everything works except "Open Source File" and "Open Mapping File" (Right click on a entity under "Configuration"). The resulting exception is appended below.

      "Mapping Diagram" and expanding the attributes of the entity do work.

      Maybe a workaround would be to modify the classpath of the Hibernate configuration. But neither "Advanced">"Attach Source" nor "Advanced">"Add Folder" for the Source-Folder helped.

      The Hibernate configuration was:
      Type "JPA"
      Database dialect: "Derby"
      Property file with:
      hibernate.dialect=org.hibernate.dialect.DerbyDialect
      hibernate.connection.driver_class=org.apache.derby.jdbc.ClientDriver
      hibernate.connection.url=jdbc:derby://localhost:1527/mpm-db
      hibernate.connection.username=MPM
      hibernate.connection.password=mpm
      hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider
      hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory

      Error Log:

      !ENTRY org.hibernate.eclipse.console 4 4 2010-11-23 15:45:45.984
      !MESSAGE Can't find mapping file.
      !SUBENTRY 1 org.hibernate.eclipse.console 4 150 2010-11-23 15:45:45.984
      !MESSAGE Java Model Exception: Java Model Status [mpm does not exist]
      !STACK 1
      Java Model Exception: Java Model Status [mpm does not exist]
      at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:502)
      at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:246)
      at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:515)
      at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:252)
      at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:238)
      at org.eclipse.jdt.internal.core.JavaProject.getJavaProjectElementInfo(JavaProject.java:1561)
      at org.eclipse.jdt.internal.core.JavaProject.newNameLookup(JavaProject.java:2258)
      at org.eclipse.jdt.internal.core.JavaProject.newNameLookup(JavaProject.java:2268)
      at org.eclipse.jdt.internal.core.JavaProject.findType(JavaProject.java:1279)
      at org.eclipse.jdt.internal.core.JavaProject.findType(JavaProject.java:1186)
      at org.hibernate.eclipse.console.actions.OpenSourceAction.run(OpenSourceAction.java:123)
      at org.hibernate.eclipse.console.actions.OpenMappingAction.run(OpenMappingAction.java:156)
      at org.hibernate.eclipse.console.actions.OpenMappingAction.run(OpenMappingAction.java:104)
      at org.hibernate.eclipse.console.views.KnownConfigurationsView$4.run(KnownConfigurationsView.java:202)
      at org.hibernate.eclipse.console.views.KnownConfigurationsView$2.doubleClick(KnownConfigurationsView.java:118)
      at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:821)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      at org.eclipse.core.runtime.Platform.run(Platform.java:888)
      at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
      at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
      at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:819)
      at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1419)
      at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1195)
      at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:238)
      at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:235)
      at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:296)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
      at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
      !SUBENTRY 2 org.eclipse.jdt.core 4 969 2010-11-23 15:45:45.984
      !MESSAGE mpm does not exist
      !SUBENTRY 2 org.hibernate.eclipse.console 4 150 2010-11-23 15:45:45.984
      !MESSAGE Java Model Exception: Java Model Status [mpm does not exist]
      !STACK 1
      Java Model Exception: Java Model Status [mpm does not exist]
      at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:502)
      at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:246)
      at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:515)
      at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:252)
      at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:238)
      at org.eclipse.jdt.internal.core.JavaProject.getJavaProjectElementInfo(JavaProject.java:1561)
      at org.eclipse.jdt.internal.core.JavaProject.newNameLookup(JavaProject.java:2258)
      at org.eclipse.jdt.internal.core.JavaProject.newNameLookup(JavaProject.java:2268)
      at org.eclipse.jdt.internal.core.JavaProject.findType(JavaProject.java:1279)
      at org.eclipse.jdt.internal.core.JavaProject.findType(JavaProject.java:1186)
      at org.hibernate.eclipse.console.actions.OpenSourceAction.run(OpenSourceAction.java:123)
      at org.hibernate.eclipse.console.actions.OpenMappingAction.run(OpenMappingAction.java:156)
      at org.hibernate.eclipse.console.actions.OpenMappingAction.run(OpenMappingAction.java:104)
      at org.hibernate.eclipse.console.views.KnownConfigurationsView$4.run(KnownConfigurationsView.java:202)
      at org.hibernate.eclipse.console.views.KnownConfigurationsView$2.doubleClick(KnownConfigurationsView.java:118)
      at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:821)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      at org.eclipse.core.runtime.Platform.run(Platform.java:888)
      at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
      at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
      at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:819)
      at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1419)
      at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1195)
      at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:238)
      at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:235)
      at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:296)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
      at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
      !SUBENTRY 3 org.eclipse.jdt.core 4 969 2010-11-23 15:45:45.984
      !MESSAGE mpm does not exist

      Attachments

        1. screenshot-1.jpg
          61 kB
          Vitali Yemialyanchyk
        2. screenshot-2.jpg
          226 kB
          Vitali Yemialyanchyk
        3. test.bmml
          0.7 kB
          Yakup AKSU
        4. test.png
          22 kB
          Yakup AKSU

        Activity

          People

            vyemialyanchyk_jira Vitali Yemialyanchyk (Inactive)
            leavehaton_jira Martin Ackermann (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: