-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jarslink demo 整合sofarpc 出现问题 #94
Comments
@jiang2015 app-one main 没有main方法, 补充下? |
@jiang2015 @QilongZhang 看了下源码,这个问题只有在使用非jvm的binding是才会有,因为在同一个JVM中使用非jvm的binding,导致BindingConverterContext类出现问题(jvm binding不使用这个),大概逻辑是:
解决方案: |
@QilongZhang 不好意思,刚上传上去。 |
@JoeKerouac 首先谢谢大神的指点和说明,我觉得一个jvm当中使用非jvm binding 感觉有点。。。 |
@jiang2015 有什么问题吗? |
@JoeKerouac 没有问题,我觉得使用方式上: |
Your question
利用jarslink中的biz-jvm-invocation-sample 引用sofa-rpc,出现问题,具体改造点:
1.原来的注解方式改为xml配置方式,引入service-provide.xml,service-consumer.xml,
如果传输协议采用sofa:binding.jvm/的话,执行没有问题。
如果传输协议采用sofa:binding.bolt/的话,就会报异常。
demo地址:
https://github.com/jiang2015/biz-jvm-invocation-sample/tree/master
按照以下步骤执行 sample:
cd biz-jvm-invocation-sample/facade && mvn clean install 在 facade 应用根目录中执行 mvn clean install 命令,把 facade 包安装到本地 maven 仓库,以便在 app-one 和 app-two 中添加 facade 依赖:
cd biz-jvm-invocation-sample/app-one && mvn clean package 在 app-one 应用根目录中执行 mvn clean package 命令,将应用打包成 Ark 包和 Biz 包,文件将输出到 biz-jvm-invocation-sample/app-one/target 目录
cd biz-jvm-invocation-sample/app-two && mvn clean package 在 app-two 应用根目录中执行 mvn clean package 命令,将应用打包成 Ark 包和 Biz 包,文件将输出到 biz-jvm-invocation-sample/app-two/target 目录
使用 java -jar 启动 app-one 应用的 Ark 包
使用 telnet localhost 1234 进入 Jarslink2.0 指令交互界面,并执行 install -b 指令,安装启动 app-two 的 Biz 包。
执行install -b 命令的场合,例如:install -b file:\\D:\work\src\gitsrc\sofa-jarslink\sofa-jarslink-samples\biz-jvm-invocation-sample\app-two\target\app-two-1.0.0-ark-biz.jar
会抛出异常:
2018-08-09 11:41:35.336 ERROR 9096 --- [nk-command-0-T1] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.alipay.sofa.runtime.spring.factory.ServiceFactoryBean#0': Invocation of init method failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "com.alipay.sofa.runt
ime.spi.service.BindingConverterContext.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of com/alipay/sofa/ark/container/service/classloader/BizClassLoader) of the current class, com/alipay/sofa/runtime/spring/factory/AbstractContractFactoryBean,
and the class loader (instance of com/alipay/sofa/ark/container/service/classloader/PluginClassLoader) for the method's defining class, com/alipay/sofa/runtime/spi/service/BindingConverterContext, have different Class objects for the type org/springframework/context/ApplicationContext used in the si
gnature
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:735) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.4.RELEASE.jar!/:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.4.RELEASE.jar!/:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) ~[spring-boot-1.4.2.RELEASE.jar!/:na]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) ~[spring-boot-1.4.2.RELEASE.jar!/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-1.4.2.RELEASE.jar!/:na]
at me.qlong.tech.service.AppTwoApplication.main(AppTwoApplication.java:33) [app-two-1.0.0-ark-biz.jar!/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_91]
at com.alipay.sofa.ark.bootstrap.MainMethodRunner.run(MainMethodRunner.java:48) [sofa-ark-archive-0.4.0.jar!/:na]
at com.alipay.sofa.ark.container.model.BizModel.start(BizModel.java:179) [sofa-ark-container-0.4.0.jar!/:na]
at com.alipay.sofa.jarslink.runtime.command.InstallCommand$1.run(InstallCommand.java:78) [sofa-jarslink-runtime-2.0.0-SNAPSHOT.jar!/:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_91]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_91]
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "com.alipay.sofa.runtime.spi.service.BindingConverterContext.setApplicationContext(Lorg/springframework/context/ApplicationContext;)V" the class loader (instance of com/alipay/sofa/ark/container/service/classloader
/BizClassLoader) of the current class, com/alipay/sofa/runtime/spring/factory/AbstractContractFactoryBean, and the class loader (instance of com/alipay/sofa/ark/container/service/classloader/PluginClassLoader) for the method's defining class, com/alipay/sofa/runtime/spi/service/BindingConverterConte
xt, have different Class objects for the type org/springframework/context/ApplicationContext used in the signature
at com.alipay.sofa.runtime.spring.factory.AbstractContractFactoryBean.parseBindings(AbstractContractFactoryBean.java:120) ~[runtime-sofa-boot-starter-2.5.0-SNAPSHOT.jar!/:na]
at com.alipay.sofa.runtime.spring.factory.AbstractContractFactoryBean.afterPropertiesSet(AbstractContractFactoryBean.java:95) ~[runtime-sofa-boot-starter-2.5.0-SNAPSHOT.jar!/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579) ~[spring-beans-4.3.4.RELEASE.jar!/:na]
The text was updated successfully, but these errors were encountered: