0

My RCP application makes calls to SOAP web services and has been using the built-in JAXB/JEE components in Java 1.8. I have set up the build process to force the use of Java 1.8 and this had been working well.

Recently, the build stopped working because the builder (Tycho) now has a component which only works with later Java versions. If I compile with the later version I get 100's of JEE-related errors such as JaxbElement not found or @WebMethod not found.

At some point we will have to move away from Java 1.8 and use a Java version which does not provide those JEE components, so forcing the use of 1.8 can only be a short-term solution.

Is there an eclipse plugin which already provides those missing components? (I have searched but not found anything) Or do I need to create my own helper plugin which contains the necessary libraries? Is there perhaps a JAXB alternative which I could use for the SOAP calls?

paul
  • 13,312
  • 23
  • 81
  • 144
  • Couldn't you just add the missing dependencies(not plugins) to your project? Something like this https://www.dariawan.com/tutorials/java/using-jaxb-java-11/ – Balázs Nemes Aug 25 '20 at 09:09
  • @BalázsNemes I have a number of plugins which need JAXB and I already tested the approach described on the page. I was wondering if there is an 'eclipse' solution. – paul Aug 25 '20 at 09:57
  • @BalázsNemes It does not work like this. In OSGi you define dependencies differently than in a plain Java application. – howlger Aug 25 '20 at 10:15

1 Answers1

2

The JAXB plugins/bundles are available on Eclipse Orbit: the plugins/bundles starting with javax..

In the plugins/bundles where they are needed, add the dependency in the MANIFEST.MF file via Import-Package (using Require-Bundle would require that these plugins/bundles are available even when using Java 8).

See also this answer.

howlger
  • 31,050
  • 11
  • 59
  • 99
  • A follow-up question: `Import-Package` does not actually load the bundle. My Tycho build now fails - presumably because the bundle (which was downloaded at the start) is not on the class path and I get compile errors. Would it therefore be better to use `Require-Bundle` instead even if it is unnecessary for Java 8? – paul Aug 25 '20 at 13:30
  • The Tycho build should work in both cases if the necessary bundles are in the target platform. What is the exact error message? – howlger Aug 25 '20 at 13:43
  • Looking more closely at the log, I see that `java.jws.source` gets downloaded! The other bundles I defined get downloaded correctly. The target definition seems correct: `` so I have no idea what's going on here. Eclipse seems to resolve the target correctly and I get no compile errors in the code editor :-/ – paul Aug 25 '20 at 13:59
  • I also have no idea what is going wrong here. Maybe you better ask this as a separate question with the Maven log and your target definition file. By the way, the unit version should be `0.0.0` since the version is given by the repository location in this case (when the repository does not contain multiple versions of the bundle; this makes it easier to maintaine/upgrade). – howlger Aug 25 '20 at 14:53
  • 1
    Thanks. Changed the unit version and created a new question (https://stackoverflow.com/questions/63592564/) – paul Aug 26 '20 at 07:39