jinfeng_wang

G-G-S,D-D-U!

BlogJava 首页 新随笔 联系 聚合 管理
  400 Posts :: 0 Stories :: 296 Comments :: 0 Trackbacks
1)copy your jolt lib to the weblogic domain. and this jar lib will be appended to the end of the weblogic classpath
[root@rhelserver lib]# cp /home/oracle/tuxedo10gR3/udataobj/jolt/jolt.jar  ./
[root@rhelserver lib]# cp /home/oracle/tuxedo10gR3/udataobj/jolt/joltjse.jar  ./
[root@rhelserver lib]# cp /home/oracle/tuxedo10gR3/udataobj/jolt/joltwls.jar  ./


2)add the startup and shutdown class in your domain.
 
3)add the joltpool to your weblogic. 

4)write your servlet program to call the tuxedo service:
 1 
 2 import java.io.IOException;
 3 import javax.servlet.ServletException;
 4 import javax.servlet.http.HttpServlet;
 5 import javax.servlet.http.HttpServletRequest;
 6 import javax.servlet.http.HttpServletResponse;
 7 
 8 import bea.jolt.pool.SessionPoolManager;
 9 import bea.jolt.pool.servlet.ServletSessionPool;
10 import bea.jolt.pool.servlet.ServletSessionPoolManager;
11 
12 /**
13  * Servlet implementation class TestJolt
14  */
15 public class TestJolt extends HttpServlet {
16     private static final long serialVersionUID = 1L;
17 
18     /**
19      * Default constructor.
20      */
21     public TestJolt() {
22         // TODO Auto-generated constructor stub
23     }
24 
25     /**
26      * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
27      *      response)
28      */
29     protected void doGet(HttpServletRequest request,
30             HttpServletResponse response) throws ServletException, IOException {
31 
32         bea.jolt.pool.servlet.ServletResult result;
33 
34         response.setContentType("text/html;charset=UTF-8");
35 
36         java.io.PrintWriter out = response.getWriter();
37         out.println("<br>begin");
38 
39         ServletSessionPoolManager bool_mgr = (ServletSessionPoolManager) SessionPoolManager.poolmgr;
40         ServletSessionPool pool_session = (ServletSessionPool) bool_mgr
41                 .getSessionPool("joltConnectionPool");  //set your weblogic's joltpool name
42 
43         if (pool_session == null) {
44             out.println("<br>fail");
45             out.close();
46             return;
47         }
48         System.out.println(pool_session);
49 
50         String sendvalue;
51         sendvalue = request.getParameter("STRING");  //this is your input parameter to the TOUPPER service.
52         System.out.println(sendvalue);
53 
54         try {
55             System.out.println("OK!");
56 
57             result = pool_session.call("TOUPPER", request);
58             out.println("<br>return val:" + result.getValue("STRING"""));
59         } catch (bea.jolt.pool.SessionPoolException e) {
60 
61             out.println("<br>busy");
62         } catch (bea.jolt.pool.ServiceException e) {
63 
64             e.printStackTrace();
65         } catch (bea.jolt.pool.ApplicationException e) {
66 
67             result = (bea.jolt.pool.servlet.ServletResult) e.getResult();
68             e.printStackTrace();
69 
70         } catch (Exception e) {
71             e.printStackTrace();
72         }
73 
74         out.println("\n");
75         out.close();
76 
77     }
78 
79     /**
80      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
81      *      response)
82      */
83     protected void doPost(HttpServletRequest request,
84             HttpServletResponse response) throws ServletException, IOException {
85         doGet(request, response);
86     }
87 
88 }
89 


5) deploy your web war to weblogic , and browser to access your servlet:
     URL :  http://192.168.226.129:7001/TestJolt/TestJolt?STRING=aaaaaaaaaa
posted on 2009-05-26 18:09 jinfeng_wang 阅读(1209) 评论(0)  编辑  收藏 所属分类: tuxedoweblogic

只有注册用户登录后才能发表评论。


网站导航: