fnproject / fdk-java

Java API and runtime for fn.
Apache License 2.0
142 stars 53 forks source link

FnTesting: module java.xml does not export jdk.xml.internal to unnamed module #243

Open jbescos opened 4 years ago

jbescos commented 4 years ago

Hello,

I am having the next issue with fn testing:

An error occurred in function: class com.sun.org.apache.xerces.internal.impl.dv.xs.TypeValidator (in unnamed module @0x6bff19ff) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x6bff19ff
Caused by: java.lang.IllegalAccessError: class com.sun.org.apache.xerces.internal.impl.dv.xs.TypeValidator (in unnamed module @0x6bff19ff) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x6bff19ff
    at com.sun.org.apache.xerces.internal.impl.dv.xs.TypeValidator.<clinit>(TypeValidator.java:44)
    at com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl.<clinit>(XSSimpleTypeDecl.java:102)
    at com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl.createBuiltInTypes(SchemaDVFactoryImpl.java:47)
    at com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl.<clinit>(SchemaDVFactoryImpl.java:42)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at java.xml/com.sun.org.apache.xerces.internal.utils.ObjectFactory.newInstance(ObjectFactory.java:161)
    at java.xml/com.sun.org.apache.xerces.internal.utils.ObjectFactory.newInstance(ObjectFactory.java:146)
    at java.xml/com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory.getInstance(SchemaDVFactory.java:73)
    at java.xml/com.sun.org.apache.xerces.internal.impl.dv.SchemaDVFactory.getInstance(SchemaDVFactory.java:57)
    at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.reset(XMLSchemaLoader.java:1052)
    at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:563)
    at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:542)
    at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:276)
    at org.jboss.weld.xml.BeansXmlValidator.initSchema(BeansXmlValidator.java:156)
    at org.jboss.weld.xml.BeansXmlValidator.<init>(BeansXmlValidator.java:61)
    at org.jboss.weld.bootstrap.WeldBootstrap.<init>(WeldBootstrap.java:57)
    at io.helidon.microprofile.cdi.HelidonContainerImpl.<init>(HelidonContainerImpl.java:115)
    at io.helidon.microprofile.cdi.HelidonContainerImpl.create(HelidonContainerImpl.java:125)
    at io.helidon.microprofile.cdi.BuildTimeInitializer.createContainer(BuildTimeInitializer.java:51)
    at io.helidon.microprofile.cdi.BuildTimeInitializer.<clinit>(BuildTimeInitializer.java:31)
    at io.helidon.microprofile.cdi.ContainerInstanceHolder.fromBuildTimeInitializer(ContainerInstanceHolder.java:58)
    at io.helidon.microprofile.cdi.ContainerInstanceHolder.get(ContainerInstanceHolder.java:50)
    at io.helidon.microprofile.cdi.Main.<clinit>(Main.java:55)
    at io.helidon.microprofile.cloud.common.CommonCloudFunction$LazyHelidonInitializer.<clinit>(CommonCloudFunction.java:53)
    at io.helidon.microprofile.cloud.common.CommonCloudFunction.delegate(CommonCloudFunction.java:40)
    at io.helidon.microprofile.cloud.ocifunctions.OCIFunction.apply(OCIFunction.java:34)
    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:566)

This is my JDK:

java 11.0.7 2020-04-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.7+8-LTS, mixed mode)

It is working properly in live running the next:

$ fn --verbose deploy --app uppercase --local
$ curl --noproxy "*" -d 'test' -X POST http://localhost:8080/t/uppercase/uppercase

You can reproduce it checking out my branch: https://github.com/jbescos/helidon/tree/FnTestingClassLoader Then:

cd helidon/examples/microprofile/oci-functions
mvn clean install

This test ExampleFunctionTest#testWithFN will fail, but this other will be success ExampleFunctionTest#testWithoutFN

I think the only difference is FnTestingClassLoader is used in testWithFN.

Do you know what could be the issue?.