aspose file tools*
The moose likes Websphere and the fly likes Problem looking up local interface of Session Beans - WSAD 5.1, WAS 5.0 Test Env Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Problem looking up local interface of Session Beans - WSAD 5.1, WAS 5.0 Test Env" Watch "Problem looking up local interface of Session Beans - WSAD 5.1, WAS 5.0 Test Env" New topic
Author

Problem looking up local interface of Session Beans - WSAD 5.1, WAS 5.0 Test Env

Sakti Singh
Greenhorn

Joined: Dec 13, 2000
Posts: 16
To ALL J2EE Guru's,

I am getting some problems in looking up my beans local home interface(Details under), however when I look up the remote home interface its fine. Please look into my problem when you have a minute. Appreciate your help.
---------------------------------- Details --------------------
1. I have 2 beans, one stateful, other stateless and both have remote and local interfaces
2. I can access both using remote interfaces but not using local interfaces
3. However TestClient works fine for both Remote and Local interfaces:

Followings are the urls TestClient looks up:

Stateless Bean remote Interface:

http://localhost:9080/UTC/jndiLookup?name=com/selectica/configejb/CxConfigStatelessHome&random=0.032660621190745975

Stateless Bean LocalInterface:

http://localhost:9080/UTC/jndiLookup?name=local:/ejb/com/selectica/configejb/CxConfigStatelessHome&random=0.32728747419322335

In my client program I used following JNDI:

I. For looking up remote home : com/selectica/configejb/CxConfigStatelessHome (Works OK)
II. For Looking up local home: local:ejb/com/selectica/configejb/CxConfigStatelessHome (throws following exception)


javax.naming.ConfigurationException: NamingManager.getURLContext cannot find the factory for this scheme: local
at com.ibm.ws.naming.jndicos.CNContextImpl.checkForUrlContext(CNContextImpl.java:2770)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1220)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at GetServiceProgramsLocal.getEJBObjectHandle(GetServiceProgramsLocal.java:130)
at GetServiceProgramsLocal.main(GetServiceProgramsLocal.java:54)


4. My Client module and ejb module are in same .ear.
5. I have created local references (Deployment descriptor is pasted below)

Some more Details:

Look up Code:


private static CxConfigLocalStateless getEJBObjectHandle() throws NamingException, CreateException, RemoteException {
CxConfigLocalStateless config = null;
final InitialContext ic = new InitialContext(); // get initial context
final CxConfigLocalStatelessHome home = (CxConfigLocalStatelessHome) ic.lookup("local:ejb/com/selectica/configejb/CxConfigStatelessHome");
config = (CxConfigLocalStateless)home.create();

return config;
}


Deployment Descriptor:

<?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar id="ejb-jar_ID">

<enterprise-beans>
<session id="Session_1076368683641">
<ejb-name>SelecticaConfigEJB_Stateful</ejb-name>
<home>com.selectica.configejb.CxConfigHome</home>
<remote>com.selectica.configejb.CxConfig</remote>
<local-home>com.selectica.configejb.CxConfigLocalHome</local-home>
<local>com.selectica.configejb.CxConfigLocal</local>
<ejb-class>com.selectica.configejb.CxConfigBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<env-entry id="EnvEntry_1076368726516">
<env-entry-name>CODEBASE</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>c:/selectica/kbs/;</env-entry-value>
</env-entry>

<env-entry id="EnvEntry_1076368726517">
<env-entry-name>DATASOURCE_CONFIG_FILE</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>ds.xml</env-entry-value>
</env-entry>

<env-entry id="EnvEntry_1076368726518">
<env-entry-name>DEBUG</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>False</env-entry-value>
</env-entry>

<ejb-local-ref id="EJBLocalRef_1129752409153">
<ejb-ref-name>ejb/SelecticaConfigEJB_Stateful</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.selectica.configejb.CxConfigLocalHome</local-home>
<local>com.selectica.configejb.CxConfigLocal</local>
<ejb-link>SelecticaConfigEJB_Stateful</ejb-link>
</ejb-local-ref>
</session>

<session id="Session_1076368683642">
<ejb-name>SelecticaConfigEJB_Stateless</ejb-name>
<home>com.selectica.configejb.CxConfigStatelessHome</home>
<remote>com.selectica.configejb.CxConfigStateless</remote>
<local-home>com.selectica.configejb.CxConfigLocalStatelessHome</local-home>
<local>com.selectica.configejb.CxConfigLocalStateless</local>
<ejb-class>com.selectica.configejb.CxConfigStatelessBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry id="EnvEntry_1076368726531">
<env-entry-name>CODEBASE</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>http://localhost:8080/;c:/selectica/kbs/;</env-entry-value>
</env-entry>
<env-entry id="EnvEntry_1076368726532">
<env-entry-name>DATASOURCE_CONFIG_FILE</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>ds.xml</env-entry-value>
</env-entry>

<env-entry id="EnvEntry_1076368726533">
<env-entry-name>DEBUG</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>False</env-entry-value>
</env-entry>

<ejb-local-ref id="EJBLocalRef_1129752409223">
<ejb-ref-name>ejb/SelecticaConfigEJB_Stateless</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.selectica.configejb.CxConfigLocalStatelessHome</local-home>
<local>com.selectica.configejb.CxConfigLocalStateless</local>
<ejb-link>SelecticaConfigEJB_Stateless</ejb-link>
</ejb-local-ref>
</session>
</enterprise-beans>

<assembly-descriptor id="AssemblyDescriptor_ID">
<container-transaction id="MethodTransaction_1076368726531">
<method id="MethodElement_1076368726547">
<ejb-name>SelecticaConfigEJB_Stateful</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>

<trans-attribute>Required</trans-attribute>
</container-transaction>

</assembly-descriptor>
</ejb-jar>

Regards,
Sakti
[ October 21, 2005: Message edited by: Sakti Singh ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem looking up local interface of Session Beans - WSAD 5.1, WAS 5.0 Test Env