5 Replies Latest reply on Jun 30, 2004 5:34 AM by Darran Lofthouse

    Creating EJB object of local interface from servlet

    surajmundada Newbie

      Hi,

      I am trying to create a object of local interface from a servlet but not getting results.

      I am deploying servlet in a WAR file and beans in JAR file, packaging them in a EAR file. For packaging, I am using Deploytool of SUN's J2EESDK 1.3.

      Any helps ?

      Suraj

      --------------------------------------------------------------------------------------

      public class UserStampServVar extends HttpServlet
      {
      // Variable to store the bean instances
      EJB.TimeStamp.EJB.UserBMLocalHome homeUserBM;
      EJB.TimeStamp.EJB.UserBMLocal theUser;

      public void init(ServletConfig config) throws ServletException
      {
      ServletContext sctx = config.getServletContext();

      try
      {
      InitialContext initialContext = new InitialContext();

      homeUserBM = (EJB.TimeStamp.EJB.UserBMLocalHome)initialContext.lookup("java:comp/env/ejb/UserBMBean");
      }
      catch (Exception)
      {
      .........
      }
      }

      -----------------------------------------------------------------------------------

      Error is
      " ejb not bound"

      -----------------------------------------------------------------------------------

      UserBMBean.java contains the implementation
      UserBMLocalHome is local home interface
      UserBMLocal is local interface


        • 1. Re: Creating EJB object of local interface from servlet
          snavjot Newbie

          can you post you web.xml and jboss-web.xnl here?

          in short do you have ejb-local-ref tag in web.xml and the correponding jndi mapping in jboss-web.xml and if they present. are they right?

          navjot singh

          • 2. Re: Creating EJB object of local interface from servlet
            John Anderson Newbie

             

            "surajmundada@yahoo.com" wrote:

            public void init(ServletConfig config) throws ServletException
            {
            ServletContext sctx = config.getServletContext();

            try
            {
            InitialContext initialContext = new InitialContext();

            homeUserBM = (EJB.TimeStamp.EJB.UserBMLocalHome)initialContext.lookup("java:comp/env/ejb/UserBMBean");
            }


            It looks like you are trying to lookup a local reference from a remote object (servlet). I don't know if this is possible because I haven't ever tried before. I've always defined a Home and a Remote interface for the EJB, then use the javax.rmi.PortableRemoteObject.narrow() method on the reference context.lookup returns.


            All this depends on the type of EJB you are trying to reference. If you are trying to reference entity EJBs, they should only have Local and LocalHome interfaces. If at all possible, create a Session EJB with a Home and Remote interface through which you can access the entity EJBs.




            • 3. Re: Creating EJB object of local interface from servlet
              surajmundada Newbie

              Thanks for the reply........ here are both the files:

              web.xml:


              <web-app>
              <display-name>TestLocalWar</display-name>
              <context-param>
              <param-name>USERBEAN_JNDINAME</param-name>
              <param-value>UserBMBean</param-value>
              </context-param>

              <servlet-name>UserStampServVar</servlet-name>
              <display-name>UserStampServVar</display-name>
              <servlet-class>EJB.TimeStamp.Servlets.UserStampServVar</servlet-class>

              <servlet-mapping>
              <servlet-name>UserStampServVar</servlet-name>
              <url-pattern>/TestLocal</url-pattern>
              </servlet-mapping>
              <session-config>
              <session-timeout>30</session-timeout>
              </session-config>
              </web-app>

              --------------------------------------------------------------------------------------

              ejb-jar.xml



              <?xml version="1.0" encoding="UTF-8"?>

              <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>

              <ejb-jar>
              <display-name>TestLocalJar</display-name>
              <enterprise-beans>

              <display-name>UserBMBean</display-name>
              <ejb-name>UserBMBean</ejb-name>
              EJB.TimeStamp.EJB.UserBMHome
              EJB.TimeStamp.EJB.UserBM
              <local-home>EJB.TimeStamp.EJB.UserBMLocalHome</local-home>
              EJB.TimeStamp.EJB.UserBMLocal
              <ejb-class>EJB.TimeStamp.EJB.UserBMBean</ejb-class>
              <persistence-type>Bean</persistence-type>
              <prim-key-class>EJB.TimeStamp.EJB.UserPK</prim-key-class>
              False
              <security-identity>

              <use-caller-identity></use-caller-identity>
              </security-identity>
              <resource-ref>
              <res-ref-name>java:jdbc/PostgresDS</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
              <res-sharing-scope>Shareable</res-sharing-scope>
              </resource-ref>

              </enterprise-beans>
              <assembly-descriptor>
              <method-permission>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getHandle</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserOnline</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserOnline</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>isIdentical</method-name>
              <method-params>
              <method-param>javax.ejb.EJBLocalObject</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>getHomeHandle</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserPwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserPwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserId</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserId</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserAdmin</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserAdmin</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserIp</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserIp</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserPwd</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserPwd</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>getEJBMetaData</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserImage</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserImage</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>findByPrimaryKey</method-name>
              <method-params>
              <method-param>EJB.TimeStamp.EJB.UserPK</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>remove</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>findByPrimaryKey</method-name>
              <method-params>
              <method-param>EJB.TimeStamp.EJB.UserPK</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>remove</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getEJBLocalHome</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserOverridePwd</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserOverridePwd</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserUpdateTimestamp</method-name>
              <method-params>
              <method-param>java.sql.Timestamp</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserUpdateTimestamp</method-name>
              <method-params>
              <method-param>java.sql.Timestamp</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserAdmin</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserAdmin</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>create</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>boolean</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>create</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>boolean</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getPrimaryKey</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getPrimaryKey</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserIp</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserIp</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>remove</method-name>
              <method-params>
              <method-param>javax.ejb.Handle</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>isIdentical</method-name>
              <method-params>
              <method-param>javax.ejb.EJBObject</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>remove</method-name>
              <method-params>
              <method-param>java.lang.Object</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>remove</method-name>
              <method-params>
              <method-param>java.lang.Object</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserName</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getEJBHome</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserName</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getAccountId</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getAccountId</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserName</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserName</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserOverridePwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserOverridePwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserUpdateTimestamp</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserUpdateTimestamp</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserOnline</method-name>
              <method-params>
              <method-param>boolean</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserOnline</method-name>
              <method-params>
              <method-param>boolean</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>getAllUsers</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>getAllUsers</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserImage</method-name>
              <method-params />


              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserImage</method-name>
              <method-params />

              </method-permission>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserOnline</method-name>
              <method-params>
              <method-param>boolean</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserOnline</method-name>
              <method-params>
              <method-param>boolean</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getAccountId</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getAccountId</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>remove</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>remove</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserOverridePwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserOverridePwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>remove</method-name>
              <method-params>
              <method-param>javax.ejb.Handle</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserOverridePwd</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserOverridePwd</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserIp</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserIp</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>create</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>boolean</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>create</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>boolean</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserId</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserId</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserImage</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserImage</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserImage</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserImage</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>getAllUsers</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>getAllUsers</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getHandle</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserOnline</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserOnline</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>findByPrimaryKey</method-name>
              <method-params>
              <method-param>EJB.TimeStamp.EJB.UserPK</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>findByPrimaryKey</method-name>
              <method-params>
              <method-param>EJB.TimeStamp.EJB.UserPK</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserPwd</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserPwd</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>remove</method-name>
              <method-params>
              <method-param>java.lang.Object</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserUpdateTimestamp</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserUpdateTimestamp</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserPwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserPwd</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>getHomeHandle</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserAdmin</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserAdmin</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserUpdateTimestamp</method-name>
              <method-params>
              <method-param>java.sql.Timestamp</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserName</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserName</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserUpdateTimestamp</method-name>
              <method-params>
              <method-param>java.sql.Timestamp</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserAdmin</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserAdmin</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>getUserName</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>getUserName</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Home</method-intf>
              <method-name>getEJBMetaData</method-name>
              <method-params />

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Remote</method-intf>
              <method-name>setUserIp</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              <container-transaction>

              <ejb-name>UserBMBean</ejb-name>
              <method-intf>Local</method-intf>
              <method-name>setUserIp</method-name>
              <method-params>
              <method-param>java.lang.String</method-param>
              </method-params>

              <trans-attribute>Never</trans-attribute>
              </container-transaction>
              </assembly-descriptor>
              </ejb-jar>


              --------------------------------------------------------------------------------------

              I am using entity beans and my client would always be a servlet. So, I can't use Session bean instead of servlet.

              May be, I will have to insert Session bean as a intermediate layer between servlet and entity bean. But in that case also, I will have deal with session bean as remote object and I want to avoid that.

              Please suggest.

              Thanks,

              Suraj

              • 4. Re: Creating EJB object of local interface from servlet
                surajmundada Newbie

                Hi,

                I just came across a web-page which supports John's view that servlet can't access a EJB locally. It has to be a remote call. What we can do is wrap all the entity/session beans with a single session bean.

                This session bean can be called remotely by servlet and then session bean calls other required beans locally.

                see Figure5: Wrap entity bean with session bean to reduce network calls on http://www.precisejava.com/javaperf/j2ee/EJB.htm

                If you guys have any other solution than this, please post it.

                Regards,

                Suraj

                Thanks .....

                • 5. Re: Creating EJB object of local interface from servlet
                  Darran Lofthouse Master

                   

                  I just came across a web-page which supports John's view that servlet can't access a EJB locally. It has to be a remote call. What we can do is wrap all the entity/session beans with a single session bean.


                  Within JBoss it is possible to use the local interface from the servlet.

                  However as there are no performance gains and it will prevent you migrating to other architectures / application servers it is a good idea to wrap your entities behind session beans that are accessed remotely.