|
| |
EJB 2.0 requires servers to implement CORBA/IIOP as a wire protocol. So in
addition to the (preferred) usage of Burlap and Hessian as protocols, Resin-EE
makes CORBA/IIOP available.
The Resin CORBA server configuration is almost identical to the Burlap
or Hessian configuration. The difference is that CORBA uses a dedicated
port instead of a servlet to listen for CORBA requests.
Everything else is identical, including the <ejb-server> , so
beans do not need to be aware which wire protocol is used.
resin.conf
<server>
...
<port port="2099">
<protocol resin:type="com.caucho.iiop.IiopProtocol"/>
</port>
...
</server>
|
webapps/appname/WEB-INF/web.xml
<web-app>
...
<ejb-server config-directory="WEB-INF"/>
...
</web-app>
|
Clients will use JNDI to look up beans in the server. The JNDI name
uses the same name as the bean's Burlap URL. If the EJBServlet is at
http://localhost:8080/app/ejb, the IIOP server is localhost:2099, and
the bean name is "hello",
the JNDI path will be /localhost:2099/hello.
CORBA client
import javax.naming.*;
env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
env.put("java.naming.provider.url", "iiop://localhost:2099/hello");
Context ejb = new InitialContext(env);
Object helloHomeObj = ctx.lookup("hello");
HelloHome helloHome =
(HelloHome) PortableRemoteObject.narrow(helloHomeObj, HelloHome.class);
|
You can also use Resin's jndi features to configure the factory:
corba jndi client configuration
<web-app>
...
<jndi-link jndi-name='java:comp/env/ejb'
factory='com.sun.jndi.cosnaming.CNCtxFactory'>
<init-param java.naming.provider.url='http://localhost:2099/hello'/>
</jndi-link>
|
corba jndi client code
Context ejb = (Context) new InitialContext().lookup("java:comp/env/ejb");
Object helloHomeObj = ejb.lookup("hello");
HelloHome helloHome =
(HelloHome) PortableRemoteObject.narrow(helloHomeObj, HelloHome.class);
|
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|