3

根据我的 Corda 项目,我正在运行一个相当大的 Spring 版本(生成 jHipster)。运行 spring 服务器时,我遇到了一些与类星体相关的错误。我猜这是因为 quasar-utils 在服务器的 gradle 依赖项中。Quasar 正在抱怨与 OAuth2 春季服务相关的事情。到目前为止,我实际上没有使用任何 OAuth 功能,所以我不确定这些错误是否是良性的。无论如何,我有点担心类星体的干扰。有没有办法在服务器 gradle 依赖项中没有 quasar-utils 的情况下与 Corda 进行 RPC 交互?

以下是错误:

[quasar] WARNING: Can't determine super class of org/springframework/security/ldap/authentication/BindAuthenticator
[quasar] WARNING: Can't determine super class of org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator
2018-08-06 17:55:04.769 DEBUG 2492 --- [  restartedMain] c.ehcache.core.Ehcache-usersByLogin      : Initialize successful.
2018-08-06 17:55:04.801 DEBUG 2492 --- [  restartedMain] c.ehcache.core.Ehcache-usersByEmail      : Initialize successful.
[quasar] WARNING: Can't determine super class of org/springframework/security/oauth2/client/oidc/userinfo/OidcUserService
[quasar] WARNING: Can't determine super class of org/springframework/security/oauth2/client/userinfo/OAuth2UserService
[quasar] ERROR: Unable to instrument class org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer
java.lang.NullPointerException
    at co.paralleluniverse.asm.Item.a(Unknown Source)
    at co.paralleluniverse.asm.ClassWriter.c(Unknown Source)
    at co.paralleluniverse.asm.ClassWriter.a(Unknown Source)
    at co.paralleluniverse.asm.Frame.a(Unknown Source)
    at co.paralleluniverse.asm.Frame.a(Unknown Source)
    at co.paralleluniverse.asm.MethodWriter.visitMaxs(Unknown Source)
    at co.paralleluniverse.asm.tree.MethodNode.accept(Unknown Source)
    at co.paralleluniverse.asm.commons.JSRInlinerAdapter.visitEnd(Unknown Source)
    at co.paralleluniverse.asm.MethodVisitor.visitEnd(Unknown Source)
    at co.paralleluniverse.fibers.instrument.InstrumentClass$1.visitEnd(InstrumentClass.java:190)
    at co.paralleluniverse.asm.ClassReader.b(Unknown Source)
    at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
    at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:134)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:94)
    at co.paralleluniverse.fibers.instrument.JavaAgent$Transformer.transform(JavaAgent.java:209)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.getHttp(WebSecurityConfigurerAdapter.java:205)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:321)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:92)
    at com.cordatemplate.cordapp.config.SecurityConfiguration$$EnhancerBySpringCGLIB$$c1c18162.init(<generated>)
    at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.init(AbstractConfiguredSecurityBuilder.java:371)
    at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:325)
    at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:104)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$bc81b89d.CGLIB$springSecurityFilterChain$4(<generated>)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$bc81b89d$$FastClassBySpringCGLIB$$6a532806.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$bc81b89d.springSecurityFilterChain(<generated>:65535)
    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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1256)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1105)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
    at com.cordatemplate.cordapp.CordaApp.main(CordaApp.java:61)
    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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
[quasar] ERROR: while transforming org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer: null
java.lang.NullPointerException
    at co.paralleluniverse.asm.Item.a(Unknown Source)
    at co.paralleluniverse.asm.ClassWriter.c(Unknown Source)
    at co.paralleluniverse.asm.ClassWriter.a(Unknown Source)
    at co.paralleluniverse.asm.Frame.a(Unknown Source)
    at co.paralleluniverse.asm.Frame.a(Unknown Source)
    at co.paralleluniverse.asm.MethodWriter.visitMaxs(Unknown Source)
    at co.paralleluniverse.asm.tree.MethodNode.accept(Unknown Source)
    at co.paralleluniverse.asm.commons.JSRInlinerAdapter.visitEnd(Unknown Source)
    at co.paralleluniverse.asm.MethodVisitor.visitEnd(Unknown Source)
    at co.paralleluniverse.fibers.instrument.InstrumentClass$1.visitEnd(InstrumentClass.java:190)
    at co.paralleluniverse.asm.ClassReader.b(Unknown Source)
    at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
    at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:134)
    at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:94)
    at co.paralleluniverse.fibers.instrument.JavaAgent$Transformer.transform(JavaAgent.java:209)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.getHttp(WebSecurityConfigurerAdapter.java:205)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:321)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:92)
    at com.cordatemplate.cordapp.config.SecurityConfiguration$$EnhancerBySpringCGLIB$$c1c18162.init(<generated>)
    at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.init(AbstractConfiguredSecurityBuilder.java:371)
    at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:325)
    at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:104)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$bc81b89d.CGLIB$springSecurityFilterChain$4(<generated>)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$bc81b89d$$FastClassBySpringCGLIB$$6a532806.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$bc81b89d.springSecurityFilterChain(<generated>:65535)
    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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1256)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1105)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:304)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
    at com.cordatemplate.cordapp.CordaApp.main(CordaApp.java:61)
    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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
4

2 回答 2

0

只要您不使用任何 Quasar 无法在内部流中检测的对象,您就不会遇到任何问题。Quasar 主要在 Corda 中用于可悬挂的纤维,这意味着一个序列化的堆栈。如果该对象不存在于所述堆栈上,则不应引起任何问题。

但更重要的是;您的 Corda 节点和 Spring Boot 应用程序应该在不同的进程中运行以避免任何干扰。在编译 Cordapps 和 Corda 本身时,您只需要 Quasar utils。如果您的 Spring Boot 应用程序是独立的,那么我建议将其构建在一个单独的 gradle/maven 子项目中,而不依赖于 quasar-utils。

于 2018-08-07T13:00:48.357 回答
0

派对有点晚了,但是看看quasar-utils 这里的源代码,你可以在构建中为被忽略的包设置一个扩展属性:

ext.quasar_exclusions = [
        'co.paralleluniverse**',
        'groovy**',
        'com.esotericsoftware.**',
        'jdk**',
        'junit**',
        'kotlin**',
        'net.rubygrapefruit.**',
        'org.gradle.**',
        'org.apache.**',
        'org.jacoco.**',
        'org.junit**',
        'org.slf4j**',
        'worker.org.gradle.**',
        'com.nhaarman.mockito_kotlin**',
        'org.assertj**',
        'org.hamcrest**',
        'org.mockito**',
        'org.opentest4j**',
        'org.springframework**',
        'reactor.core.publisher**',
        'com.github.manosbatsis.corbeans.spring.boot**'
]

此外,4.0.45 版似乎允许quasar扩展,例如:

quasar {
    /// ...
    // defaults to quasar_exclusions property
    excludePackages = [
        'glob for package not to be instrumented',
        //...
    ]
}
于 2019-12-15T22:56:08.033 回答