Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facing problem in dependecy injection of EJB 3.0 session bean

 
ramakrishna kulkarni
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic