tags:

views:

319

answers:

1

My SFSB Seam component is bound to JNDI on deployment, as evidenced by this log message:

Component: example, scope: CONVERSATION, type: STATEFUL_SESSION_BEAN,
class:com.purecharger.action.ExampleAction, JNDI: purecharger/ExampleAction/local

My interface:

@Local
public interface Example {    
    public List<String> getExample();
    public void destroy();
}

and my implementation:

@Stateful
@Scope(ScopeType.CONVERSATION)
@Name("example")
@Restrict("#{identity.loggedIn}")
public class ExampleAction implements Example, Serializable {

    ....
}

However, when I access the voting component in an xhtml page like, I get the following error:

javax.el.ELException: /home.xhtml: Could not instantiate Seam component: example
....
Caused by: javax.naming.NameNotFoundException: ExampleAction not bound

If Seam was smart enough to install my component using the JNDI pattern in components.xml (purecharger/#{ejbName}/local), why does it not also apply the pattern when looking up components?

Thank you.

UPDATE: Looking at the JNDIView in JBoss, the name purecharger/ExampleAction/local is not bound anywhere. So I guess my question now becomes, why is Seam not adding this SFSB to JNDI?

+1  A: 

Why is Seam not adding this SFSB to JNDI ?

Well,

As shown in your question, i think you have a ear application, because of its JNDI global address

purecharger/ExampleAction/local

which is mapped according to

<EAR_APPLICATION>/<STATEFUL_BEAN>/local

When you deploy a single EJB module, its JNDI global address in JBoss looks like

<STATEFUL_BEAN>/local

Bacause you have a ear application, each EJB module should be declared in application.xml (The file that describes your ear) as follows

So your ear app looks like

pureCharger.ear

    META-INF
        application.xml
    pureCharger-ejb.jar
    pureCharger-war.war
    jboss-seam.jar
    lib
        // libraries shared by your modules goes here

And your application.xml

<?xml version="1.0" encoding="UTF-8"?>
<application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"&gt;
    <display-name>pureCharger</display-name>
    <module>
        <ejb>pureCharger-ejb.jar</ejb>
    </module>
    <module>
        <ejb>jboss-seam.jar</ejb>
    </module>
    <module>
        <web>
            <web-uri>pureCharger-war.war</web-uri>
            <context-root>pureCharger</context-root>
        </web>
    </module>
</application>

Notice jboss-seam.jar is a EJB module, so it should also be declared in application.xml file

If possible, use Seam-gen to generate your project. It takes care includes all libraries needed by your project and can be opened without restriction in NetBeans, for instance.

regards,

Arthur Ronald F D Garcia
Thanks Arthur, this was the problem. Not only did I not declare my EJB-containing jar in application.xml, I was also attempting to have it live in war/WEB-INF/lib, which is not correct (at least until v3.1 of the EJB spec).
purecharger