2 Replies Latest reply on Feb 6, 2009 2:32 PM by Glenn Holmer

    can't instantiate component

    Glenn Holmer Newbie
      We're working on our first Seam app, and are having trouble instantiating an EJB as a Seam component.  Our environment is Seam 2.1.1 and GlassFish 2.1, building with NetBeans and not using seam-gen.

      The first link in the app is an s:link whose action is #{categoryAction.topCategoryClicked}. So far, so good. CategoryAction is an EJB, and we've declared it in web.xml with an ejb-local-ref.  But CategoryAction wants to inject CategoryBean.  I can put @EJB on CategoryBeanLocal and get a reference to it (the resulting page is displayed normally with all the data), but when I replace that with @In, I get "No object bound to name java:comp/env/phoenix/CategoryBean/local".  CategoryBean's ejb-ref is set up the same way as that of CategoryAction.

      What are we missing here?
        • 1. Re: can't instantiate component
          Stuart Douglas Master

          in your main components.xml there should be a line similar to:


          <core:init jndi-pattern="myJNDIPattern" />




          What is the jndi-pattern set to and where is the EJB actually bound to in JNDI?

          • 2. Re: can't instantiate component
            Glenn Holmer Newbie
            The solution we found was to add this in ejb-jar.xml:

            <enterprise-beans>
              <session>
                <ejb-name>CategoryAction</ejb-name>
                <ejb-class>com.weycogroup.phoenix.sf.action.CategoryAction</ejb-class>
                <ejb-local-ref>
                  <ejb-ref-name>phoenix/CategoryBean/local</ejb-ref-name>
                  <ejb-ref-type>Session</ejb-ref-type>
                  <local>com.weycogroup.phoenix.business.local.CategoryBeanLocal</local>
                  <ejb-link>CategoryBean</ejb-link>
                </ejb-local-ref>
              </session>
            </enterprise-beans>

            I found this solution here in the forums:

            http://www.seamframework.org/2444.lace