aspose file tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Facing problem in dependecy injection of EJB 3.0 session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "Facing problem in dependecy injection of EJB 3.0 session bean " Watch "Facing problem in dependecy injection of EJB 3.0 session bean " New topic
Author

Facing problem in dependecy injection of EJB 3.0 session bean

ramakrishna kulkarni
Greenhorn

Joined: Feb 06, 2009
Posts: 14
Hi All

I am trying to run this simple ejb example using eclipse

This the client code and client is also part of EAR

package example.ejb.client;

import javax.ejb.EJB;

public class HelloUserClient {

@EJB
private static HelloUserBeanRemote helloUser;

public static void main(String[] args) {

helloUser.sayHello();

}

}

When I tried to do this class is not compiling properly

getting error at this line
private static HelloUserBeanRemote helloUser;

Error :HelloUserBeanRemote cannot be resolved to a type

HelloUserBeanRemote is Remote interface and I am implementing this interface properly

I am not able to figure out what is going wrong



Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1221

Hi Ramakrishna,

this doesn't seem to be an EJB problem. The error message "HelloUserBeanRemote cannot be resolved to a type" says that the compiler can't resolve the type of your interface which in turn means this class is missing a proper import statement or the JAR/package which provides the interface declaration isn't included in the classpath of your client application.

Depending on your development environment or IDE you probably just have to add the JAR in question to your client project and add the necessary import statement to the client class and at least this problem should (hopefully) disappear

Marco
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Facing problem in dependecy injection of EJB 3.0 session bean
 
Similar Threads
EJB simple client is not running
Can't get Glassfish hello world to work: ClassNotFoundException
Why EJB running slow
exception in first ejb 3.1 program on NetBean 6.1
Trouble in getting started with EJB3