views:

288

answers:

1

Hi,

I've got a stateful session bean.

@Scope(ScopeType.SESSION)
@Name("chuckNorrisBean")
public class ChuckNorrisBean implements Serializable, ChuckNorris

with some function

public void roundHouseKick()
{
    ...
}

interface

@Local
public interface ChuckNorris
{
    public void roundHouseKick()
    {
        ...
    }
}

and calling them on a jsf .xhtml page using

#{chuckNorrisBean.roundHouseKick}

which works perfectly fine. However if I add the @Stateful annotation to the bean so it becomes

@Stateful
@Scope(ScopeType.SESSION)
@Name("chuckNorrisBean")
public class ChuckNorrisBean implements Serializable, ChuckNorris

and the page will load with exceptions complainig about

Exception during request processing:Caused by javax.servlet.ServletException 
with message: "#{chuckNorrisBean.roundHouseKick}: javax.el.MethodNotFoundException: 
//localhost/universe/earth.xhtml @41,65 action=
"#{chuckNorrisBean.roundHouseKick}": Method not found: 
ChuckNorrisBean:a6gkg-w6das4-g8wmgh0y-1-g8woy0wo-4b.roundHouseKick()" 

Any advice on what might've went wrong with my chuckNorrisBean?

The system is built on SEAM/richfaces.

Thanks!

---- Edited to add more info ----

The project is built with maven 2.1 packaged as ear (a single .ear file as target output).

The application server is JBoss.

After more debugging and fiddling, putting

<page view-id="/index.xhtml">
    <action execute="#{chuckNorrisBean.roundHouseKick}" />
</page>

in pages.xml seems to do the kicking just fine. I still couldn't figure out why calling it on a page did not work.

A: 

That is quite strange.

Have you tried

#{chuckNorrisBean.roundHouseKick()}

instead of

#{chuckNorrisBean.roundHouseKick}

Just to see what happens

Shervin
Unfortunately that didn't help :(
John
I cannot explain this. Your code should work.What I recommend (if you really want a stateful component) is to create a normal Session bean. Just remove the @Stateful (and the interface) and try that.
Shervin
Which app server are you using?
Shervin
What happens if you put `@Statless` instead of `@Stateful`.Remember, to remove session scope. If this doesn't work, then it must be that EJB's isn't available or correctly working for your environment.
Shervin