WeblogicEjb.javaimport 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); } }}
ejb-jar.xml
<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>
weblogic-ejb-jar.xml <wls:weblogic-enterprise-bean>
<wls:ejb-name>TOLOWEREJB</wls:ejb-name>
<wls:stateless-session-descriptor>
<wls:business-interface-jndi-name-map>
<wls:business-remote>org.flying.ejb.WeblogicEjb</wls:business-remote>
<wls:jndi-name>TOLOWER</wls:jndi-name>
</wls:business-interface-jndi-name-map>
</wls:stateless-session-descriptor>
</wls:weblogic-enterprise-bean>
大虾们帮忙看看,万谢!
ejb-jar.xml
<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>
weblogic-ejb-jar.xml <wls:weblogic-enterprise-bean>
<wls:ejb-name>TOLOWEREJB</wls:ejb-name>
<wls:stateless-session-descriptor>
<wls:business-interface-jndi-name-map>
<wls:business-remote>org.flying.ejb.WeblogicEjb</wls:business-remote>
<wls:jndi-name>TOLOWER</wls:jndi-name>
</wls:business-interface-jndi-name-map>
</wls:stateless-session-descriptor>
</wls:weblogic-enterprise-bean>
大虾们帮忙看看,万谢!
这一行的jndi名字可以随便取吗