|
weblogic queue
|
|||
---|---|---|---|
#18+
привет всем никак не получается отправить сообщение на QUEUE к WebLogic . package queuesend ; //examples.jms.queue; Код в Java import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Hashtable; import java.util.Queue; import javax.jms.*; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; /** This example shows how to establish a connection * and send messages to the JMS queue. The classes in this * package operate on the same JMS queue. Run the classes together to * witness messages being sent and received, and to browse the queue * for messages. The class is used to send messages to the queue. * * @author Copyright (c) 1999-2005 by BEA Systems, Inc. All Rights Reserved. */ public class QueueSend { // Defines the JNDI context factory. public final static String JNDI_FACTORY= "weblogic.jndi.WLInitialContextFactory"; // Defines the JMS context factory. public final static String JMS_FACTORY="ConnectionFactory-0"; // Defines the queue. public final static String QUEUE="UPLOAD"; private QueueConnectionFactory qconFactory; private QueueConnection qcon; private QueueSession qsession; private QueueSender qsender; private Queue queue; private TextMessage msg; /** * Creates all the necessary objects for sending * messages to a JMS queue. * * @param ctx JNDI initial context * @param queueName name of queue * @exception NamingException if operation cannot be performed * @exception JMSException if JMS fails to initialize due to internal error */ 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); qsender = qsession.createSender((javax.jms.Queue) queue); msg = qsession.createTextMessage(); qcon.start(); } /** * Sends a message to a JMS queue. * * @param message message to be sent * @exception JMSException if JMS fails to send message due to internal error */ public void send(String message) throws JMSException { msg.setText(message); qsender.send(msg); } /** * Closes JMS objects. * @exception JMSException if JMS fails to close objects due to internal error */ public void close() throws JMSException { qsender.close(); qsession.close(); qcon.close(); } /** main() method. * * @param args WebLogic Server URL * @exception Exception if operation fails */ public static void main(String[] args) throws Exception { if (args.length != 1) { // System.out.println("Usage: java examples.jms.queue.QueueSend WebLogicURL"); return; } InitialContext ic = getInitialContext(args[0]); QueueSend qs = new QueueSend(); qs.init(ic, QUEUE); readAndSend(qs); qs.close(); } private static void readAndSend(QueueSend qs) throws IOException, JMSException { BufferedReader msgStream = new BufferedReader(new InputStreamReader(System.in)); String line=null; boolean quitNow = false; do { System.out.print("Enter message (\"quit\" to quit): \n"); line = msgStream.readLine(); if (line != null && line.trim().length() != 0) { qs.send(line); System.out.println("JMS Message Sent: "+line+"\n"); quitNow = line.equalsIgnoreCase("quit"); } } while (! quitNow); } // @SuppressWarnings("unchecked") private static InitialContext getInitialContext(String url) throws NamingException { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY); env.put(Context.PROVIDER_URL, url); return new InitialContext(env); } } возвращает результат: "C:\Program Files\Java\jdk1.7.0_67\bin\javaw.exe" -server -classpath C:\JDeveloper\mywork\JMSTests\.adf;C:\JDeveloper\mywork\JMSTests\QueueSend\classes;E:\DISTR\jdeveloper\jlib\javax.jms.jar;E:\DISTR\jdeveloper\jlib\wljmsclient.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar queuesend.QueueSend Process exited with exit code 0. после ничего нет , в JMS Server в чем может быть проблема ? спасибо ... |
|||
:
Нравится:
Не нравится:
|
|||
04.11.2014, 18:26 |
|
weblogic queue
|
|||
---|---|---|---|
#18+
код Java в Oracle VDeveloper 12C ... |
|||
:
Нравится:
Не нравится:
|
|||
04.11.2014, 18:29 |
|
weblogic queue
|
|||
---|---|---|---|
#18+
talich2005, Вы уверены, что не ошиблись разделом? ... |
|||
:
Нравится:
Не нравится:
|
|||
05.11.2014, 16:08 |
|
weblogic queue
|
|||
---|---|---|---|
#18+
может ошибся , но подходящего раздела нет ... |
|||
:
Нравится:
Не нравится:
|
|||
05.11.2014, 16:11 |
|
weblogic queue
|
|||
---|---|---|---|
#18+
talich2005, Я бы предположил, что более подходящий все же Java . А сюда заходят только интересующиеся .Net/WCF, я думаю. ... |
|||
:
Нравится:
Не нравится:
|
|||
05.11.2014, 18:16 |
|
|
start [/forum/topic.php?fid=19&fpage=8&tid=1396947]: |
0ms |
get settings: |
10ms |
get forum list: |
14ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
51ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
48ms |
get tp. blocked users: |
2ms |
others: | 297ms |
total: | 446ms |
0 / 0 |