I didn't know about having to do datasource's w/ app servers, but I can see
how the db pooling would not have been used. Thnxs, this looks like my
problem.

Now I'm trying to get a proper mapping w/ a resource manager and resource
reference in jboss.xml. Currently w/ this config, I get an exception of
'jdbc not bound', but I'm sure it's not all correct.

Chptr 6 talks about resource refs, but using jboss-web.xml, and I'm having a
hard enough time as it is w/ all these descriptors. Can someone verify my
below configuration.

--- MyServlet.java -------------------------
(this all works and calls the session bean below correctly)
...
  Object result = ctx.lookup("java:comp/env/ejb/DBaseListMaps");
...

--- MySessionBean.java ---------------------
   public Connection getConnection() throws SQLException {

      if (dataSource == null) {
         try {
            Context context = new InitialContext();
            dataSource = (DataSource)
               context.lookup("java:comp/env/jdbc/PostgresqlDB");
         }
         catch (Exception e) {
            throw new SQLException("getConnection failed:" +
               e.toString());
         }
      }

      return dataSource.getConnection();
   }

--- jboss.xml ------------------------------
...
   <resource-managers>
      <resource-manager>
         <res-name>jdbc/PostgresqlDB</res-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-jndi-name>PostgresqlDB</res-jndi-name>
      </resource-manager>
   </resource-managers>

   <enterprise-beans>
      <session>
         <ejb-name>DBaseListMaps</ejb-name>
         <jndi-name>ejb/DBaseListMaps</jndi-name>
         <resource-ref>
            <res-ref-name>jdbc/PostgresqlDB</res-ref-name>
            <resource-name>PostgresqlDB</resource-name>
         </resource-ref>
      </session>
   </enterprise-beans>
...

--- ejb-jar.xml ----------------------------
...
   <session>
   <ejb-name>DBaseListMaps</ejb-name>
   <home>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetchHome</home>
   <remote>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetch</remote>

<ejb-class>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetchBean</ejb-cl
ass>
   <session-type>Stateless</session-type>
   <transaction-type>Container</transaction-type>
   </session>
...

--- jboss-web.xml --------------------------
...
   <ejb-ref>
      <ejb-ref-name>ejb/DBaseListMaps</ejb-ref-name>
      <jndi-name>DBaseListMaps</jndi-name>
   </ejb-ref>
...

--- web.xml -------------------------------
...
   <ejb-ref>
      <ejb-ref-name>ejb/DBaseListMaps</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <home>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetchHome</home>
      <remote>com.neuroquest.cais.ejb.session.dbaseFetch.DBaseFetch</remote>
      <ejb-link>DBaseListMaps</ejb-link>
   </ejb-ref>
...


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to