Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] javax.persistence class cannot be resolved - It is indirectly referenced from required .class files

Jan,

Thanks very much! The workarounds fixed the test problems.

So, to summarize the fixes to the JPA and test problems (for those who will search the archives in the future):
*javax.persistence and the EclipseLink bundles need to be included as Require-Bundle, not Import-Package and if the bundle that requires them is used by another, it also needs to be included with Require-Bundle
*Surefire currently has a bug with junit, described here, https://bugs.eclipse.org/bugs/show_bug.cgi?id=369266 , and worked around by
Require-Bundle: org.junit;bundle-version="4.8.1"

I've run into one final problem when building our product with 0.14 or 0.15 that I think may be a bug. Building the product works fine with 0.13. With 0.14 or 0.15, everything, including the features, builds fine with "mvn install," but the product build fails with the following message:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: nice.product 2.0.0
[ERROR]   Missing requirement: nice.product 2.0.0 requires 'gov.ornl.nice.feature.feature.group [2.0.0,2.0.1)' but it could not be found

and:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-publisher-plugin:0.15.0:publish-products (default-publish-products) on project gov.ornl.nice.repository: Execution default-publish-products of goal org.eclipse.tycho:tycho-p2-publisher-plugin:0.15.0:publish-products failed: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from gov.ornl.nice.repository 2.0.0 to gov.ornl.nice.feature.feature.group [2.0.0,2.0.1).", "Unable to satisfy dependency from nice.product 2.0.0 to gov.ornl.nice.feature.feature.group [2.0.0,2.0.1).", "No solution found because the problem is unsatisfiable."] -> [Help 1]

The product is the last thing built.

If I run "mvn install -rf :gov.ornl.nice.repository" immediately after the build, then the products are assembled, packaged and installed perfectly. Any thoughts on that one?

Jay

On Mon, Jun 4, 2012 at 5:33 PM, Sievers, Jan <jan.sievers@xxxxxxx> wrote:
your exception during test execution below

  Caused by: java.lang.NullPointerException
           at java.lang.Class.getAnnotation(Class.java:3048)
           at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.isValidJUnit4Test(JUnit4TestChecker.java:63)

is most probably caused by surefire bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369266

See bug for workaround instructions.

Regards,
Jan



From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-bounces@xxxxxxxxxxx] On Behalf Of Jay Jay Billings
Sent: Montag, 4. Juni 2012 22:34
To: Tycho user list
Subject: Re: [tycho-user] javax.persistence class cannot be resolved - It is indirectly referenced from required .class files

Yes, that's what I meant. If I have an explicit Require-Bundle, shouldn't Tycho be picking it up? I have a bundle with an explicit Import-Package on javax.persistence and that package is in turn explicitly required with Require-Bundle. Tycho doesn't seem to navigate the dependency.

The chain is NiCECore -> NiCE Data Structures -> JPA.  I was able to get it to build by also adding the EclipseLink jars as explicit Required-Bundles to the NiCE Data Structures plugin. Previously I only had javax.persistence as an Import-Package. I suppose this makes sense - they are JEE and we are building outside of a JEE container.

However, this reveals a second problem, one that I mentioned in an early email. The tests for NiCE Data Structures do not run and they produce an InvocationTargetException (see attached log). I've also included the output from the build, run with -X.

Any thoughts?

Jay
On Mon, Jun 4, 2012 at 3:44 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
C -> A -> B

OSGi dependencies are not transitive. C will not "see" any packages from
B, you need to add explicit Require-Bundle or Import-Package.

--
Regards,
Igor


On 12-06-04 2:44 PM, Jay Jay Billings wrote:
Igor,
I had some more time to look at this today. Can you answer a quick
question for me?

If bundle A depends on bundle B and bundle C depends on A, shouldn't
Tycho include bundle B in the class path in addition to bundle A when it
is building bundle C?

I have the case above with JPA (EclipseLink) and I ran the build with
the -X flag. The transitive dependency described above is not satisfied.

Jay

On Sat, Jun 2, 2012 at 10:10 AM, Jay Jay Billings
<jayjaybillings@xxxxxxxxx <mailto:jayjaybillings@xxxxxxxxx>> wrote:

  Igor,

  Changing the repository and running mvn clean seems to fix the
  problem with the JPA annotations, but now it produces the second
  error I reported when it tries to run the tests (see below). These
  tests run fine in Eclipse.

  Any thoughts? I've confirmed that this happens with both 0.14 and
  0.15. It doesn't say what class it is trying to launch or anything -
  it just fails as soon as it tries to launch the tests.

  Jay


  !ENTRY org.eclipse.osgi 4 0 2012-06-02 10:06:28.190
  !MESSAGE Application error
  !STACK 1
  org.apache.maven.surefire.util.SurefireReflectionException:
  java.lang.reflect.InvocationTargetException; nested exception is
  java.lang.reflect.InvocationTargetException: null
  java.lang.reflect.InvocationTargetException
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:616)
           at
  org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
           at
  org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
           at
  org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
           at
  org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:123)
           at
  org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:84)
           at
  org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.run(HeadlessTestApplication.java:21)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:616)
           at
  org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
           at
  org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
           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:353)
           at
  org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:616)
           at
  org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
           at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
           at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
           at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
  Caused by: java.lang.NullPointerException
           at java.lang.Class.getAnnotation(Class.java:3048)
           at
  org.apache.maven.surefire.common.junit4.JUnit4TestChecker.isValidJUnit4Test(JUnit4TestChecker.java:63)
           at
  org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:52)
           at
  org.apache.maven.surefire.util.DefaultDirectoryScanner.locateTestClasses(DefaultDirectoryScanner.java:80)
           at
  org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:174)
           at
  org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:83)
           ... 28 more



  On Fri, Jun 1, 2012 at 8:09 PM, Jay Jay Billings
  <jayjaybillings@xxxxxxxxx <mailto:jayjaybillings@xxxxxxxxx>> wrote:

      Thanks Igor. I will let you know what I find and if I get a
      chance I will make a smaller example program.

      Jay


      On Fri, Jun 1, 2012 at 7:57 PM, Igor Fedorenko
      <igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>> wrote:

          I don't have the time to investigate problems with source
          tree this big,
          but your target platform configuration does not look right.
          I do not
          believe Tycho supports target file with location
          type="Directory", only
          type="InstallableUnit" is supported. From what I can tell,
          the build
          should fail with dependency resolution errors unless you
          have installed
          required dependencies to your local repository. Try running
          the build
          with -Dmaven.repo.local=<some-__empty-dir> and see what happens.


          --
          Regards,
          Igor




          On 12-06-01 6:19 PM, Jay Jay Billings wrote:

              Igor,

              I do not have examples of this happening that are
              independent of my code
              base, but my code is relatively small and completely
              open-source. Is
              that sufficient for a standalone example?

              Access and build instructions:
              http://sourceforge.net/apps/__mediawiki/niceproject/index.__php?title=Getting_NiCE#__Regular_Command_Line_SVN___Access
              <http://sourceforge.net/apps/mediawiki/niceproject/index.php?title=Getting_NiCE#Regular_Command_Line_SVN_Access>
              Repo:
              https://niceproject.svn.__sourceforge.net/svnroot/__niceproject/trunk

              <https://niceproject.svn.sourceforge.net/svnroot/niceproject/trunk>

              The current build has each plugin importing
              javax.persistence in their
              MANIFEST.mf files, which would have to be removed from
              at least one of
              the bundles to produce "[ERROR] The type
              javax.persistence.CascadeType
              cannot be resolved. It is indirectly referenced from
              required .class files."

              If you need something smaller, I can try to put it
              together for you over
              the weekend.

              One point that may be important: we are using EclipseLink
              (org.eclipse.persistence).

              Thanks!

              Jay

              On Fri, Jun 1, 2012 at 5:50 PM, Igor Fedorenko
              <igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>
              <mailto:igor@xxxxxxxxxxxxxx

              <mailto:igor@xxxxxxxxxxxxxx>>> wrote:

                  Are you able to provide complete standalone example
              that demonstrates
                  the problem?

                  --
                  Regards,
                  Igor


                  On 12-06-01 5:00 PM, Jay Jay Billings wrote:

                      Everyone,

                      I get the error below when trying to use
              EclipseLink in an RCP
                      application with Tycho 0.14 -OR- Tycho 0.13. It
              is resolved by
                      adding
                      javax.persistence to the imported package list
              of all of my bundles,
                      even those that do not explicitly use it.

                      I think this is a regression of this bug:
              http://dev.eclipse.org/____mhonarc/lists/tycho-user/____msg00030.html
              <http://dev.eclipse.org/__mhonarc/lists/tycho-user/__msg00030.html>

              <http://dev.eclipse.org/__mhonarc/lists/tycho-user/__msg00030.html
              <http://dev.eclipse.org/mhonarc/lists/tycho-user/msg00030.html>>


                      The DataComponent class mentioned below is
              annotated with JPA
                      annotations and it is class that is used by
              almost all of the other
                      bundles. I would expect the dependency to be
              resolved transitively.

                      Is there a way to fix this in Tycho?

                      Jay

                      -----

                      [ERROR] Failed to execute goal
                org.eclipse.tycho:tycho-____compiler-plugin:0.14.0:compile


                      (default-compile)
                      on project gov.ornl.nice.niceclient: Compilation
              failure:
                      Compilation
                      failure:
                      [ERROR]
                /home/bkj/research/NiCE/____NiCEWorkspace/gov.ornl.nice.____niceclient/src/gov/ornl/nice/____niceclient/iniceclient/____uiwidgets/IExtraInfoWidget.____java:[1,0]
                      [ERROR] package
              gov.ornl.nice.niceclient.____iniceclient.uiwidgets;


                      [ERROR] ^
                      [ERROR] The type javax.persistence.CascadeType
              cannot be
                      resolved. It is
                      indirectly referenced from required .class files
                      [ERROR]
                /home/bkj/research/NiCE/____NiCEWorkspace/gov.ornl.nice.____niceclient/src/gov/ornl/nice/____niceclient/iniceclient/____uiwidgets/IExtraInfoWidget.____java:[1,0]
                      [ERROR] package
              gov.ornl.nice.niceclient.____iniceclient.uiwidgets;


                      [ERROR] ^
                      [ERROR] The type javax.persistence.FetchType
              cannot be resolved.
                      It is
                      indirectly referenced from required .class files
                      [ERROR]
                /home/bkj/research/NiCE/____NiCEWorkspace/gov.ornl.nice.____niceclient/src/gov/ornl/nice/____niceclient/eclipseuiwidgets/____NiCEDataComponentSectionPart.____java:[92,0]
                      [ERROR] System.out.println("____DataComponent " +


                      dataComp.getName() + ":");
                      [ERROR] ^^^^^^^^^^^^^^^^^^
                      [ERROR] The type
              javax.persistence.____GenerationType cannot be


                      resolved. It
                      is indirectly referenced from required .class files
                      [ERROR]
                /home/bkj/research/NiCE/____NiCEWorkspace/gov.ornl.nice.____niceclient/src/gov/ornl/nice/____niceclient/eclipseuiwidgets/____NiCEDataComponentSectionPart.____java:[92,0]
                      [ERROR] System.out.println("____DataComponent " +


                      dataComp.getName() + ":");
                      [ERROR] ^^^^^^^^^^^^^^^^^^
                      [ERROR] The type
              javax.persistence.____InheritanceType cannot be


                      resolved.
                      It is indirectly referenced from required .class
              files
                      [ERROR] 4 problems (4 errors)
                      [ERROR] -> [Help 1]

                      ___________________________________________________

                      tycho-user mailing list
              tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
              <mailto:tycho-user@xxxxxxxxxxx
              <mailto:tycho-user@xxxxxxxxxxx>__>
              https://dev.eclipse.org/____mailman/listinfo/tycho-user
              <https://dev.eclipse.org/__mailman/listinfo/tycho-user>
              <https://dev.eclipse.org/__mailman/listinfo/tycho-user
              <https://dev.eclipse.org/mailman/listinfo/tycho-user>>

                  ___________________________________________________

                  tycho-user mailing list
              tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
              <mailto:tycho-user@xxxxxxxxxxx
              <mailto:tycho-user@xxxxxxxxxxx>__>
              https://dev.eclipse.org/____mailman/listinfo/tycho-user
              <https://dev.eclipse.org/__mailman/listinfo/tycho-user>


              <https://dev.eclipse.org/__mailman/listinfo/tycho-user
              <https://dev.eclipse.org/mailman/listinfo/tycho-user>>




              _________________________________________________
              tycho-user mailing list
              tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
              https://dev.eclipse.org/__mailman/listinfo/tycho-user
              <https://dev.eclipse.org/mailman/listinfo/tycho-user>

          _________________________________________________
          tycho-user mailing list
          tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
          https://dev.eclipse.org/__mailman/listinfo/tycho-user
          <https://dev.eclipse.org/mailman/listinfo/tycho-user>






_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user


Back to the top