however, i would like to implement some methods in MySlsb that i don't want to expose in MyInterface, so, in order to call these methods i need to instantiate a MySlsb object, not a MyInterface object. (simply casting MyInterface object to MySlsb does not work, this throws a class cast exception at runtime, having something to do with wrapper classes...)
is there anyway to instantiate the MySlsb object?
[ October 16, 2008: Message edited by: Johann Dobbins ] [ October 16, 2008: Message edited by: Johann Dobbins ]
The way to do this right now would be to have another interface specific for testing. You can deploy this interface via a deployment descriptor without changing the actual EJB implementation and use the descriptor only for testing purposes.
If you don't need container services anyway, you can just instantiate the bean class with "new". That's often the case with internal unit test cases which is what I suspect you are talking about. Otherwise, why have a method that's not client invokable :-)
P.S.: In EJB 3.1, interfaces are optional, so if you really want to, you can look up the bean class directly. All public methods are automatically invokable.
Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1