人生最可悲的就是坚持了不该坚持的,放弃了不该放弃的...
qianxingchuan / doraemon Goto Github PK
View Code? Open in Web Editor NEW2048乐队是一个很牛逼的乐队!这是一个轻量级的Java模块隔离框架
License: Apache License 2.0
2048乐队是一个很牛逼的乐队!这是一个轻量级的Java模块隔离框架
License: Apache License 2.0
人生最可悲的就是坚持了不该坚持的,放弃了不该放弃的...
你好,
我尝试用SpringBoot作为启动程序做了个范例。在打印bundle path/打印ClassLoader的步骤都很顺利,但在调用实现了Facade接口的BundleBean方法的时候报错了如下的错误:
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
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)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.example.demo.doraemon.facade.DemoFacade' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:352)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:343)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1127)
at com.galaxy.demo.doraemon.bundle1.run.BundleRun.getBundleBean(BundleRun.java:30)
我的SpringBoot程序的代码如下,基本和范例中的main程序代码一致。
@SpringBootApplication
public class DoraemonDemoAppApplication {
public static void main(String[] args) {
SpringApplication.run(DoraemonDemoAppApplication.class, args);
List<RunDoraemonBundle> runDoraemonBundles = new ArrayList<>();
String bundle1Path = DoraemonDemoAppApplication.class.getResource("/doraemon-bundle1-1.0.0-SNAPSHOT-release.zip").getPath();
String bundle2Path = DoraemonDemoAppApplication.class.getResource("/doraemon-bundle2-1.0.0-SNAPSHOT-release.zip").getPath();
System.out.println("bundle1 path is " + bundle1Path);
System.out.println("bundle2 path is " + bundle2Path);
RunDoraemonBundle runDoraemonBundle1 = new RunDoraemonBundle(bundle1Path, null);
runDoraemonBundle1.run();
runDoraemonBundles.add(runDoraemonBundle1);
RunDoraemonBundle runDoraemonBundle2 = new RunDoraemonBundle(bundle2Path, null);
runDoraemonBundle2.run();
runDoraemonBundles.add(runDoraemonBundle2);
AsgardClassLoader bundle1ClassLoader = runDoraemonBundle1.getBundle().getBundleClassLoader();
AsgardClassLoader bundle2ClassLoader = runDoraemonBundle2.getBundle().getBundleClassLoader();
ClassLoader defaultClassLoader = Thread.currentThread().getContextClassLoader();
System.out.println(defaultClassLoader);
System.out.println(bundle1ClassLoader);
System.out.println(bundle2ClassLoader);
Thread.currentThread().setContextClassLoader(bundle1ClassLoader);
runDoraemonBundle1.getBundleBean(DemoFacade.class).doSomething();
}
}
想咨询一下有哪些可能会导致类似的错误信息?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.