fierst of all sorry for my english :).
1.Eclipse Version: 3.1.0
2.jboss-4.0.4.GA
3.Ejb 3.0
there is my simple example :
1.Remote Interface
Code:
package org.jboss.tutorial.stateless.bean;
import javax.ejb.Remote;
@Remote
public interface CalculatorRemote {
public int add(int x, int y);
public int subtract(int x, int y);
}
2.Local Interface
Code:
package org.jboss.tutorial.stateless.bean;
import javax.ejb.Local;
@Local
public interface CalculatorLocal extends CalculatorRemote
{
public int add(int x, int y);
public int subtract(int x, int y);
}
3.Bean
Code:
package org.jboss.tutorial.stateless.bean;
import javax.ejb.Stateless;
import org.jboss.tutorial.stateless.bean.CalculatorRemote;
public @Stateless
class CalculatorBean implements CalculatorRemote {
public int add(int x, int y) {
return x + y;
}
public int subtract(int x, int y) {
return x - y;
}
}
4. and Client
Code:
package org.jboss.tutorial.stateless.client;
import org.jboss.tutorial.stateless.bean.CalculatorRemote;
import javax.naming.InitialContext;
public class Client
{
public static void main(String[] args) throws Exception
{
InitialContext ctx = new InitialContext();
CalculatorRemote calculator = (CalculatorRemote) ctx.lookup("CalculatorBean/remote");
System.out.println("1 + 1 = " + calculator.add(1, 1));
System.out.println("1 - 1 = " + calculator.subtract(1, 1));
}
}
then in eclipse ide i did project jar file using export and copy it in the
jboss_home/server/all/deploy folder
then start jboss from eclipse
when i'm running client a get an error like that :
Code:
Exception in thread "main" javax.naming.NameNotFoundException: CalculatorBean not bound
is there enything wrong ?