Chinaunix首页 | 论坛 | 博客
  • 博客访问: 314182
  • 博文数量: 50
  • 博客积分: 3095
  • 博客等级: 中校
  • 技术积分: 510
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-22 10:43
文章分类

全部博文(50)

文章存档

2014年(1)

2012年(1)

2011年(2)

2010年(3)

2009年(6)

2008年(20)

2007年(15)

2006年(2)

我的朋友

分类:

2008-04-07 10:44:04

程序开发

编写WeblogicEJB.java

package org.flying.ejb;

 

import javax.ejb.CreateException;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.naming.NamingException;

 

import weblogic.wtc.jatmi.TPException;

import weblogic.wtc.jatmi.TypedString;

import weblogic.wtc.jatmi.Reply;

import weblogic.wtc.jatmi.TPServiceInformation;

 

public class WeblogicEjb implements SessionBean {

       private static final long serialVersionUID = 1L;

       static final boolean VERBOSE = true;

       private SessionContext ctx;

       /**

        * Sets the session context.

        * @param ctx

        *            SessionContext Context for session

        */

       public void setSessionContext(SessionContext ctx) {

              this.ctx = ctx;

       }

       /**

        * This method is required by the EJB Specification, but is not used by this

        * example.

        *

        */

       public void ejbActivate() {

       }

       /**

        * This method is required by the EJB Specification, but is not used by this

        * example.

        *

        */

       public void ejbPassivate() {

       }

       /**

        * This method is required by the EJB Specification, but is not used by this

        * example.

        *

        */

       public void ejbRemove() {

       }

       public void ejbCreate() throws CreateException {

       }

       public Reply service(TPServiceInformation mydata) throws TPException {

              TypedString data;

              String lowered;

              TypedString return_data;

              data = (TypedString) mydata.getServiceData();

              log("converting " + data);

              lowered = data.toString().toLowerCase();

              log("converted " + data);

              return_data = new TypedString(lowered);

              mydata.setReplyBuffer(return_data);

              return (mydata);

       }

       private void log(String s) {

              if (VERBOSE) {

                     System.out.println(s);

              }

       }

}

EJBHomeRomote接口不用写,稍后处理。

配置ejb-jar.xml

       xmlns:xsi=""

       xsi:schemaLocation=" /ejb-jar_2_1.xsd"

       version="2.1">

      

             

                     TOLOWEREJB

                     weblogic.wtc.jatmi.TuxedoServiceHome

                     weblogic.wtc.jatmi.TuxedoService

                     org.flying.ejb.WeblogicEjb

                     Stateless

                     Container

             

      

      

             

                    

                            TOLOWEREJB

                            *

                    

                     Supports

             

      

重要:配置中被配置为weblogic.wtc.jatmi.TuxedoServiceHomeweblogic.wtc.jatmi.TuxedoService,这是WTC配置的要求,是他们tuxedo ejb服务的统一入口,所以开发中不用写homeromote接口。

配置weblogic-ejb-jar.xml

       xmlns:j2ee=""

       xmlns:xsi=""

       xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">

      

              TOLOWEREJB

             

                    

                            100

                            5

                    

             

             

                     0

             

              true

              TOLOWER

      

程序打包成JAR

使用MyEclipse中的项目导出(Export)功能,将java文件导出成JAR文件EJB.jar
阅读(5073) | 评论(0) | 转发(0) |
0

上一篇:WTC的配置(一)

下一篇:WTC的配置(三)

给主人留下些什么吧!~~