[英]Cellar Hazelcast serialization exception when using DOSGi service
I've made an application with the following three bundles 我用以下三个捆绑软件提出了申请
myservice-api
de.myservice.api.model.MyObject
de.myservice.api.model.MyObject
de.myservice.api.services.MyService
with function void save(MyObject o)
de.myservice.api.services.MyService
具有函数void save(MyObject o)
myservice-impl
MyService
and provides it via DOSGi MyService
的实现,并通过DOSGi提供 frontend
is just some code that references to the MyService
implementation via blueprint and calls the save
function frontend
只是一些通过蓝图引用MyService
实现并调用save
函数的代码 I created a cluster using the Apache Cellar feature with two Karaf servers on different machines. 我使用Apache Cellar功能在不同计算机上的两个Karaf服务器创建了集群。 The bundles are deployed like this and show the status
Active
: 捆绑软件是这样部署的,并显示状态
Active
:
myservice-api
frontend
myservice-api
myservice-impl
When using cluster:list-nodes
it shows that the cluster is set up, using cluster:service-list
I can see that my service is provided by machine002: 使用
cluster:list-nodes
它显示集群已建立,使用cluster:service-list
可以看到我的服务是由machine002提供的:
Service Class | Provider Node
-----------------------------------------------------------------
de.myservice.api.services.MyService | machine002.company.int:5701
The OSGi linking and stuff works, but when the frontend
tries to use the save
function, I get the following exception on the service providing instance machine002
: OSGi的链接和东西的作品,但在
frontend
试图使用save
功能,我得到的服务提供实例以下异常machine002
:
2017-03-14 12:55:02,250 | WARN | pool-65-thread-1 | QueueConsumer | 328 - org.apache.karaf.cellar.hazelcast - 4.0.3 |
CELLAR HAZELCAST: consumer task failed to poll the queue com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: de.myservice.api.model.MyObject
at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:224)[322:com.hazelcast:3.7.2]
at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:46)[322:com.hazelcast:3.7.2]
at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:172)[322:com.hazelcast:3.7.2]
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolve(InvocationFuture.java:103)[322:com.hazelcast:3.7.2]
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolveAndThrow(InvocationFuture.java:74)[322:com.hazelcast:3.7.2]
at com.hazelcast.spi.impl.AbstractInvocationFuture.get(AbstractInvocationFuture.java:158)[322:com.hazelcast:3.7.2]
at com.hazelcast.collection.impl.queue.QueueProxySupport.invokeAndGet(QueueProxySupport.java:177)[322:com.hazelcast:3.7.2]
at com.hazelcast.collection.impl.queue.QueueProxySupport.pollInternal(QueueProxySupport.java:124)[322:com.hazelcast:3.7.2]
at com.hazelcast.collection.impl.queue.QueueProxyImpl.poll(QueueProxyImpl.java:88)[322:com.hazelcast:3.7.2]
at org.apache.karaf.cellar.hazelcast.QueueConsumer.run(QueueConsumer.java:93)[328:org.apache.karaf.cellar.hazelcast:4.0.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
Caused by: java.lang.ClassNotFoundException: de.myservice.api.model.MyObject
at org.apache.karaf.cellar.core.utils.CombinedClassLoader.findClass(CombinedClassLoader.java:79)[326:org.apache.karaf.cellar.core:4.0.3]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)[:1.8.0_45]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_45]
at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:151)
at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:120)
at com.hazelcast.nio.IOUtil$ClassLoaderAwareObjectInputStream.resolveClass(IOUtil.java:358)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)[:1.8.0_45]
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)[:1.8.0_45]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)[:1.8.0_45]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)[:1.8.0_45]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)[:1.8.0_45]
at java.util.LinkedList.readObject(LinkedList.java:1149)[:1.8.0_45]
at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_45]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)[:1.8.0_45]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)[:1.8.0_45]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)[:1.8.0_45]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)[:1.8.0_45]
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)[:1.8.0_45]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)[:1.8.0_45]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)[:1.8.0_45]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)[:1.8.0_45]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)[:1.8.0_45]
at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:219)[322:com.hazelcast:3.7.2]
... 12 more
The myservice-api
bundle is deployed on both machines so the class should be available - is there something else I must configure so that hazelcast knows where to take the classes from for de/serialization? myservice-api
捆绑包同时部署在两台计算机上,因此该类应该可用-我还必须配置其他内容,以便hazelcast知道从何处获取类以进行反序列化。
Looks like your api bundle actually doesn't export the required packages. 看来您的api捆绑包实际上没有导出所需的软件包。 Therefore make sure it really does.
因此,请确保确实如此。 And since it's working on the "server" side, I'm sure your implementation bundle might have those API packages included.
并且由于它在“服务器”端工作,因此我确定您的实现捆绑包中可能包含这些API软件包。 So make sure your exports/imports etc. for your bundles is correct.
因此,请确保您的捆绑商品进出口正确无误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.