Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB3 help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB3 help needed" Watch "EJB3 help needed" New topic
Author

EJB3 help needed

Meeta Dey
Greenhorn

Joined: Jan 13, 2008
Posts: 7
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

Joined: Nov 12, 2008
Posts: 757
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

Joined: Feb 16, 2008
Posts: 59
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

Joined: Jan 10, 2002
Posts: 60804
    
  65

"susMita blr", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Meeta Dey
Greenhorn

Joined: Jan 13, 2008
Posts: 7
Thanks treimin..
Meeta Dey
Greenhorn

Joined: Jan 13, 2008
Posts: 7
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

Joined: Oct 16, 2005
Posts: 1277
Missed the sys out


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Higor Zardo
Ranch Hand

Joined: Feb 16, 2008
Posts: 59
And for JBOSS, someone know how to setting jndi properties inside Eclipse?

Thank youu,
Higor
Treimin Clark
Ranch Hand

Joined: Nov 12, 2008
Posts: 757
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

Joined: Feb 16, 2008
Posts: 59
Ok, thank you.

Higor
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB3 help needed
 
Similar Threads
First Session Bean failing in JBOSS
confusion with output...
problem in deploying ejb3 app in jboss server
How to run HelloWorld example in GlassFish Tools Bundle For Eclipse Version: 1.2
Help,Tomcat can't invoke EJB?