Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7910877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:02:23+00:00 2026-06-03T13:02:23+00:00

I am new to Queues. I had setup my queue in JBOSS 5.1 EAP

  • 0

I am new to Queues. I had setup my queue in JBOSS 5.1 EAP and now while trying to inject in tho the queue am getting a ClassCastException (in lookup of JNDI), I use flex on my front end and use Spring framework for flex. When injected into the queue using quartz job it runs well and good. The quartz job is a separate project and has nothing to do with flex and spring.

I read over some where that this could be a jar issue, I had JMS jars in my spring and i tried removing, replacing all types of jars, no luck.

        // Step 1. Create an initial context to perform the JNDI lookup.

        InputStream in = this.getClass().getResourceAsStream(
                "/clv2.properties");
        Properties configProp = new Properties();
        configProp.load(in);
        IpAddress = configProp.getProperty("ipaddress");
        port = configProp.getProperty("port");
        inQueueName = configProp.getProperty("inQueueName");
        Properties props = new Properties();
        props.setProperty("java.naming.factory.initial",
                "org.jnp.interfaces.NamingContextFactory");
        props.setProperty("java.naming.factory.url.pkgs",
                "org.jboss.naming");
        // props.setProperty("java.naming.provider.url", host + ":" + port);
        props.setProperty("java.naming.provider.url", "localhost" + ":"
                + 1099);
        // props.setProperty("java.naming.provider.url",
        // "16.181.233.61:1399");
        initialContext = new InitialContext(props);

        // Step 3. Perform a lookup on the Connection Factory
        QueueConnectionFactory cf = (QueueConnectionFactory) initialContext
                .lookup("/ConnectionFactory");
        Queue queue = (Queue) initialContext
                .lookup(/* "/queue/CLVInboundQueue" */inQueueName);
        // Step 4.Create a JMS Connection
        connection = (QueueConnection) cf.createConnection();

        // Step 5. Create a JMS Session
        session = (QueueSession) connection.createSession(false,
                Session.AUTO_ACKNOWLEDGE);

        // Step 6. Create a JMS Message Producer
        // MessageProducer producer = session.createProducer(queue);
        QueueSender queueSender = session.createSender(queue);
        TextMessage textMessage = session.createTextMessage(message);
        textMessage.setLongProperty("Rejected_Message_ID",
                rejected_Message_Id);
        /*
         * BufferedReader reader = new BufferedReader(new
         * InputStreamReader(ClassLoader.class.getResourceAsStream(file)));
         * StringBuilder sb = new StringBuilder(); String line = null;
         * 
         * 
         * while ((line = reader.readLine()) != null) { sb.append(line +
         * "\n"); } String announcementmsg = sb.toString();
         */
        commonlogger.info(textMessage);
        connection.start();
        // producer.send(session.createTextMessage(announcementmsg));
        queueSender.send(textMessage);

This is my piece of coding to inject into the queue. I get the Exception in “//Step 3. Perform a lookup on the Connection Factory” and this is my stack trace.

09:22:20,730 ERROR [STDERR] java.lang.ClassCastException: org.jboss.jms.client.JBossConnectionFactory cannot be cast to javax.jms.QueueConnectionFactory
09:22:20,731 ERROR [STDERR]     at com.cat.clv.util.InQueueReinjectMessage.sendMessage(InQueueReinjectMessage.java:63)
09:22:20,731 ERROR [STDERR]     at com.cat.clv.util.RejectedMessageReinject.reProcessedMessage(RejectedMessageReinject.java:65)
09:22:20,731 ERROR [STDERR]     at com.cat.clv.service.ReinjectMessagesServiceImpl.reinjectRejectedMessages(ReinjectMessagesServiceImpl.java:106)
09:22:20,731 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
09:22:20,731 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
09:22:20,732 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
09:22:20,732 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Unknown Source)
09:22:20,732 ERROR [STDERR]     at flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdapter.java:421)
09:22:20,732 ERROR [STDERR]     at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
09:22:20,732 ERROR [STDERR]     at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1503)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:02:29+00:00Added an answer on June 3, 2026 at 1:02 pm

    If you look at the source of JBossConnectionFactory then you will see it implements QueueConnectionFactory.

    So this class cast exception can be because of :

    1. Erroneous installation of JBoss
    2. Different jms.jar in client and server

    Can you first try out option 2 and see if it works, if not can you check if the examples work in your jboss installation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am rather new with gevent but I an trying to create a queue
I am using msgget() syscall to get new msg queue. I have used the
The latest Google App Engine release supports a new Task Queue API in Python.
I'm currently doing it like this: MessageQueue queue = new MessageQueue(.\Private$\myqueue); MessageEnumerator messageEnumerator =
Does anybody have any experience with TFS no longer letting somebody queue a new
I used 5 threads to create new InetSocketAddress and store them in queue, but
First of all, I'm new to ZeroMQ and message queue systems, so what I'm
New to linux and trying to escape doing this the hard way. I have
I am trying to write a mail utility that places mails in a queue,
New to Objective-C and iOS development, would love a hand here! I have written

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.