• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3 help needed

 
Meeta Dey
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dear friends..

Need your help...
I am new to EJB,
I was trying to run an example from
the MyEclipse's tutorial..

Using GlassFish v 2, MyEclipse 6.0, EJB 3.

The code is as follows
*******************************************************
package com.myeclipseide.ejb3;

import javax.ejb.Stateless;

@Stateless
public class MyBean implements MyBeanRemote {

public String doSomething() {

return "HELLO";
}
}


***************************************************************************
package com.myeclipseide.ejb3;

import javax.naming.InitialContext;
import javax.naming.NamingException;

public class MyBeanClient {
public static void main(String[] args) {
try {
InitialContext ctx = new InitialContext();
MyBeanRemote bean = (MyBeanRemote) ctx.lookup("com.myeclipseide.ejb3.MyBeanRemote");
bean.doSomething();
System.out.println("Hi!!");
} catch (NamingException e) {
e.printStackTrace();
}
}
}

******************************************************************************
package com.myeclipseide.ejb3;

import javax.ejb.Remote;

@Remote
public interface MyBeanRemote {
public String doSomething() ;
}

*********************************************************************
The output got printed is:-
Hi!!
And the expected line
"HELLO"
of method "doSomething" is not getting printed..

Can anyone help in solving this problem..

Thanks
 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You got some basic thing missed. To understand whats happen there, try to tell me the answer for this simple SCJP question:



What is the output?
 
Higor Zardo
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you do to setting jndi properties inside Eclipse?
Please, if you can help me I thank you.

Thank you,
Higor
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"susMita blr", please check your private messages for an important administrative matter.
 
Meeta Dey
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks treimin..
 
Meeta Dey
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Higor,

we need to add appserver-rt.jar to our Build Path. This JAR is from the Glassfish 2 library directory and contains a customized jndi.properties file that will allow us to connect directly to the Glassfish 2 JNDI context automatically .
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Missed the sys out
 
Higor Zardo
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And for JBOSS, someone know how to setting jndi properties inside Eclipse?

Thank youu,
Higor
 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Higor Zardo wrote:And for JBOSS, someone know how to setting jndi properties inside Eclipse?


Please ask it in this forum
 
Higor Zardo
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thank you.

Higor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic