我正在尝试使用 Amazon Corretto 15 在 Windows Server 2019 上运行 Nifi Registry 0.8。我知道 Nifi Registry 在 Windows 上不受官方支持,但一些消息来源说它应该运行。Nifi Registry 也应该支持 Java 15。Java 和 Nifi Registry 的路径都没有空间。
当我尝试运行 run-nifi-registry.bat 时,出现以下异常:
java.lang.IllegalStateException: Unable to load cache item
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:79)
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:569)
at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:416)
at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:137)
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:423)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:257)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:130)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:136)
at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:64)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:347)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:854)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
at org.eclipse.jetty.server.Server.start(Server.java:418)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:382)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.nifi.registry.jetty.JettyServer.start(JettyServer.java:481)
at org.apache.nifi.registry.NiFiRegistry.<init>(NiFiRegistry.java:117)
at org.apache.nifi.registry.NiFiRegistry.main(NiFiRegistry.java:164)
Caused by: java.lang.ExceptionInInitializerError: null
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:468)
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:571)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:582)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108)
at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
... 44 common frames omitted
Caused by: java.lang.RuntimeException: Unable to create JAXBContext.
at org.apache.nifi.registry.security.authorization.AuthorizerFactory.initializeJaxbContext(AuthorizerFactory.java:100)
at org.apache.nifi.registry.security.authorization.AuthorizerFactory.<clinit>(AuthorizerFactory.java:91)
... 54 common frames omitted
Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:131)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:318)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:478)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:435)
at org.apache.nifi.registry.security.authorization.AuthorizerFactory.initializeJaxbContext(AuthorizerFactory.java:98)
... 55 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:555)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:92)
at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:125)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
... 59 common frames omitted
在研究的过程中发现了这篇文章,查看了源码中的pom.xml(源码下载只是为了调查,我用的是下载的zip版本)
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
当我试图进一步调查时,我在日志中发现了以下内容:
2021-07-15 10:51:24,625 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class javax.xml.bind.ContextFinder
2021-07-15 10:51:24,625 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==true javax.xml.bind.ServiceLoaderUtil$ExceptionHandler jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/ServiceLoaderUtil$ExceptionHandler.class
2021-07-15 10:51:24,625 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class javax.xml.bind.ServiceLoaderUtil$ExceptionHandler
2021-07-15 10:51:24,625 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==true javax.xml.bind.ContextFinder$1 jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/ContextFinder$1.class
2021-07-15 10:51:24,626 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class javax.xml.bind.ContextFinder$1
2021-07-15 10:51:24,626 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==true javax.xml.bind.GetPropertyAction jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/GetPropertyAction.class
2021-07-15 10:51:24,627 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class javax.xml.bind.GetPropertyAction
2021-07-15 10:51:24,627 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==true javax.xml.bind.ModuleUtil jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/META-INF/versions/9/javax/xml/bind/ModuleUtil.class
2021-07-15 10:51:24,627 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class javax.xml.bind.ModuleUtil
2021-07-15 10:51:24,628 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isServerClass==false class java.lang.invoke.StringConcatFactory
2021-07-15 10:51:24,628 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP parent loaded class java.lang.invoke.StringConcatFactory
2021-07-15 10:51:24,628 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==false org.apache.nifi.registry.security.authorization.generated.ObjectFactory jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/nifi-registry-framework-0.8.0.jar!/org/apache/nifi/registry/security/authorization/generated/ObjectFactory.class
2021-07-15 10:51:24,628 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class org.apache.nifi.registry.security.authorization.generated.ObjectFactory
2021-07-15 10:51:24,629 DEBUG [main] javax.xml.bind Resolved classes from context path: [class org.apache.nifi.registry.security.authorization.generated.ObjectFactory]
2021-07-15 10:51:24,629 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader getResource org/apache/nifi/registry/security/authorization/generated/jaxb.properties null
2021-07-15 10:51:24,629 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader getResource org/apache/nifi/registry/security/authorization/generated/jaxb.properties null
2021-07-15 10:51:24,629 DEBUG [main] javax.xml.bind Checking system property javax.xml.bind.JAXBContextFactory
2021-07-15 10:51:24,629 DEBUG [main] javax.xml.bind not found
2021-07-15 10:51:24,629 DEBUG [main] javax.xml.bind Checking system property javax.xml.bind.context.factory
2021-07-15 10:51:24,629 DEBUG [main] javax.xml.bind not found
2021-07-15 10:51:24,629 DEBUG [main] javax.xml.bind Checking system property javax.xml.bind.JAXBContext
2021-07-15 10:51:24,629 DEBUG [main] javax.xml.bind not found
2021-07-15 10:51:24,629 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==true javax.xml.bind.JAXBContextFactory jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/JAXBContextFactory.class
2021-07-15 10:51:24,630 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded interface javax.xml.bind.JAXBContextFactory
2021-07-15 10:51:24,630 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==true javax.xml.bind.ServiceLoaderUtil jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/javax/xml/bind/ServiceLoaderUtil.class
2021-07-15 10:51:24,630 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class javax.xml.bind.ServiceLoaderUtil
2021-07-15 10:51:24,631 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader getResources META-INF/services/javax.xml.bind.JAXBContextFactory []
2021-07-15 10:51:24,631 DEBUG [main] javax.xml.bind Searching META-INF/services
2021-07-15 10:51:24,631 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader getResource META-INF/services/javax.xml.bind.JAXBContext null
2021-07-15 10:51:24,631 DEBUG [main] javax.xml.bind Unable to load:META-INF/services/javax.xml.bind.JAXBContext
2021-07-15 10:51:24,632 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==false org.glassfish.hk2.osgiresourcelocator.ServiceLoader jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/osgi-resource-locator-1.0.3.jar!/org/glassfish/hk2/osgiresourcelocator/ServiceLoader.class
2021-07-15 10:51:24,632 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded class org.glassfish.hk2.osgiresourcelocator.ServiceLoader
2021-07-15 10:51:24,632 DEBUG [main] org.eclipse.jetty.webapp.WebAppContext isSystemResource==false org.glassfish.hk2.osgiresourcelocator.ServiceLoader$ProviderFactory jar:file:/C:/ApacheNifi/nifi-registry-0.8.0/work/jetty/nifi-registry-web-api-0.8.0.war/webapp/WEB-INF/lib/osgi-resource-locator-1.0.3.jar!/org/glassfish/hk2/osgiresourcelocator/ServiceLoader$ProviderFactory.class
2021-07-15 10:51:24,633 DEBUG [main] o.eclipse.jetty.webapp.WebAppClassLoader WAP webapp loaded interface org.glassfish.hk2.osgiresourcelocator.ServiceLoader$ProviderFactory
2021-07-15 10:51:24,634 DEBUG [main] javax.xml.bind Unable to find from OSGi: [javax.xml.bind.JAXBContext]
java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at javax.xml.bind.ServiceLoaderUtil.lookupUsingOSGiServiceLoader(ServiceLoaderUtil.java:58)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:309)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:478)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:435)
at org.apache.nifi.registry.security.authorization.AuthorizerFactory.initializeJaxbContext(AuthorizerFactory.java:98)
at org.apache.nifi.registry.security.authorization.AuthorizerFactory.<clinit>(AuthorizerFactory.java:91)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:468)
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:571)
at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:582)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108)
at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:569)
at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:416)
at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:137)
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:423)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:257)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:130)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:136)
at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:64)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:347)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:854)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
at org.eclipse.jetty.server.Server.start(Server.java:418)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:382)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.nifi.registry.jetty.JettyServer.start(JettyServer.java:481)
at org.apache.nifi.registry.NiFiRegistry.<init>(NiFiRegistry.java:117)
at org.apache.nifi.registry.NiFiRegistry.main(NiFiRegistry.java:164)
Caused by: java.lang.NullPointerException: Cannot invoke "org.glassfish.hk2.osgiresourcelocator.ServiceLoader.lookupProviderClasses1(java.lang.Class)" because "org.glassfish.hk2.osgiresourcelocator.ServiceLoader._me" is null
at org.glassfish.hk2.osgiresourcelocator.ServiceLoader.lookupProviderClasses(ServiceLoader.java:108)
... 64 common frames omitted
它看起来不像 Windows 上的 Nifi 注册表问题。缺少什么以及如何解决此问题?