Hi,
I made a very simple session bean which has only one for testing purposes business method
'saying':
public String saying(String name) throws EJBException {
| // rename and start putting your business logic here
| return "Have a nice day " + name;
| }
The bean was deployed correct, notified by JBoss (actually 4.0.3):
14:26:10,824 INFO [EjbModule] Deploying Hello
14:26:11,073 INFO [EJBDeployer] Deployed:
file:/D:/jboss-4.0.2/server/pzuci/deploy/HelloEJB.jar/
Then I made a test client, the core part of that is:
public static void main(String[] args) {
| // TODO Auto-generated method stub
| Hashtable<String, String> props = new Hashtable<String, String>();
| props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
| props.put(Context.PROVIDER_URL, "localhost:1099");
|
| try {
| Context cx = new InitialContext(props);
| HelloHome helloHome = (HelloHome) cx.lookup("java:/Hello");
| Hello hello = helloHome.create();
| System.out.println(hello.saying("Jhon B"));
| hello.remove();
| } catch (Exception e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| }
It works fine, but if I tried to addapt the same manner into the simple test servlet, it
didn't work. I used the same proxy to the interfaces:
Hashtable<String, String> props = new Hashtable<String, String>();
| props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
| props.put(Context.PROVIDER_URL, "localhost:1099");
I don't get exspected message from the business method 'saying', instead the
test servelt notifies me:
Hello not bound
How should I obtain the home EJB interface from servlet container?
I'd be glad for some help
KM
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129887#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...