Hi,
 
I am trying to set up JBoss so I can connect to a database from a session bean. When I run JBoss, it starts up without problems, but the ConnectionFactory doesn't get bound under JNDI. Can anybody help? I'm at the end of my wits.
 
Thanks a lot in advance!
Anna Verena Linder
------------------------------------- 
Here is a description of my configuration:
 
I have the oracle jdbc driver zip under JBOSS/lib/ext. 
 
The entry in ejb-jar.xml is:
 
<resource-ref>
   <description>Oracle User Data</description>
   <res-ref-name>jdbc/OracleUser</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Application</res-auth>
</resource-ref>
 
and the entries in jboss.xml are:
 
<resource-ref>
   <res-ref-name>jdbc/OracleUser</res-ref-name>
   <resource-name>OracleUser</resource-name>
</resource-ref>
 
and
 
<resource-managers>
    <resource-manager res-class="">
       <res-name>OracleUser</res-name>
       <res-jndi-name>java:/OracleUser</res-jndi-name>
    </resource-manager>
</resource-managers>
 
The Namespace of my bean contains an entry java:comp/env/jdbc/OracleUser, which points to java:/OracleUser, but in the java: Namespace, there is no OracleUser entry.
 
The mbean entry in my jboss.jcml looks like this:
 
<mbean code="org.jboss.resource.ConnectionFactoryLoader"
         name="jboss.jca:service=ConnectionFactoryLoader,name=OracleUser">
    <attribute name="JndiName">OracleUser</attribute>
    <attribute name="FactoryName">OracleUser</attribute>
    <attribute name="TransactionManagerName">java:/TransactionManager</attribute>
 
    <attribute name="RARDeployerName">JCA:service=RARDeployer</attribute>
    <depends optional-attribute-name="ResourceAdapterName">
        jboss.jca:service=RARDeployment,name=Minerva JDBC LocalTransaction ResourceAdapter
    </depends>
    <attribute name="ConnectionManagerFactoryName">
      MinervaNoTransCMFactory
    </attribute>
 
    <attribute name="ManagedConnectionFactoryProperties">
      ConnectionURL=jdbc:oracle:thin:@diablo:1521:olga
      Driver=oracle.jdbc.driver.OracleDriver
      TransactionIsolation=TRANSACTION_NONE
    </attribute>
 
    <depends optional-attribute-name="ConnectionManagerFactoryLoaderName">
        jboss.jca:service=ConnectionManagerFactoryLoader,name=MinervaNoTransCMFactory
    </depends>
 
    <attribute name="ConnectionManagerProperties">
      MinSize=0
      MaxSize=10
      BlockingTimeoutMillis=50000
      IdleTimeoutMinutes=30
      CleanupIntervalMinutes=10
      MaxIdleTimeoutPercent=1.0
    </attribute>
    <attribute name="PrincipalMappingClass">
      org.jboss.resource.security.ManyToOnePrincipalMapping
    </attribute>
    <attribute name="PrincipalMappingProperties">
        userName=myuser
        password=mypasswd
    </attribute>
</mbean>
 
In the session bean, I call
 
InitialContext jndiContext = new InitialContext();
         DataSource source = (DataSource)
                    jndiContext.lookup("java:comp/env/jdbc/OracleUser");
 
which throws me a NameNotFoundException: "OracleUser not bound".

Reply via email to