Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anyone who tried @Init annotation in Stateful Session Bean

 
Nitin Takale
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm writing a ejb 2.1 client for ejb 3.0 Stateful bean. I've initialize(String) and initialize(String,String) methods in my bean class.

And my home interface has create(String) and createCart(String,String) method

I tried to use Init annotation on initialize method. as..
@Init("create")
@Init("createCart")

and

@Init("create(java.lang.String)")
@Init(createCart(java.lang.String,java.lang.String))

but in both cases I'm getting exception saying..
Bean class for ejb [CartEJB] does not define a
method corresponding to [Home] interface method [public abstract com.seed.ejb20
.CartRemote com.seed.ejb20.CartHome.createCart(java.lang.String,java.lang.String
) throws java.rmi.RemoteException,javax.ejb.CreateException]

and so on....

So can you please guide me how do use this Init annotation.
My code works well if I don't use Init annotation and instead use Deployment descriptor elements init-method.....


Thanks

Nitin
[ September 01, 2008: Message edited by: Nitin Takale ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic