[jboss-user] [EJB 3.0] - Re: SLSB Local Interface Exception - EjB 3.0 with jboss-4.0.

vashistvishal do-not-reply at jboss.com
Tue Sep 19 01:41:11 EDT 2006


Thanks for replying ...
Here we go :)

This is my Bean


  | @Stateless
  | 
  | public class StoreAccessBean implements  StoreAccessLocal, StoreAccessRemote {
  | 	public int add (int num1 , int num2) {		
  | 		int sum = num1 + num2; 
  | 		System.out.println ("I'm at server side Sum is " + sum);
  | 		return sum;
  | 	}
  | }
  | 

This is my interface

  | @Local
  | 
  | public interface StoreAccessLocal {
  | 	public int add (int num1, int num2);
  | }
  | 

I havent added my remote interface code here.
This is my calling client.


  |  public static void main(String [] args) 
  |     {
  |         try 
  |         {
  |             Context jndiContext = getInitialContext();
  | 
  |             Object ref = jndiContext.lookup("StoreAccessBean/remote");
  |             System.out.println ("Name : "+ ref.getClass().getName());
  |             StoreAccessRemote sa = (StoreAccessRemote)ref;            
  |             int sum = sa.add(10, 20);
  |             System.out.println("Remote Bean: Sum returned from server is " + sum );
  |             // Until now it works fine
  | 
  |             // Problem area.... starts here
  |             Object reflocal = jndiContext.lookup("StoreAccessBean/local");
  |             System.out.println ("Name : "+ reflocal.getClass().getName());            
  |             StoreAccessLocal salocal = (StoreAccessLocal)reflocal;                        
  |             System.out.println("I 'm fine until now ");            
  | // Fails here
  |             int sumlocal = salocal.add(10, 40);
  | 
  |             System.out.println("Local Bean: Sum returned from server is " + sumlocal );
  | 
  | 

I hope this helps in nailing down this problem.

Vishal


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972484#3972484

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972484



More information about the jboss-user mailing list