够详细了吗1.启动数据库2.启动weblogic3.启动浏览器,在地址栏输入http://localhost:7001/console。在登录
  界面输入用户名和密码进入管理界面4. 配置JMS服务的步骤为:
   4.1 配置连接工厂(Connection Factories)
   4.2 配置消息存储(Message Stores)
   4.3 配置JMS服务器(JMS Servers)
   4.4 配置消息目的地(Destinations) 4.1 配置连接工厂(Connection Factories)
  JMS中连接工厂分QueueConnectionFactory和TopicConnectionFactory
两种,Weblogic不区分这两种类型。但我们最好还是配置两种工厂类型。
 a.配置QueueConnectionFactry
 在浏览器的左边树状菜单中选择:
    Services->JMS->Connection Factories
 在浏览器右边点击链接Configure a new JMS Connection Factory...,
输入以下信息:
    Name: JMS QueueConnection Factory
    JNDI Name: jms/QueueConnectionFactory
 点击底部按钮Create,选择:
    Targets: myserver
 点击Apply完成操作
 b.配置TopicConnectionFactry
 在浏览器的左边树状菜单中选择:
    Services->JMS->Connection Factories
 在浏览器右边点击链接Configure a new JMS Connection Factory...,
输入以下信息:
    Name: JMS TopicConnection Factory
    JNDI Name: jms/TopicConnectionFactory
 点击底部按钮Create,选择:
    Targets: myserver
 点击Apply完成操作 4.2 配置消息存储(Message Stores)
  weblogic中消息存储方式可分两种方式,一是把消息保存到文件系统中,
二是把消息保存到数据库中。
  a.配置文件存储方式:
   在浏览器的左边树状菜单中选择:
    Services->JMS->Stores
    在浏览器右边点击链接Configure a new JMS File Store...,
输入以下信息:
    Name: JMS File Store
    Directory: c:\jmsstore
 点击底部按钮Create完成操作
  b.配置数据库存储方式:
  前提:你已经配置过JDBC的连接池(Connection pool),且此连接池处于
  运行状态。
     在浏览器的左边树状菜单中选择:
    Services->JMS->Stores
    在浏览器右边点击链接Configure a new JMS JDBC Store...,
输入以下信息:
    Name: JMS JDBC Store
    Connection Pool: <选择配置好的连接池>
    Prefix Name: zouy(防止表名冲突,你可输入不同的前缀)
 点击底部按钮Create完成操作 4.3 配置JMS服务器(JMS Servers)
 每个JMS Server只能管理一个消息存储介质,针对以上配置,我们配置
两个JMS Server分别管理文件方式和数据库方式的存储方式。
  a.配置文件存储JMS Server
  在浏览器的左边树状菜单中选择:
    Services->JMS->Servers
    在浏览器右边点击链接Configure a new JMS Server...,
输入以下信息:
    Name: JMS File Server
    Persistent Store: JMS File Store
点击底部按钮Create进入下一个页面,选择:
    Target: myserver
点击Apply完成操作。
  b.配置数据库存储JMS Server
  在浏览器的左边树状菜单中选择:
    Services->JMS->Servers
    在浏览器右边点击链接Configure a new JMS Server...,
输入以下信息:
    Name: JMS JDBC Server
    Persistent Store: JMS JDBC Store
点击底部按钮Create进入下一个页面,选择:
    Target: myserver
点击Apply完成操作。 4.4 配置消息目的地(Destinations)
  消息目的地是被JMS Server管理的,消息如何存储对配置消息目的地是
透明的。因此仅以配置JMS File Server管理的目的地为例。目的地分Queue
和Topic两种,以下分别配置。
  a.配置Queue
    在浏览器的左边树状菜单中选择:
    Services->JMS->Servers->JMS File Server->Destionations
    在浏览器右边点击链接Configure a new JMS Queue...,
输入以下信息:
    Name: JMS File Queue
    JNDI Name: jms/fileQueue
 点击底部按钮Create完成操作
 b.配置Topic
    在浏览器的左边树状菜单中选择:
    Services->JMS->Servers->JMS File Server->Destionations
    在浏览器右边点击链接Configure a new JMS Topic...,
输入以下信息:
    Name: JMS File Topic
    JNDI Name: jms/fileTopic
 点击底部按钮Create完成操作

解决方案 »

  1.   

    写一个server跟client端,这是我以前写的一个测试程序:import javax.jms.QueueConnectionFactory;
    import javax.jms.QueueConnection;
    import javax.jms.QueueSession;
    import javax.jms.Queue;
    import javax.jms.QueueSender;
    import javax.jms.TextMessage;
    import javax.jms.JMSException;import javax.naming.Context;
    import javax.naming.IntialContext;
    import javax.naming.NamingException;public class QMProducer{
      public static void main(String[] args){
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
           "weblogic.jndi.WLInitialContextFactory");
        System.setProperty(Context.PROVIDER_URL,
           "t3://localhost:7001" );
        QueueConnection con = null;
        QueueSession session = null;
        QueueSender sender = null;   
        Context ctx = null;
        
        try{
           ctx = new InitialContext();       //step 1. look up a QueueConnectionFactory
           QueueConnectionFactory factory = 
             (QueueConnectionFactory)
                ctx.lookup("jms/QueueConnectionFactory");       //step 2. create a QueueConnection
           con = factory.createQueueConnection();       //step 3. create a QueueSession
           session = con.createQueueSession(
               false,
               QueueSession.AUTO_ACKNOWLEDGE
              );       //step 4. look up a Queue
          Queue queue = (Queue)ctx.lookup("jms/fileQueue");        //step 5. create a QueueSender
          sender = session.createSender(queue);       //step 6. create a TextMessage
          TextMessage tmsg = session.createTextMessage();
          tmsg.setText("Oh, Guy, JMS is too simple");       //step 7. send the message to the JMS Server
          sender.send(tmsg);    }catch(NamingException ne){ ne.printStackTrace();}
         catch(JMSException jse){jse.printStackTrace();}
         finally{
           if(sender != null) try{ sender.close()}catch(JMSException e){}
           if(session != null) try{ session.close()}catch(JMSException e){}
           if(con != null) try{ con.close()}catch(JMSException e){}
           if(ctx != null) try{ ctx.close()}catch(NamingException e){}
         }
      }}
    ============================================================
    import javax.jms.QueueConnectionFactory;
    import javax.jms.QueueConnection;
    import javax.jms.QueueSession;
    import javax.jms.Queue;
    import javax.jms.QueueReceiver;
    import javax.jms.TextMessage;
    import javax.jms.JMSException;import javax.naming.Context;
    import javax.naming.IntialContext;
    import javax.naming.NamingException;public class QMConsumer{
      public static void main(String[] args){
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
           "weblogic.jndi.WLInitialContextFactory");
        System.setProperty(Context.PROVIDER_URL,
           "t3://localhost:7001" );
        QueueConnection con = null;
        QueueSession session = null;
        QueueReceiver reciver = null;   
        Context ctx = null;
        
        try{
           ctx = new InitialContext();       //step 1. look up a QueueConnectionFactory
           QueueConnectionFactory factory = 
             (QueueConnectionFactory)
                ctx.lookup("jms/QueueConnectionFactory");       //step 2. create a QueueConnection
           con = factory.createQueueConnection();       //step 3. create a QueueSession
           session = con.createQueueSession(
               false,
               QueueSession.AUTO_ACKNOWLEDGE
              );       //step 4. look up a Queue
          Queue queue = (Queue)ctx.lookup("jms/fileQueue");        //step 5. create a QueueReceiver
          QueueReceiver receiver = session.createReceiver(queue);
           //step 6. call start() on con
          con.start();
           //step 7. call receive() on receiver to get
           //        message from the JMS Server
          TextMessage tmsg = (TextMessage)receiver.receive();
          System.out.println(tmsg.getText()); 
        }catch(NamingException ne){ ne.printStackTrace();}
         catch(JMSException jse){jse.printStackTrace();}
         finally{
           if(receiver != null) try{ receiver.close()}catch(JMSException e){}
           if(session != null) try{ session.close()}catch(JMSException e){}
           if(con != null) try{ con.close()}catch(JMSException e){}
           if(ctx != null) try{ ctx.close()}catch(NamingException e){}
         }
      }}