首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    was ejb学习[通俗易懂]

    大家好,又见面了,我是你们的朋友全栈君。 最近因为项目需要,对ilog进行了学习,包括ilog在was的安装以及客户端连接ilog等内容。 个人感觉很多是通过ejb来进行查找及调用的,所以,特意自己做了一个ejb在was上部署以及客户端连接的例子: [b][color=red]1、ejb方面[/color][/b] ejb采用ejb 2,分三个类:Hello、HelloHome、HelloWord; [color=cyan]Hello:[/color] public class Hello implements SessionBean { /** The session context */ private SessionContext context; public Hello() { super(); // TODO Auto-generated constructor stub } /** * Set the associated session context. The container calls this method * after the instance creation. * * The enterprise bean instance should store the reference to the context * object in an instance variable. * * This method is called with no transaction context. * * @throws EJBException Thrown if method fails due to system-level error. */ public void setSessionContext(SessionContext newContext) throws EJBException { context = newContext; } public void ejbCreate() throws EJBException, RemoteException { // TODO Auto-generated method stub System.out.println(“ejb create”); } public void ejbRemove() throws EJBException, RemoteException { // TODO Auto-generated method stub } public void ejbActivate() throws EJBException, RemoteException { // TODO Auto-generated method stub } public void ejbPassivate() throws EJBException, RemoteException { // TODO Auto-generated method stub } /** * An example business method * * @ejb.interface-method view-type = “remote” * * @throws EJBException Thrown if method fails due to system-level error. */ public String sayIt() throws EJBException { System.out.println(“hello didi”); return “hello didi.”; } } [color=cyan][b]HelloHome[/b][/color] public interface HelloHome extends javax.ejb.EJBHome { public com.rox.HelloWorld create() throws javax.ejb.CreateException,java.rmi.RemoteException; } [color=cyan]HelloWorld[/color] public interface HelloWorld extends EJBObject{ public String sayIt() throws RemoteException; } [color=red][b]2、发布ejb到was中[/b][/color] 注意:在ejb的jndi项,填写e

    02
    领券