根异常是java.rmi.ConnectIOException:远程端点

时间:2016-02-13 09:38:34

标签: java queue jms weblogic jms-topic

我正在尝试从服务器读取JMS queue,我能够从我的机器ping IP和端口,但是当我执行我的队列程序时,它会抛出以下错误,任何帮助都会受到赞赏。

public class QueueReceive implements MessageListener
{
 public final static String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory";
 public final static String JMS_FACTORY="NotifyDestQCF"; 
 public final static String QUEUE="NOTIFY_DEST_QUEUE"; 
 private QueueConnectionFactory qconFactory;
 private QueueConnection qcon;
 private QueueSession qsession;
 private QueueReceiver qreceiver;
 private Queue queue;
 private boolean quit = false;
 public void onMessage(Message msg)
 {
    try {
     String msgText;
     if (msg instanceof TextMessage) {
       msgText = ((TextMessage)msg).getText();
     } else {
       msgText = msg.toString();
     }
     System.out.println("Message Received: "+ msgText );
     if (msgText.equalsIgnoreCase("quit")) {
       synchronized(this) {
         quit = true;
         this.notifyAll(); // Notify main thread to quit
       }
     }
    } catch (JMSException jmse) {
     System.err.println("An exception occurred: "+jmse.getMessage());
    }
 }
 public void init(Context ctx, String queueName)
    throws NamingException, JMSException
 {
    qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);
    qcon = qconFactory.createQueueConnection();
    qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    queue = (Queue) ctx.lookup(queueName);
    qreceiver = qsession.createReceiver(queue);
    qreceiver.setMessageListener(this);
    qcon.start();
 }

 public void close()throws JMSException
 {
    qreceiver.close();
    qsession.close();
    qcon.close();
 }
 public static void main(String[] args) throws Exception {
    if (args.length != 1) {
     System.out.println("Usage: java examples.jms.queue.QueueReceive WebLogicURL");
     return;
    }
     InitialContext ic = getInitialContext(args[0]);
    QueueReceive qr = new QueueReceive();
    qr.init(ic, QUEUE);

    System.out.println(
        "JMS Ready To Receive Messages (To quit, send a \"quit\" message).");

    // Wait until a "quit" message has been received.
    synchronized(qr) {
     while (! qr.quit) {
       try {
         qr.wait();
       } catch (InterruptedException ie) {}
     }
    }
    qr.close();
 }
 private static InitialContext getInitialContext(String url)
    throws NamingException
 {
    Hashtable env = new Hashtable();
    System.out.print("Gmail mohanraj rasappan");
    env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
    env.put(Context.PROVIDER_URL, url);
    return new InitialContext(env);
 }
}

Args [0]是t3://172.26.169.57:7001。例外:

Exception in thread "main" javax.naming.CommunicationExce ption
[Root exception is java.rmi.ConnectIOException: non-JRMP server at
remote endpoint]
        at weblogic.jrmp.Context.lookup(Context.java:189)
        at weblogic.jrmp.Context.lookup(Context.java:195)
        at javax.naming.InitialContext.lookup(InitialContext.java:411)
        at client.QueueReceive.init(QueueReceive.java:76)
        at client.QueueReceive.main(QueueReceive.java:109) Caused by: java.rmi.ConnectIOException: non-JRMP server at remote endpoint
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:248
)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:341)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
        at weblogic.jrmp.Context.lookup(Context.java:185)
        ... 4 more

0 个答案:

没有答案
相关问题