Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Classcast exception
Classcast exception [message #1749510] Wed, 07 December 2016 14:58 Go to next message
Giuseppe Colosimo is currently offline Giuseppe ColosimoFriend
Messages: 1
Registered: December 2016
Junior Member
Hi all,
in my bundle I'm using qpid libraries to establish an AMQP connection, but I have the following error:
java.lang.ClassCastException: org.apache.qpid.jms.JmsConnectionFactory cannot be cast to org.apache.qpid.jms.JmsConnectionFactory


The java code is:
        Properties props = new Properties();
        props.put(NAMING_FACTORY_INITIAL_KEY, NAMING_FACTORY_INITIAL_VALUE);
        props.put(FACTORY_LOOKUP_KEY, "amqps://" + host + ":" + port + "?amqp.idleTimeout=6000000");
        props.put(QUEUE_LOOKUP_KEY, "/devices/messages/events");

        Context context = new InitialContext(props);

        factory = (JmsConnectionFactory) context.lookup("myFactoryLookup");
        destination = (JmsQueue) context.lookup("myQueueLookup");
        String username = deviceId + deviceType + "@sas." + hostname;
        connection = factory.createConnection(username, token);
        System.out.println("Setted client");


It seems to me that the Kura classloader is loading two instances of the same jar. is it possible?
If is that the case, how can I avoid this situation?
In a stand alone version of the same code there are no errors at all.
Re: Classcast exception [message #1749708 is a reply to message #1749510] Fri, 09 December 2016 22:03 Go to previous message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hello,

How are you loading the qpid libraries? Are you adding them to the classpath of your bundle? Are you adding them via a separate bundle in the OSGi runtime? Also, providing your MANIFEST.MF file is often helpful.

Thanks,
--Dave
Previous Topic:kura log files
Next Topic:unable to create new native thread as non-root user
Goto Forum:
  


Current Time: Fri Apr 26 21:51:21 GMT 2024

Powered by FUDForum. Page generated in 0.02732 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top