aspose file tools*
The moose likes Websphere and the fly likes cannot access sessionLocal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "cannot access sessionLocal" Watch "cannot access sessionLocal" New topic
Author

cannot access sessionLocal

Dave Jian
Greenhorn

Joined: Apr 13, 2005
Posts: 6
Hi,

I am using WSAD 5.1 and create HelloWorld stateless session bean with local interface, but WSAD does not allow me to create reference to access the local and local home.It only has remote one. How should I do to fix this problem?

Thanks so much

DJ
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31054
    
232

Dave,
If you create a local interface, WSAD automatically creates a JNDI name:
local:ejb/ejb/com/....

(Starting with com, substitute in the rest of the corresponding remote name.)

And welcome to JavaRanch!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Dave Jian
Greenhorn

Joined: Apr 13, 2005
Posts: 6
Thanks for your message. Still have a problem in JNDI lookup. Please give me some idea to fix it. Thanks again

Remote interface works as below:
JNDIName = "java:comp/env/ejb/HelloWorldSession";
initContext = new InitialContext();
Object obj = initContext.lookup(JNDIName);
helloWorldSessionHome =(HelloWorldSessionHome) PortableRemoteObject.narrow(
obj,
HelloWorldSessionHome.class);
Local interface does not work as replacing HelloWorldSession, or HelloWorldSessionLocal:
String JNDIName = "local:ejb/ejb/com/HelloWorldSession";
initContext = new InitialContext();
Object obj = initContext.lookup(JNDIName);//exception
helloWorldSessionLocalHome = (HelloWorldSessionLocalHome)obj;

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 helloworld.ejb.clients.HelloWorldEJBTestClient.main(HelloWorldEJBTestClient.java:41)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.websphere.client.applicationclient.launchClient.createContainerAndLaunchApp(launchClient.java:616)
at com.ibm.websphere.client.applicationclient.launchClient.main(launchClient.java:420)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:94)
Dave Jian
Greenhorn

Joined: Apr 13, 2005
Posts: 6
I tried local:ejb/ejb/HolloWorldSessionLocalHome, it still the same error.

This is a session bean and I cannot create client reference for local. I believe server did it. When I use UTC, I can see the jndi tree from jndi explorer as:
[Local EJB beans]
ejb
helloworld
ejb
HelloWorldSessionHome(helloworld.ejb.EJSLocalStatelessHelloWorldSessionHome_293bfcaf)

but how can I use it to do the lookup code?

I tried
"local:ejb/ejb/helloworld/ejb/HelloWorldSessionLocalHome", it does not work eighter.

Here is the ejb descripter:

<session id="HelloWorldSession">
<ejb-name>HelloWorldSession</ejb-name>
<home>helloworld.ejb.HelloWorldSessionHome</home>
<remote>helloworld.ejb.HelloWorldSession</remote>
<local-home>helloworld.ejb.HelloWorldSessionLocalHome</local-home>
<local>helloworld.ejb.HelloWorldSessionLocal</local>
<ejb-class>helloworld.ejb.HelloWorldSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31054
    
232

Dave,
You still need the java:comp/env part before using the local path.

What type of client is this? Remember that only clients running on the server can access local interfaces. I've used local interfaces from servlets and EJBs. From the client, you have to use the application assembly tool to truly run on the server. It was more trouble than it was worth, so I just used a remote interface.
Dave Jian
Greenhorn

Joined: Apr 13, 2005
Posts: 6
What type of client is this?

This is J2EE Hello World sample at http://devx.com/ibm/Article/16365/0/page/1

I try application client in the same ear file and it also includes ejb.jar

Please let me know if you have any further suggestion to access local interface from that client.

Thanks

DJ
r. zweers
Greenhorn

Joined: May 10, 2005
Posts: 1
Anyone found a solution for the problem above?? I'm running into the same issue.

Thanks in advance
Rajeev Shrivastava
Greenhorn

Joined: Dec 21, 2004
Posts: 1
Application client is only for Remote Interface guy's. You can not run local interface with that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot access sessionLocal