I'm using JBoss 2.0FINAL with TomCat and WebLogic's jDriver for SQL Server,
and would like to use JNDI to look up my database connection pool, and also
a few environment variables set in the web.xml file (via env-entry
elements).

>>> /lib/ext has:
mssql.jar (the WebLogic SQLServer driver)

>>> jboss.properties has:
jdbc.drivers=org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver,weblog
ic.jdbc20.mssqlserver4.Driver

>>> jboss.conf file has:
...
<MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar"
CODEBASE="../../lib/ext/">
    <ARG TYPE="java.lang.String" VALUE="InstantDB">
    <ARG TYPE="java.lang.String"
VALUE="org.jboss.minerva.xa.XADataSourceImpl">
</MLET>
<MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar"
CODEBASE="../../lib/ext/">
    <ARG TYPE="java.lang.String" VALUE="DefaultDS">
    <ARG TYPE="java.lang.String"
VALUE="org.jboss.minerva.xa.XADataSourceImpl">
</MLET>
<MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar,mssql.jar"
CODEBASE="../../lib/ext/">
    <ARG TYPE="java.lang.String" VALUE="nylimPool">
    <ARG TYPE="java.lang.String"
VALUE="org.jboss.minerva.xa.XADataSourceImpl">
</MLET>
...

>>> jboss.jcml has:
     <mbean name="DefaultDomain:service=XADataSource,name=InstantDB">
       <attribute name="Properties"></attribute>
       <attribute
name="URL">jdbc:idb:../conf/default/instantdb.properties</attribute>
       <attribute name="GCMinIdleTime">1200000</attribute>
       <attribute name="JDBCUser" />
       <attribute name="MaxSize">10</attribute>
       <attribute name="Password" />
       <attribute name="GCEnabled">false</attribute>
       <attribute name="InvalidateOnError">false</attribute>
       <attribute name="TimestampUsed">false</attribute>
       <attribute name="Blocking">true</attribute>
       <attribute name="GCInterval">120000</attribute>
       <attribute name="IdleTimeout">1800000</attribute>
       <attribute name="IdleTimeoutEnabled">false</attribute>
       <attribute name="LoggingEnabled">false</attribute>
       <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
       <attribute name="MinSize">0</attribute>
     </mbean>
     <mbean name="DefaultDomain:service=XADataSource,name=DefaultDS">
       <attribute name="Properties"></attribute>
       <attribute
name="URL">jdbc:HypersonicSQL:hsql://localhost:1476</attribute>
       <attribute name="GCMinIdleTime">1200000</attribute>
       <attribute name="JDBCUser">sa</attribute>
       <attribute name="MaxSize">10</attribute>
       <attribute name="Password" />
       <attribute name="GCEnabled">false</attribute>
       <attribute name="InvalidateOnError">false</attribute>
       <attribute name="TimestampUsed">false</attribute>
       <attribute name="Blocking">true</attribute>
       <attribute name="GCInterval">120000</attribute>
       <attribute name="IdleTimeout">1800000</attribute>
       <attribute name="IdleTimeoutEnabled">false</attribute>
       <attribute name="LoggingEnabled">false</attribute>
       <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
       <attribute name="MinSize">0</attribute>
     </mbean>
     <mbean name="DefaultDomain:service=XADataSource,name=nylimPool">
       <attribute name="Properties"></attribute>
       <attribute
name="URL">jdbc20:weblogic:mssqlserver4:nylim@localhost:1433</attribute>
       <attribute name="GCMinIdleTime">1200000</attribute>
       <attribute name="JDBCUser">sa</attribute>
       <attribute name="MaxSize">0</attribute>
       <attribute name="Password" />
       <attribute name="GCEnabled">false</attribute>
       <attribute name="InvalidateOnError">false</attribute>
       <attribute name="TimestampUsed">false</attribute>
       <attribute name="Blocking">true</attribute>
       <attribute name="GCInterval">120000</attribute>
       <attribute name="IdleTimeout">1800000</attribute>
       <attribute name="IdleTimeoutEnabled">false</attribute>
       <attribute name="LoggingEnabled">false</attribute>
       <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
       <attribute name="MinSize">0</attribute>
     </mbean>

>>> web.xml has:
<web-app>
  ...
  <env-entry>
    <env-entry-name>java.naming.factory.initial</env-entry-name>
 
<env-entry-value>org.jnp.interfaces.NamingContextFactory</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
  </env-entry>

  <env-entry>
    <env-entry-name>java.naming.provider.url</env-entry-name>
    <env-entry-value>localhost:1099</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
  </env-entry>

  <env-entry>
    <env-entry-name>jndi.db.poolname</env-entry-name>
    <env-entry-value>java:/nylimPool</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
  </env-entry>
  ...
</web-app>

>>> The JBoss console output the following during startup, which looks good:
...
[JDBC] Loaded JDBC-driver:org.hsql.jdbcDriver
[JDBC] Loaded JDBC-driver:org.enhydra.instantdb.jdbc.idbDriver
[JDBC] Loaded JDBC-driver:weblogic.jdbc20.mssqlserver4.Driver
...
[InstantDB] Starting
[InstantDB] XA Connection pool InstantDB bound to java:/InstantDB
...
[nylimPool] XA Connection pool nylimPool bound to java:/nylimPool
[nylimPool] Started
[DefaultDS] Starting
[DefaultDS] XA Connection pool DefaultDS bound to java:/DefaultDS

>>> However, jndiView produces the following (note that my EJB named
AcctMaint is bound to the tree, but the Connection Pools and Env Entries are
not. Don't know if this is expected???):

InitialContext
  +- TopicConnectionFactory
  +- jmx:JP:rmi
  +- QueueConnectionFactory
  +- topic
  |   +- metrics
  +- queue
  |   +- testQueue
  +- ejb
  |   +- AcctMaint
  +- invokers
  |   +- ejb
  |       +- AcctMaint
  +- jmx
  +- RemoteControl

>>> I have a test method to do JNDI lookups based on a key:

private static void lookup(String key)
{
    try
    {
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
        System.setProperty(Context.PROVIDER_URL, "localhost:1099");
        System.out.println("***** JNDI lookup : " + key);
        InitialContext ctx = new InitialContext();
        Object obj = ctx.lookup(key);
        System.out.println("***** got it!");
        System.out.println("***** value : " + obj.toString());
    }
    catch (Exception e)
    {
        System.out.println("***** Error getting: " + key + " - " +
e.toString());
    }
}

>>> and the following calls to lookup() product the corresponding JBoss
console output:

lookup("java:");
[EmbeddedTomcat] ***** JNDI lookup : java:
[EmbeddedTomcat] ***** got it!
[EmbeddedTomcat] ***** value : org.jnp.interfaces.NamingContext@479dfc

lookup("java:/");
[EmbeddedTomcat] ***** JNDI lookup : java:/
[EmbeddedTomcat] ***** got it!
[EmbeddedTomcat] ***** value : org.jnp.interfaces.NamingContext@1415c8

lookup("java:/topic");
[EmbeddedTomcat] ***** JNDI lookup : java:/topic
[EmbeddedTomcat] ***** got it!
[EmbeddedTomcat] ***** value : org.jnp.interfaces.NamingContext@6279d

lookup("java:/topic/metrics");
[EmbeddedTomcat] ***** JNDI lookup : java:/topic/metrics
[EmbeddedTomcat] ***** got it!
[EmbeddedTomcat] ***** value : Topic@metrics

lookup("java:/ejb");
[EmbeddedTomcat] ***** JNDI lookup : java:/ejb
[EmbeddedTomcat] ***** got it!
[EmbeddedTomcat] ***** value : org.jnp.interfaces.NamingContext@543cb1

lookup("java:/ejb/AcctMaint");
[EmbeddedTomcat] ***** JNDI lookup : java:/ejb/AcctMaint
[EmbeddedTomcat] ***** got it!
[EmbeddedTomcat] ***** value : ejb/AcctMaintHome

>>> Everything looks good, until I try to lookup the Connection Pools and
EnvEntry settings?

lookup("java:/InstantDB");
[EmbeddedTomcat] ***** JNDI lookup : java:/InstantDB
[EmbeddedTomcat] ***** Error getting: java:/InstantDB -
javax.naming.NameNotFoundException: InstantDB not bound

lookup("java:/DefaultDS");
[EmbeddedTomcat] ***** JNDI lookup : java:/DefaultDS
[EmbeddedTomcat] ***** Error getting: java:/DefaultDS -
javax.naming.NameNotFoundException: DefaultDS not bound

lookup("java:/nylimPool");
[EmbeddedTomcat] ***** JNDI lookup : java:/nylimPool
[EmbeddedTomcat] ***** Error getting: java:/nylimPool-
javax.naming.NameNotFoundException: nylimPool not bound

lookup("java:/java.naming.factory.initial");
[EmbeddedTomcat] ***** JNDI lookup : java:/java.naming.factory.initial
[EmbeddedTomcat] ***** Error getting: java:/java.naming.factory.initial -
javax.naming.NameNotFoundException: java.naming.factory.initial not bound

lookup("java:/comp/env/java.naming.factory.initial");
[EmbeddedTomcat] ***** JNDI lookup :
java:/comp/env/java.naming.factory.initial
[EmbeddedTomcat] ***** Error getting:
java:/comp/env/java.naming.factory.initial -
javax.naming.NameNotFoundException: comp not bound
 
>>> Questions:

1. Why does JBoss report the Connection Pools as bound, but they don't show
up using jndiView, and aren't in the JNDI tree on a lookup? I don't think
it's anything specific to the WebLogic driver, as the InstantDB and
DefaultDS Connection pools have the same problems, but I haven't modified
their config settings from the installation.

2. Why aren't the env-entry settings showing up either?

3. Once these issues are resolved, how do I go about getting my
EnvEntries/EJBs/Connection Pools bound to the recommended contexts of the
JNDI tree (e.g., java:/comp/env/myEnvSetting, java:/comp/env/ejb/myEJB,
java:/comp/env/jdbc/myConnectionPool)

I appreciate the help. Thanks in advance.

John Pellegrini
[EMAIL PROTECTED]



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

Reply via email to