-
1. Re: Stateless and Create exception
monkeyden Feb 12, 2009 5:57 PM (in response to monkeyden)So looking at Component.scanMethod() I see the error being thrown:
if (type!=JAVA_BEAN && type!=STATEFUL_SESSION_BEAN) { throw new IllegalArgumentException("Only JavaBeans and stateful session beans support @Create methods: " + name); }
I assume there is good reason for this, I just can't imagine why. I would expect that ALL Seam components could have a @Create.
-
2. Re: Stateless and Create exception
swd847 Feb 12, 2009 10:34 PM (in response to monkeyden)You are trying to bind a stateless session bean to the page context. This is not possible, if it is stateless it should be bound to the stateless context (which it will be by default). If it really has to be PAGE scoped use a Java Bean or SFSB (incidentally page scope is generally a bad idea, but that is a matter for another thread).
If you need to run logic on stateless bean creation use the @PostContruct ejb3 annotation.
-
3. Re: Stateless and Create exception
spaceyoyo.spaceyoyo.neuf.fr Mar 4, 2009 3:39 PM (in response to monkeyden)Hello,
I have the same issue.
I want to use SLSB which extends EntityHome. Like this :@Stateless @Name("userDAO") public class UserDAOImp extends EntityHome<User> implements IUserDAOLocal, IUserDAORemote {
But EntityHome have a @Create annotation so my application fail to start, and i obtain this exception :
java.lang.IllegalArgumentException: Only JavaBeans and stateful session beans support @Create methods: userDAO
Why ? And how to use SLSB with EntityHome ?
Thanks fo your future help
-
4. Re: Stateless and Create exception
pedrosena Mar 4, 2009 6:19 PM (in response to monkeyden)@lionel meroni:
Your problem is related to another thing.
The EntityHome itself already has a method with @Create annotation, for this reason you cannot declare other method with this annotation(annotations are inherited).
Take a look at documentation and try to override the method that is annotated with create, but do not forget to call the parent method before your code, just to avoid weird behavior.
Regards,
Pedro Sena
-
5. Re: Stateless and Create exception
spaceyoyo.spaceyoyo.neuf.fr Mar 5, 2009 10:35 AM (in response to monkeyden)Hello Pedro,
As I wrote, the exception say :
Only JavaBeans and stateful session beans support @Create methods
So a stateless session bean could not have a method with @Create annotation.
So a stateless session bean could not extends EntityHome !!!BUT in the documentation here :
My Link
There is an example of a Stateless bean which extends EntityHome.Actualy this is not possible ? Is the documentation up to date or wrong ??
-
6. Re: Stateless and Create exception
pedrosena Mar 5, 2009 12:21 PM (in response to monkeyden)Lionel,
Use a Seam component(stateless scoped) instead of a EJB in this case. In this case they can be switched if no cost.
Is what I'm doing here.
Regards,
PS
-
7. Re: Stateless and Create exception
spaceyoyo.spaceyoyo.neuf.fr Mar 5, 2009 12:54 PM (in response to monkeyden)Thanks Pedro, with
@Scope(ScopeType.STATELESS)
It work !
-
8. Re: Stateless and Create exception
josdaniel Oct 10, 2009 9:01 AM (in response to monkeyden)I am a little confused here, does this mean it is not possible to expose seam components as stateless session beans (as mentioned in the reference docs). I get the same IllegalArgumentException mentioned in this thread above.
What would be the suggested practice to expose the seam components as stateless session beans?