Osgi中碰到ArrayStoreException问题
来源:互联网 发布:python 数据拟合曲线 编辑:程序博客网 时间:2024/04/29 14:25
在Gemini-blueprint中做proxy interface时,出现了这个错误。
先看JavaDoc的提示:
Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. For example, the following code generates anArrayStoreException
:
Object x[] = new String[3]; x[0] = new Integer(0);
再看看代码
org.eclipse.gemini.blueprint.service.importer.support.AbstractServiceProxyCreator
public ProxyPlusCallback createServiceProxy(ServiceReference reference) { List advices = new ArrayList(4); // 1. the ServiceReference-like mixin Advice mixin = new ImportedOsgiServiceProxyAdvice(reference); advices.add(mixin); // 2. publication of bundleContext (if there is any) // TODO: make this configurable (so it can be disabled) advices.add(invokerBundleContextAdvice); // 3. TCCL handling (if there is any) Advice tcclAdvice = determineTCCLAdvice(reference); if (tcclAdvice != null) advices.add(tcclAdvice); // 4. add the infrastructure proxy // but first create the dispatcher since we need ServiceInvoker dispatcherInterceptor = createDispatcherInterceptor(reference); Advice infrastructureMixin = new InfrastructureOsgiProxyAdvice(dispatcherInterceptor); advices.add(infrastructureMixin); advices.add(dispatcherInterceptor); return new ProxyPlusCallback(ProxyUtils.createProxy(getInterfaces(reference), null, classLoader, bundleContext, advices), dispatcherInterceptor); }
ProxyUtils
public static Object createProxy(Class<?>[] classes, Object target, ClassLoader classLoader,BundleContext bundleContext, List advices) {return createProxy(classes, target, classLoader, bundleContext, (advices != null ? (Advice[]) advices.toArray(new Advice[advices.size()]) : new Advice[0]));}
AbstractServiceProxyCreator中的createproxy方法没有加入泛型约束,刚开始以为是这里可能出现bug。
后加入泛型约束
List<Advice> advices = new ArrayList<Advice>(4);
没有错误。应该不是代码的问题,而是ClassLoader的问题。因为ClassLoader的ClassDef不同,所以在ArrayList.toarray也会错误。
检查本地classloader,发现
web container 中有一个aopxxx.jar ,在web container中的osgi container也有一个,其他细节在这里就不描述了(涉及web container和osgi container share library),至此问题定位到了。
删除其中一个 container,保持aop类的classloader加载一致.
- Osgi中碰到ArrayStoreException问题
- osgi碰到的问题
- ArrayStoreException
- ArrayStoreException
- SQL中碰到的问题
- 工作中碰到的问题
- angularjs中碰到的问题
- div使用中碰到问题
- js中碰到的问题
- wap开发中碰到的问题(1)
- 使用myfaces过程中碰到的问题
- 双系统GRUB修复中碰到的问题
- LFS中又碰到的问题&解决
- 工作中碰到的小问题
- eclipse中使用Tomcat碰到的问题
- linux使用中碰到的问题
- xmlbeans使用中碰到的问题
- JBPM4 使用中碰到的一些问题
- 注重实效的程序员
- vs bug ? fwrite fread
- iOS5里面遇到的兼容性问题以及解决方法
- 一个简单位的C++ 类实现
- 地标测试法简析
- Osgi中碰到ArrayStoreException问题
- DOS压缩文件RAR与ZIP的DOS命令详解
- Basic type XXXX unknown
- 通知栏Notification使用自定义视图方法(显示一个进度条ProgressBar)
- 查询sybase数据库剩余空间
- IOS 5编程 内存管理 ARC技术概述
- 清除Sybase日志的命令
- 清除用户表数据
- 理解 SET CHAINED command not allowed within multi-statement transaction