Uploaded image for project: 'odlparent'
  1. odlparent
  2. ODLPARENT-166

Some change in odlparent 4.0.0 causes us to suddenly require an explicit new dependency on org.glassfish:javax.json

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Medium Medium
    • None
    • 4.0.0
    • None
    • None

      While working on the odlparent 4.0.0 bump in NEUTRON-197, I've come across a problem I want to record here, so that if other projects use EcliseLink (org.eclipse.persistence) they can benefit from the lesson lernt here, and so that we can see if perhaps a more permanent solution in odlparent is required:

      All those JAXB related tests in neutron-spi which all basically just unmarshal JSON were failing this like: 

      javax.xml.bind.UnmarshalException
       - with linked exception:
      [Exception [EclipseLink-25004] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.XMLMarshalException
      Exception Description: An error occurred unmarshalling the document
      Internal Exception: javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found]
      	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.handleXMLMarshalException(JAXBUnmarshaller.java:1112)
      	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:353)
      	at org.opendaylight.neutron.spi.JaxbTestHelper.jaxbUnmarshall(JaxbTestHelper.java:48)
      	at org.opendaylight.neutron.spi.NeutronVpnLifetimeJAXBTest.test_NeutronVPNLifetime_JAXB(NeutronVpnLifetimeJAXBTest.java:22)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
      Caused by: Exception [EclipseLink-25004] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.XMLMarshalException
      Exception Description: An error occurred unmarshalling the document
      Internal Exception: javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
      	at org.eclipse.persistence.exceptions.XMLMarshalException.unmarshalException(XMLMarshalException.java:122)
      	at org.eclipse.persistence.internal.oxm.record.json.JsonStructureReader.parse(JsonStructureReader.java:148)
      	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:1018)
      	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:454)
      	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:666)
      	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:741)
      	at org.eclipse.persistence.internal.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:651)
      	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:351)
      	... 25 more
      Caused by: javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
      	at javax.json.spi.JsonProvider.provider(JsonProvider.java:99)
      	at javax.json.Json.createReader(Json.java:213)
      	at org.eclipse.persistence.internal.oxm.record.json.JsonStructureReader.parse(JsonStructureReader.java:125)
      	... 31 more
      Caused by: java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:264)
      	at javax.json.spi.JsonProvider.provider(JsonProvider.java:96)
      	... 33 more

      Researching this a bit, one finds this kind of stuff:

      Indeed if I add this to neutron/neutron-spi/pom.xml as part of c/76089 then those tests pass again:

      <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.json</artifactId>
        <version>1.1.2</version>
        <type>bundle</type>
        <scope>test</scope>
      </dependency>
      

      so all good I guess - it's just curious that we would suddenly require this; looks like one of the bumps of things like EclipseLink itself, or javax.json (JSON-P) or Jackson or perhaps even Karaf had this unintended side effect? Perhaps before there was transitive dependency from the the API to this Impl which now needs to be added explicitly.

      FYI: Those tests (above) are standalone; I still have to see how it works under OSGi... but hopefully it's possible to get it working there as well (although eclipse-ee4j/jsonp/issues/96 looks a little bit worrying in that regard).

      skitt, tpantelisrovarga this isn't really blocking me in NEUTRON-197, with the workaround above (I think), but I thought you may be interested in hearing about this, even if just to keep it at the back of your minds for later.

            Unassigned Unassigned
            vorburger Michael Vorburger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: