6 Replies Latest reply on Jan 8, 2007 2:40 PM by echnaton

    serious problem on sun application server 9.0

    echnaton

      the problem is the automatic instantiation of seam components via @In(create=true).

      i reduced it to a minimal test.
      2 beans, and a page with a button that invokes a method
      the first bean is a slsb with an annotated variable

      @In(create=true)
      TestBean test;
      


      and one empty function that returns null

      the secon bean is an empty slsb (classname TestBean, @Name("test")). both in the same package.

      the actionbean is called by a button on the page. the error vanishes if i remove the @In(create=true) from the variable and the method is invoked.

      for not shocking you here are the most important lines of the stacktrace:
      Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/Test-ejb/TestBean/local
      

      called here:
       at org.jboss.seam.Component.instantiateSessionBean(Component.java:1027)
      


      is it my mistake? is there a workaround? i guess i have to make entrys in the ejb-jar.xml as i had to in the web.xml for the webapp, but if thats it so please tell me what i have to enter. i tried to configure it myself but the error wont go away...

        • 1. Re: serious problem on sun application server 9.0

          I've never used that app server, and I don't recall any messages from users about this. I think the first thing you need to do is figure out a sensible jndi-pattern. The one it is using is for JBoss, and it's obviously not suitable.

          • 2. Re: serious problem on sun application server 9.0
            echnaton

            finally i could make it run...
            i found this:
            https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB

            if this is the only solution then its a bit annoying :(

            i placed this in the ejb-jar.xml. enterprise-beans must be the first thing in the file.

             <enterprise-beans>
             <session>
             <ejb-name>TestAction</ejb-name>
             <ejb-class>test.TestAction</ejb-class>
             <ejb-local-ref>
             <ejb-ref-name>Test-ejb/TestBean/local</ejb-ref-name>
             <ejb-ref-type>Session</ejb-ref-type>
             <local>test.TestLocal</local>
             <ejb-link>TestBean</ejb-link>
             </ejb-local-ref>
             </session>
             </enterprise-beans>
            

            test is the package
            TestAction is the actionbean behind the webpage.
            TestBean is the bean that shall be created by seam.
            as you can see i could leave the jndi-pattern untouched. i tried to use
             <ejb-name>Component</ejb-name>
             <ejb-class>org.jboss.seam.Component</ejb-class>
            


            instead of
             <ejb-name>TestAction</ejb-name>
             <ejb-class>test.TestAction</ejb-class>
            


            so it would have made redundant <ejb-local-ref> entrys for the same ejb in different actionbeans unnecessary but it didnt work. perhaps somebody has a better solution but for the moment it works.

            • 3. Re: serious problem on sun application server 9.0

              Is there really no global JNDI name you can bind to?

              • 4. Re: serious problem on sun application server 9.0
                gavin.king

                There is really none. I have yelled at the GlassFish team about this already, but they insist there does not need to be any default JNDI binding for a local interface of a session bean. This is of course absurd, and forces users to write this crappy XML for *every* session bean in their application, but I'm not exactly sure why we JBoss guys should waste more time helping the GlassFish guys improve their appserver ;-)

                • 5. Re: serious problem on sun application server 9.0
                  gavin.king

                  By the way, you should be looking at the examples/glassfish directory for an example of Seam booking on GlassFish.

                  • 6. Re: serious problem on sun application server 9.0
                    echnaton

                    i have, but injection with create=true is never used there. perhaps you could add this.
                    be shure we'll change to jboss appserver as soon as it supports ejb3 specs completely ;)