WTC配置(二)
来源:互联网 发布:多个工厂模式 java 编辑:程序博客网 时间:2024/05/21 21:40
3 EJB程序开发
3.1编写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);
}
}
}
EJBHome和Romote接口不用写,稍后处理。
3.2配置ejb-jar.xml
<?xml version="1.0" encoding="GBK"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">
<enterprise-beans>
<session>
<ejb-name>TOLOWEREJB</ejb-name>
<home>weblogic.wtc.jatmi.TuxedoServiceHome</home>
<remote>weblogic.wtc.jatmi.TuxedoService</remote>
<ejb-class>org.flying.ejb.WeblogicEjb</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>TOLOWEREJB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
重要:配置中<home/>和<remote/>被配置为weblogic.wtc.jatmi.TuxedoServiceHome和weblogic.wtc.jatmi.TuxedoService,这是WTC配置的要求,是他们tuxedo ejb服务的统一入口,所以开发中不用写home和romote接口。
3.3配置weblogic-ejb-jar.xml
<?xml version="1.0" ?>
<weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
<weblogic-enterprise-bean>
<ejb-name>TOLOWEREJB</ejb-name>
<stateless-session-descriptor>
<pool>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
<initial-beans-in-free-pool>5</initial-beans-in-free-pool>
</pool>
</stateless-session-descriptor>
<transaction-descriptor>
<trans-timeout-seconds>0</trans-timeout-seconds>
</transaction-descriptor>
<enable-call-by-reference>true</enable-call-by-reference>
<jndi-name>TOLOWER</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3.4 EJB程序打包成JAR
使用MyEclipse中的项目导出(Export)功能,将java文件导出成JAR文件EJB.jar。- WTC配置(二)
- WTC配置(一)
- WTC配置(三)
- WTC配置(四)
- WTC配置
- WTC配置步骤
- WTC配置参数说明
- 为WTC配置TUXEDO配置文件ubbconfig
- 为WTC配置TUXEDO配置文件domconfig
- 为WTC配置WEBLOGIC服务访问点
- 为WTC配置TUXEDO配置文件domconfig
- TUXEDO与WEBLOGIC通过WTC进行互连的配置(转)
- TUXEDO与WEBLOGIC通过WTC进行互连的配置
- TUXEDO与WEBLOGIC通过WTC进行互连的配置
- wtc重连脚本
- WTC服务相关
- Erlang 配置(二)
- AFS 配置(二)
- 学习中参考的一些网站(不断更新中)
- 为交房租做App:我第一年赚了7万美金
- 使用禅道来进行项目任务管理
- mysql修改密码命令
- 并行前缀求和的算法
- WTC配置(二)
- App手机应用自建平台 无需编码技术 轻松制作
- os/os_cpu_a.s
- CSS3 Animation
- EJB事务管理--bug修改记
- 向指定URL发送get,post方法的请求(java)
- base64编码,用于url中传输的base64
- Spring :Null and empty string values
- WTC配置(三)