当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·我的奇怪的硬盘    »显示摘要«
    摘要: 开机时提示说有bad sector然后自己运行scandisk 发现没有坏道,然而进入98后,玩一会儿就说c盘某处不能读写,于是愤怒,使用 磁盘扫描工具,沟上“完全“,结果发现1024字节坏道,但是今天我用pgmagic的 bad sector retest选项来查c盘,(然后又用了find error on c)却发现一点毛病都没有,这到底是怎么一回事啊。 ......
    摘要: 我用extractfiledir(application->exename);不行啊??那位大侠出出手啊! ......


JBoss下JMS的问题高分

我正在研究message   bean   ,由哪位可以帮我列一下在jboss下部署message   bean的流程,高分相送,嘻嘻!最好有个例子说明!

NO.1   作者: JessieWu

本人在前一段时间里,也在研究message   Bean,也是研究了一个多星期,终于我成功了,没有浪费我这一个多星  
   
  期以来的辛苦劳动。  
  我用的服务器是jboss3.0.6-tomcat4.1.18  
  例子是电子工业出版社出版的<EJB编程指南>第7章的<异步EJB>中基于消息驱动Bean的样本应用程序。  
  下面将代码贴出来  
  MessageBean类  
  /**   MessageBean.java  
    *     A   message   driven   bean    
    *     Receives   purchase   order   in   a   MapMessage,    
    *     processes   the   order   and   sends   a   thank-you   note   to   the   customer  
    *     by   sending   an   e-mail   notification.  
    */  
  package   examples.Message;  
  import   java.io.Serializable;  
  import   java.rmi.RemoteException;    
  import   javax.ejb.*;  
  import   javax.naming.*;  
  import   javax.jms.*;  
  import   java.util.*;  
  import   java.text.*;  
  import   javax.mail.*;  
  import   javax.activation.*;  
  import   javax.mail.internet.*;  
   
  /**   MessageBean   class   must   implement   two   interfaces    
    *     MessageDrivenBean   and   MessageListener  
    */  
  public   class   MessageBean   implements   MessageDrivenBean,    
          MessageListener   {  
   
          private   transient   MessageDrivenContext   context   =   null;  
   
          /**   a   no-argument   constructor  
            */  
          public   MessageBean()   {}  
   
          /**   called   by   container   during   object   creation  
            */  
          public   void   setMessageDrivenContext(MessageDrivenContext   context)    
          {  
                  this.context   =   context;  
          }  
   
          /**  
            *   The   onMessage   Method   receives   the   Message   parameter,   type   casts  
            *   it   to   the   appropriate   message   type   and   prints   the   contents   of   the  
            *   message.   A   mail   note   is   then   sent   to   the   message   sender  
            */  
          public   void   onMessage(javax.jms.Message   msg)   {  
                  try   {  
                      if   (msg   instanceof   MapMessage)   {  
                          MapMessage   map   =   (MapMessage)   msg;  
                          System.out.println("Order   received:   ");  
                          System.out.println   ("Order   ID:   "   +   map.getString("OrderID")   +   "   Item   ID:   "   +    
   
  map.getInt("ItemID")   + "   Quanity:   "   +   map.getInt("Quantity")   +   "   Unit   Price:   "   +    
   
  map.getDouble("UnitPrice"));  
                          sendNote   (map.getString("emailID"));  
                      }  
                      else   {  
                          System.out.println   ("wrong   message   type");  
                      }  
                  }   catch   (Throwable   te)   {  
                      te.printStackTrace();  
                  }  
          }  
   
          /**   Sends   an   e-mail   notification   to   the   recipient   e-mail   ID  
            *     specified   in   the   input   parameter  
            */  
          private   void   sendNote(String   recipient)   {  
                  try   {  
                      //   Initialize   JNDI   context  
                      Context   initial   =   new   InitialContext();  
       
                      //   look   up   the   mail   server   session  
                      javax.mail.Session   session   =   (javax.mail.Session)    
   
  initial.lookup("java:comp/env/MailSession");  
   
                      //   Create   a   new   mail   object  
                      javax.mail.Message   msg   =   new   MimeMessage(session);  
       
                      //   set   various   mail   properties  
                      msg.setFrom();  
       
                      msg.setRecipients(javax.mail.Message.RecipientType.TO,   InternetAddress.parse(recipient,    
   
  false));  
     
                      msg.setSubject("Order   Confirmation");  
       
                      DateFormat   dateFormatter   =   DateFormat.getDateTimeInstance(DateFormat.LONG,    
   
  DateFormat.SHORT);  
       
                      Date   timeStamp   =   new   Date();  
     
                      String   messageText   =   "Thank   you   for   your   order."   +   \n +   "We   received   your   order    
   
  on   "   +   dateFormatter.format(timeStamp)   +   ".";  
     
                      msg.setText(messageText);  
     
                      msg.setSentDate(timeStamp);  
   
                      //   send   the   mail   message  
                      Transport.send(msg);  
       
                  }   catch(Exception   e)   {  
                      throw   new   EJBException(e.getMessage());  
                  }  
          }  
   
          public   void   ejbCreate()   {}  
          public   void   ejbRemove()   {}  
  }  
   
 


    摘要: 要grant什么权限呢,创建表空间的具体命令是什么呀?谢谢 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE