activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ffrenchm <ffrench.mathi...@gmail.com>
Subject ActiveMQ JMS client in Felix and ObjectMessage with serliazed class throw exception when receiving this message
Date Fri, 21 Aug 2009 11:33:18 GMT

Hello,

I discovered a new problem when I try to receive a JMS ObjectMessage under
felix environment.

To help you to understand my point I make a OSGI sample in which I define
two commands to execute on the felix shell:

send_obj_msg <queuer_address> <queuer_port> <queue>
and 
receive_obj_msg <queuer_address> <queuer_port> <queue>

When I send my ObjectMessage I set the object defined in my sample called
SerializableClass which implements the interface SerializableInterface. 

The problem comes when I try to receive the message. I get this exception :

javax.jms.JMSException: Failed to build body from content. Serializable
class not available to broker. Reason: java.lang.ClassNotFoundException: ***
Class 'samples.osgi.test.jms.SerializableClass' was not found because bundle
5 does not import 'samples.osgi.test.jms' even though bundle 6 does export
it. To resolve this issue, add an import for 'samples.osgi.test.jms' to
bundle 5. ***
    at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
    at
org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:179)
    at samples.osgi.test.jms.AMQJmsTools$2.onMessage(AMQJmsTools.java:112)
    at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1080)
    at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:127)
    at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:197)
    at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
    at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: *** Class
'samples.osgi.test.jms.SerializableClass' was not found because bundle 5
does not import 'samples.osgi.test.jms' even though bundle 6 does export it.
To resolve this issue, add an import for 'samples.osgi.test.jms' to bundle
5. ***
    at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1460)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at
org.apache.activemq.util.ClassLoadingAwareObjectInputStream.load(ClassLoadingAwareObjectInputStream.java:63)
    at
org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:37)
    at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at
org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:177)
    ... 9 more
Caused by: java.lang.ClassNotFoundException:
samples.osgi.test.jms.SerializableClass
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:618)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
    ... 21 more

Note: bundle 5 is the activemq bundle which contains the JMS
implementations. bundle 6 is my OSGI JMS sample with my command which
receive the message.

The problem seems to comes from the fact that ActiveMQ JMS implementation
play with the ClassLoader and in the case of Felix this class loader return
the error :

Class 'samples.osgi.test.jms.SerializableClass' was not found because bundle
5 does not import 'samples.osgi.test.jms' even though bundle 6 does export
it. To resolve this issue, add an import for 'samples.osgi.test.jms' to
bundle 5.

So one solution would be to add an import like explained in the error but I
don't think it's the good one :)

Is there anybody who already get this error and who have a valuable
workaround/correction ?

Thanks for all

PS : in attachement in send you my OSGI sample maven project and the
config.properties in the same zip. I started ActiveMQ 5.3. snapshot in
standalone outside the Felix environment...
http://www.nabble.com/file/p25076413/OSGI.SAMPLE.zip OSGI.SAMPLE.zip 
-- 
View this message in context: http://www.nabble.com/ActiveMQ-JMS-client-in-Felix-and-ObjectMessage-with-serliazed-class-throw-exception-when-receiving-this-message-tp25076413p25076413.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message