geosolutions-it / imageio-ext

Additional plugins and extension for the standard Java ImageIO library
Other
147 stars 84 forks source link

ImageIO ext fails to build under Java 10 #143

Open aaime opened 7 years ago

aaime commented 7 years ago

Just the first issue found during the build (I'd expect to find more):

Caused by: java.lang.IllegalAccessError: class it.geosolutions.imageio.stream.output.spi.FileImageOutputStreamExtImplSpi (in unnamed module @0x7ce69770) cannot access class com.sun.imageio.spi.FileImageOutputStreamSpi (in module java.desktop) because module java.desktop does not export com.sun.imageio.spi to unnamed module @0x7ce69770
    at it.geosolutions.imageio.stream.output.spi.FileImageOutputStreamExtImplSpi.onRegistration(FileImageOutputStreamExtImplSpi.java:81)
    at javax.imageio.spi.SubRegistry.registerServiceProvider(java.desktop@9-internal/ServiceRegistry.java:773)
    at javax.imageio.spi.ServiceRegistry.registerServiceProvider(java.desktop@9-internal/ServiceRegistry.java:328)
    at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(java.desktop@9-internal/IIORegistry.java:214)
    at javax.imageio.spi.IIORegistry.<init>(java.desktop@9-internal/IIORegistry.java:138)
    at javax.imageio.spi.IIORegistry.getDefaultInstance(java.desktop@9-internal/IIORegistry.java:159)
    at javax.imageio.ImageIO.<clinit>(java.desktop@9-internal/ImageIO.java:66)
    at com.sun.media.jai.imageioimpl.ImageReadCRIF.getImageInputStream(ImageReadCRIF.java:168)
    at com.sun.media.jai.imageioimpl.ImageReadCRIF.getImageReader(ImageReadCRIF.java:189)
    at com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:277)
abrin commented 6 years ago

adding the following to your compiler should help

        --add-exports java.desktop/sun.awt=ALL-UNNAMED 
        --add-exports java.desktop/com.sun.imageio.spi=ALL-UNNAMED 
        --add-exports java.desktop/sun.swing=ALL-UNNAMED 
        --add-opens java.desktop/javax.imageio.spi=ALL-UNNAMED

note (a) that for the maven compiler, the goes around anything bound by a space, e.g. --add-exportsjava... and (b) that you'll probably have to do similar things for any tests runners

aaime commented 6 years ago

Building on Java 10 the above seems to be gone, but it fails later due to JAXB missing dependencies (we'll have to add a dependency in the pom, or see if we can do without JAXB):

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.041 sec <<< FAILURE!
testMarshalling(it.geosolutions.imageio.pam.PAMParserTest)  Time elapsed: 0.005 sec  <<< ERROR!
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at it.geosolutions.imageio.pam.PAMParserTest.testMarshalling(PAMParserTest.java:24)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    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.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
    ... 30 more

(aside, I'll solve this ticket when imageio-ext can build without adding special params to the runtime)