0 Replies Latest reply on Jun 29, 2003 4:59 AM by madooreddy

    [b]Datasource[DB2] not bounding with EJB's[/b]

    madooreddy Newbie

      Dear All

      I have deployed my beans jboss-2.4.4 sucessfully as for ./Jboss-home/bin/nohup.out file and when i accessing the bean from client side (i have using jakarth-tomact 4.0.3 for my servlets) through browser
      It giving

      javax.servlet.ServletException: Name DefaultDS is not bound in this Context
      at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
      at org.apache.jsp.retrieveNoticeUserList$jsp._jspService(retrieveNoticeUserList$jsp.java:429)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

      root cause

      javax.naming.NameNotFoundException: Name DefaultDS is not bound in this Context
      at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at com.wizit.util.EJBUtility.getConnection(EJBUtility.java:31

      And here is the Connection method where getting exception
      public static java.sql.Connection getConnection() throws NamingException, SQLException {
      /* InitialContext ctx = new InitialContext();
      DataSource ds = (DataSource)ctx.lookup(WizAcsProp.POOL_DS_EIS);
      return ds.getConnection();*/


      Connection connection = null;
      try
      {
      String s = "java:DefaultDS";
      Properties properties = new Properties();
      properties.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      InitialContext initialcontext = new InitialContext(properties);
      DataSource datasource = (DataSource)initialcontext.lookup(s);
      connection = datasource.getConnection("smsdb", "smsdb");
      System.out.println("EJBUtility :: getConnection :: at the end");
      }
      catch(NamingException namingexception)
      {
      throw namingexception;
      }
      catch(SQLException sqlexception)
      {
      throw sqlexception;
      }
      return connection;
      }


      And here are the ejb-jar.xml, jaws.xml and jboss.xml
      [b]ejb-jar.xml
      <?xml version="1.0" encoding="UTF-8"?>

      <ejb-jar>
      <enterprise-beans>

      <ejb-name>NoticeBean</ejb-name>
      com.wizit.notice.ejb.NoticeHome
      com.wizit.notice.ejb.Notice
      <ejb-class>com.wizit.notice.ejb.NoticeBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.wizit.notice.ejb.NoticeKey</prim-key-class>
      False
      <cmp-field><field-name>content</field-name></cmp-field>
      <cmp-field><field-name>create_date</field-name></cmp-field>
      <cmp-field><field-name>create_time</field-name></cmp-field>
      <cmp-field><field-name>is_url</field-name></cmp-field>
      <cmp-field><field-name>notice_grp_seq</field-name></cmp-field>
      <cmp-field><field-name>seq</field-name></cmp-field>
      <cmp-field><field-name>title</field-name></cmp-field>
      <!--<primkey-field>resultPK</primkey-field>-->


      <ejb-name>NoticeGroupControlBean</ejb-name>
      com.wizit.notice.ejb.NoticeGroupControlHome
      com.wizit.notice.ejb.NoticeGroupControl
      <ejb-class>com.wizit.notice.ejb.NoticeGroupControlBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>NoticeBean</ejb-name>
      <method-name>*</method-name>



      <ejb-name>NoticeGroupControlBean</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>
      jaws.xml

      DefaultDS
      <type-mapping>DB2</type-mapping>
      <enterprise-beans>

      <ejb-name>NoticeBean</ejb-name>
      <table-name>TBL_NOTICE</table-name>

      <create-table>true</create-table>
      <remove-table>false</remove-table>

      <cmp-field>
      <field-name>content</field-name>
      <column-name>CONTENT</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>create_date</field-name>
      <column-name>CREATE_DATE</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>create_time</field-name>
      <column-name>CREATE_TIME</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>is_url</field-name>
      <column-name>IS_URL</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>notice_grp_seq</field-name>
      <column-name>NOTICE_GRP_SEQ</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>seq</field-name>
      <column-name>SEQ</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>title</field-name>
      <column-name>TITLE</column-name>
      </cmp-field>


      </enterprise-bean>

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

      false
      <enterprise-beans>

      <ejb-name>NoticeBean</ejb-name>
      <jndi-name>com/wizit/notice/ejb/NoticeHome</jndi-name>


      <ejb-name>NoticeGroupControlBean</ejb-name>
      <jndi-name>com/wizit/notice/ejb/NoticeGroupControlHome</jndi-name>
      <configuration-name></configuration-name>

      </enterprise-beans>


      Pls help me out to solve this problem ..
      Heighly appreciate your great help..

      Many thanks in advance

      with regards
      Madoo Reddy