Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 9033 invoked from network); 21 Aug 2009 11:33:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Aug 2009 11:33:28 -0000 Received: (qmail 53028 invoked by uid 500); 21 Aug 2009 11:33:50 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 52951 invoked by uid 500); 21 Aug 2009 11:33:50 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 52941 invoked by uid 99); 21 Aug 2009 11:33:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Aug 2009 11:33:50 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Aug 2009 11:33:39 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1MeSMw-0004Ai-Pg for users@activemq.apache.org; Fri, 21 Aug 2009 04:33:18 -0700 Message-ID: <25076413.post@talk.nabble.com> Date: Fri, 21 Aug 2009 04:33:18 -0700 (PDT) From: ffrenchm To: users@activemq.apache.org Subject: ActiveMQ JMS client in Felix and ObjectMessage with serliazed class throw exception when receiving this message MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: ffrench.mathilde@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org 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 and receive_obj_msg 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.