Deployment and call of EJB under WebLogic8.1

zhaozj2021-02-16  36

EJB is not easy, deploying is not simple, different platforms different containers, the head is full. WebLogic This east wise cow, worth studying, take it with it.

The writing process does not say, just say that deployment and calling, the following three codes have been well explained.

1, EJB-JAR.XML http://java.sun.com/dtd/ejb-jar_2_0.dtd ''>

Hello Hellobean Hello < Home> Org.Bromon.ejb.Session.HelloHome Org.Bromon.ejb.Session.Hello Org.Bromon.EJB.Session.HellolocalHome Org.Bromon.ejb.Session.Hellolocal org.bromon.ejb.session.Hellobean stateless < Transaction-type> bean

2, WebLogic-EJB-JAR.XML (WebLogic Agency Profile) http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd '>

Hello

hello Hellolocal

3, HelloClient.java (client code, the best and four interfaces) / * * Created on 2004-5-11 * / package org.bromon.ejb.session; import javax.naming. *; Import javax. RMI. *; import java.util. *; / ** * @Author bromon * / public class helloclient {public static void main (string args []) {Try {Properties Prop = New Properties (); Prop.Put (context .INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); // loading weblogic context prop.put (Context.PROVIDER_URL, "t3: // localhost: 7001"); // weblogic specific protocol context ctx = new InitialContext (prop) Object obj = ctx.lookup ("Hello"); HelloHome Home = (HelloHome) PortableRemoteObject.Narrow (Obj, HelloHome.class); Hello Hello = Home.create (); system.out.println (Hello.Say () Hello.remove ();} catch (exception e) {system.out.println (e);}}}

转载请注明原文地址:https://www.9cbs.com/read-21731.html

New Post(0)