9 Replies Latest reply: Apr 24, 2012 7:36 AM by Phani Reddy V RSS

JBOSS JNDI ERROR: Could not find datasource: ccib0Data

Francesco Bonavia Newbie

Hi to all,

 

I'm trying to deploy a web application called "CibAudit" using a JNDI connection in hibernate with JBOSS 5.1

 

 

First of all I post you some files of my project:

 

 

    *******************************************************************************

    "WEB.XML"

   <?xml version="1.0" encoding="iso-8859-1"?>

 

 

   <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

   <web-app>

    <display-name>Cibaudit Web Application</display-name>

   

   

    <servlet>

                    <servlet-name>cibaudit</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.CibAuditServlet</servlet-class>

          </servlet>

 

 

 

           <servlet>

                    <servlet-name>ShowConsuntivi</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.ShowConsuntiviServlet</servlet-class>

          </servlet>

 

 

 

          <servlet>

                    <servlet-name>ShowBudget</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.ShowBudgetServlet</servlet-class>

          </servlet>

 

          <servlet>

                    <servlet-name>ShowHome</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.ShowHomeServlet</servlet-class>

          </servlet>

 

          <servlet>

                    <servlet-name>ConsRicerca</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.ConsRicercaServlet</servlet-class>

          </servlet>

 

 

          <servlet>

                    <servlet-name>ConsInvio</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.ConsInvioServlet</servlet-class>

          </servlet>

 

 

 

        <servlet>

                    <servlet-name>BudgetRicerca</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.BudgetRicercaServlet</servlet-class>

          </servlet>

 

          <servlet>

                    <servlet-name>BudgetRevAuto</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.BudgetRevAutoServlet</servlet-class>

          </servlet>

 

 

 

          <servlet>

                    <servlet-name>BudgetRevPunt</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.BudgetRevPuntServlet</servlet-class>

          </servlet>

 

 

 

          <servlet>

                    <servlet-name>ConsLoadRettifica</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.ConsLoadRettificaServlet</servlet-class>

          </servlet>

 

 

 

          <servlet>

                    <servlet-name>SearchConsRettifica</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.SearchConsRettificaServlet</servlet-class>

          </servlet>

 

 

 

          <servlet>

                    <servlet-name>SearchBudgetRettifica</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.SearchBudgetRettificaServlet</servlet-class>

          </servlet>

 

 

 

          <servlet>

                    <servlet-name>BudgetLoadRevPunt</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.BudgetLoadRevPuntServlet</servlet-class>

          </servlet>

 

 

 

 

 

 

          <servlet>

                    <servlet-name>BudgetLoadRevAuto</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.BudgetLoadRevAutoServlet</servlet-class>

          </servlet>

 

 

          <servlet>

                    <servlet-name>LoginPrepare</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.login.LoginPrepareServlet</servlet-class>

          </servlet>

 

 

 

 

          <servlet>

                    <servlet-name>Login</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.login.LoginServlet</servlet-class>

          </servlet>

 

 

 

 

          <servlet>

                    <servlet-name>LoginBack</servlet-name>

                    <servlet-class>com.sanpaolo.cibaudit.servlet.LoginBackServlet</servlet-class>

          </servlet>

 

          <servlet-mapping>

                    <servlet-name>SearchBudgetRettifica</servlet-name>

                    <url-pattern>/SearchBudgetRettifica.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>LoginBack</servlet-name>

                    <url-pattern>/security/LoginBack.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>Login</servlet-name>

                    <url-pattern>/login/Login.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>LoginPrepare</servlet-name>

                    <url-pattern>/login/LoginPrepare.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>BudgetLoadRevAuto</servlet-name>

                    <url-pattern>/BudgetLoadRevAuto.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>BudgetLoadRevPunt</servlet-name>

                    <url-pattern>/BudgetLoadRevPunt.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>SearchConsRettifica</servlet-name>

                    <url-pattern>/SearchConsRettifica.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>ConsLoadRettifica</servlet-name>

                    <url-pattern>/ConsLoadRettifica.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>BudgetRevPunt</servlet-name>

                    <url-pattern>/BudgetRevPunt.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>BudgetRevAuto</servlet-name>

                    <url-pattern>/BudgetRevAuto.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>BudgetRicerca</servlet-name>

                    <url-pattern>/BudgetRicerca.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>ShowBudget</servlet-name>

                    <url-pattern>/ShowBudget.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>ShowHome</servlet-name>

                    <url-pattern>/ShowHome.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>ConsRicerca</servlet-name>

                    <url-pattern>/ConsRicerca.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>ConsInvio</servlet-name>

                    <url-pattern>/ConsInvio.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>cibaudit</servlet-name>

                    <url-pattern>/Enter.do</url-pattern>

          </servlet-mapping>

          <servlet-mapping>

                    <servlet-name>ShowConsuntivi</servlet-name>

                    <url-pattern>/ShowConsuntivi.do</url-pattern>

          </servlet-mapping>

 

    <session-config>

        <session-timeout>60</session-timeout>

    </session-config>

 

    <welcome-file-list>

        <welcome-file>index.jsp</welcome-file>

    </welcome-file-list>

 

 

    <taglib>

        <taglib-uri>/WEB-INF/taglib/jsptabcontrol.tld</taglib-uri>

        <taglib-location>/WEB-INF/taglib/jsptabcontrol.tld</taglib-location>

    </taglib>

   

    <taglib>

        <taglib-uri>/WEB-INF/taglib/jsptabcontrol-el.tld</taglib-uri>

        <taglib-location>/WEB-INF/taglib/jsptabcontrol-el.tld</taglib-location>

    </taglib>

   

 

    <resource-ref>

        <description>Data Source</description>

        <res-ref-name>ccib0Data</res-ref-name>

        <res-type>javax.sql.DataSource</res-type>

        <res-auth>Container</res-auth>

   </resource-ref>

 

 

   </web-app>

 

 

    ***************************************************************************

   

    Then this the hibernate.cfg.xml file where I set my datasource name.

    Do I need to use jdbc/ccib0Data or only ccib0Data?

    "hibernate.cfg.xml"

 

 

    <?xml version='1.0' encoding='utf-8'?>

    <!DOCTYPE hibernate-configuration PUBLIC

    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

 

 

     <hibernate-configuration>

   

    <session-factory>

 

    <property name="connection.datasource">ccib0Data</property>

   

   

    <property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>

   

    <property name="hibernate.jdbc.batch_size">30</property>

    <property name="hibernate.show_sql">false</property>

   

   

    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>

       

    <!-- SQL dialect -->

    <mapping resource="com/sanpaolo/cibaudit/util/model/AuditLogOp.hbm.xml"/>

          <mapping resource="com/sanpaolo/cibaudit/util/model/StgAuditRevBdgAt.hbm.xml"/>

          <mapping resource="com/sanpaolo/cibaudit/util/model/StgAuditRevBdgPt.hbm.xml"/>

          <mapping resource="com/sanpaolo/cibaudit/util/model/StgAuditRetCons.hbm.xml"/>

          <mapping resource="com/sanpaolo/cibaudit/util/model/ViewAudit.hbm.xml"/>

          <mapping resource="com/sanpaolo/cibaudit/util/model/ScrAuditRetCons.hbm.xml"/>

          <mapping resource="com/sanpaolo/cibaudit/util/model/ScrAuditRevBdgAt.hbm.xml"/>

          <mapping resource="com/sanpaolo/cibaudit/util/model/ScrAuditRevBdgPt.hbm.xml"/>

 

 

     </session-factory>

     </hibernate-configuration>

 

 

     ******************************************************************************************

     Then this is the jboss-web.xml where I set resource-ref with the same name I used in

     the web.xml. Is it correct?

 

 

     "jboss-web.xml"

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

     <jboss-web>

          <resource-ref>

        <res-ref-name>ccib0Data</res-ref-name>

        <res-type>javax.sql.DataSource</res-type>

        <jndi-name>ccib0Data</jndi-name>

    </resource-ref>

    </jboss-web>

 

 

    ***********************************************************************************

    The context.xml contains the resource link name which is the same used in the

    web.xml. Is it correct?

  

    "context.xml"

    <!-- The contents of this file will be loaded for each web application -->

    <Context antiJARLocking="true" antiResourceLocking="true">

 

 

    <!-- Default set of monitored resources -->

    <WatchedResource>WEB-INF/web.xml</WatchedResource>

 

     <ResourceLink name="ccib0Data"

            global="ccib0Data"

            type="javax.sql.DataSource"/>

 

     </Context>

 

 

     *********************************************************************************************

 

 

     Then I've created a Datasource using the admin-console of JBOSS 5.1.

     This is the file of my datasource in JBOSS directory:

       "ccib0Data-ds.xml"

 

 

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

    <datasources>

    <local-tx-datasource>

        <jndi-name>ccib0Data</jndi-name>

        <rar-name>jboss-local-jdbc.rar</rar-name>

        <use-java-context>true</use-java-context>

        <connection-definition>javax.sql.DataSource</connection-definition>

        <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>

        <min-pool-size>0</min-pool-size>

        <max-pool-size>20</max-pool-size>

        <blocking-timeout-millis>30000</blocking-timeout-millis>

        <idle-timeout-minutes>30</idle-timeout-minutes>

        <prefill>false</prefill>

        <background-validation>false</background-validation>

        <background-validation-millis>0</background-validation-millis>

        <validate-on-match>true</validate-on-match>

        <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>

        <isSameRM-override-value>false</isSameRM-override-value>

        <allocation-retry>0</allocation-retry>

        <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

        <security-domain xsi:type="securityMetaData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

        <metadata>

            <type-mapping>Oracle9i</type-mapping>

        </metadata>

        <type-mapping>Oracle9i</type-mapping>

        <local-transaction/>

        <user-name>CCIB_APP</user-name>

        <password>CCIB_APP</password>

        <check-valid-connection-sql>SELECT * FROM DUAL</check-valid-connection-sql>

        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

        <prepared-statement-cache-size>0</prepared-statement-cache-size>

        <share-prepared-statements>false</share-prepared-statements>

        <set-tx-query-timeout>false</set-tx-query-timeout>

        <query-timeout>0</query-timeout>

        <use-try-lock>60000</use-try-lock>

        <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

        <connection-url>jdbc:oracle:thin:@angelico.replynet.prv:1522:orcl</connection-url>

    </local-tx-datasource>

    </datasources>

 

 

    **************************************************************************************************

 

 

     After creating all these files I tried to deploy the application in JBOSS 5.1 and all is well.

     When I try to access to my application using http://localhost:8080/CibAudit I have this error:

 

 

 

     18:17:23,985 INFO  [STDOUT] 2012 04 18  18:17:23,985 | FATAL | DatasourceConnect

     ionProvider: - Could not find datasource: ccib0Data

     javax.naming.NameNotFoundException: ccib0Data not bound

        at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)

        at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)

        at org.jnp.server.NamingServer.getObject(NamingServer.java:785)

        at org.jnp.server.NamingServer.lookup(NamingServer.java:443)

        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)

        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

        at javax.naming.InitialContext.lookup(InitialContext.java:392)

        at org.hibernate.connection.DatasourceConnectionProvider.configure(Datas

        ourceConnectionProvider.java:52)

        at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi

     der(ConnectionProviderFactory.java:124)

        at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi

     der(ConnectionProviderFactory.java:56)

        at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFa

     ctory.java:414)

        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:

      62)

        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073

      )

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav

      a:1298)

      *********************************************************************************

 

 

     Could someone help me?

     I don't know where is the error and if the error is in some of my project's file or in the creation of the datasource in       JBOSS.

 

 

     Thanks a lot,

      Francesco

  • 1. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Phani Reddy V Newbie

    Try changing the hibernate.datasource parameter in hibernate.cfg.xml to the below:

     

    java:/comp/env/jdbc/ccib0Data

     

    Because, the error is thrown from Hibernate. Please check it and let us know if any issue.

  • 2. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Francesco Bonavia Newbie

    Thanks Phani,

     

    thanks a lot for the answer. The first problem was solved but now when I try to access to DB executing a query I have this error:

     

    09:50:30,962 WARN  [AbstractManagedObjectPopulator] Cannot create String name from non-Simple property:

    ManagedProperty{JNDIName,JNDIName,metaType=SimpleMetaTyp

    e:java.lang.String}, value=null

    09:50:30,977 WARN  [AbstractManagedObjectPopulator] Cannot create String name fr

    om non-Simple property: ManagedProperty{JNDIName,JNDIName,metaType=SimpleMetaTyp

    e:java.lang.String}, value=null

    09:50:57,496 INFO  [STDOUT] 2012 04 19  09:50:57,496 |  WARN | common: - before

    property list

    09:50:57,496 INFO  [STDOUT] 2012 04 19  09:50:57,496 |  WARN | query: - START QU

    ERY CONFIGURATION PARAMETERS

    09:50:57,496 INFO  [STDOUT] 2012 04 19  09:50:57,496 |  WARN | util: - before to

    join the DB

    09:50:58,137 INFO  [STDOUT] 2012 04 19  09:50:58,137 |  WARN | UserSuppliedConne

    ctionProvider: - No connection properties specified - the user must supply JDBC

    connections

    09:50:58,903 INFO  [STDOUT] 2012 04 19  09:50:58,903 |  WARN | util: - joined to

    DB

    09:50:58,996 ERROR [STDERR] java.lang.UnsupportedOperationException: The user mu

    st supply a JDBC connection

     

    This is my "ConfigProperties.java" where I ask for the properties stored in database

    ************************************************************************

    Query query = new Query();

                      logger.warn("before property list");

                      mapPropertyFromDb = query.listPropertiesMap();

                      logger.warn("after property list");

    ************************************************************************

     

    Then this is my "Query.java" where I query the database to give me the properties:

    ***********************************************************************************

    public Map<String, String> listPropertiesMap() {

     

                        logger.warn("START QUERY CONFIGURATION PARAMETERS");

                        Map<String, String> mapResult = new HashMap();

                        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

                        session.beginTransaction();

                        List result = session.createSQLQuery("select property,valuep from T_AUDIT_PROPERTY").list();

                        session.getTransaction().commit();

                        Object row[]=new Object[2];

                        for ( Iterator i=result.iterator();i.hasNext();){

                            row=(Object[])i.next();

                            mapResult.put(row[0].toString() , row[1].toString());

                          }

                        logger.warn("END QUERY CONFIGURATION PARAMETERS");

     

                        return mapResult;

     

              }

    **************************************************************************

     

    And this is my "HibernateUtil.java" where I try to join to my database:

    ****************************************************************************

    public class HibernateUtil {

     

     

              static final Logger logger = Logger.getLogger(HibernateUtil.class.getPackage().getName());

     

     

      private static final SessionFactory sessionFactory;

     

     

        static {

            try {

           

            // Create the SessionFactory from hibernate.cfg.xml

                      logger.warn("before to join the DB");

                      //sessionFactory = new Configuration().configure().buildSessionFactory();

                      sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();

                      logger.warn("joined to DB");

            } catch (Throwable ex) {

                // Make sure you log the exception, as it might be swallowed

                System.err.println("Initial SessionFactory creation failed." + ex);

                throw new ExceptionInInitializerError(ex);

            }

        }

     

     

        public static SessionFactory getSessionFactory() {

            return sessionFactory;

        }

     

     

    }

    **********************************************************************************************

     

    In your opinion the error is in my java class or is some other configuration

    that are not correct?

     

    Thanks again

    Regards,

    Francesco

  • 4. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Francesco Bonavia Newbie

    Dear Phani,

     

    this is my new hibernate.cfg.xml after your indication:

     

    "hibernate.cfg.xml":

    ************************************************************************************

    <?xml version='1.0' encoding='utf-8'?>

    <!DOCTYPE hibernate-configuration PUBLIC

      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

     

     

    <hibernate-configuration>

       

        <session-factory>

     

              <property name="hibernate.connection.datasource">java:/comp/env/jdbc/ccib0Data</property>

       

        <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>

              <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>

       

        <!--

        <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>

              <property name="hibernate.connection.url">jdbc:oracle:thin:@angelico.replynet.prv:1522:orcl</property>

              <property name="hibernate.connection.url">jdbc:oracle:thin:@dbTCCIB0.sede.corp.sanpaoloimi.com:1806:TCCIB0</property>

              <property name="hibernate.connection.username">CCIB_APP</property>

        <property name="hibernate.connection.password">CCIB_APP</property>

        -->

       

        <property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>

       

        <property name="hibernate.jdbc.batch_size">30</property>

        <property name="hibernate.show_sql">false</property>

           

        <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>

           

        <!-- configuration pool via c3p0

        <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

              <property name="hibernate.c3p0.acquire_increment">1</property>

        <property name="hibernate.c3p0.idle_test_period">3000</property>

        <property name="hibernate.c3p0.max_size">5</property>

        <property name="hibernate.c3p0.max_statements">0</property>

        <property name="hibernate.c3p0.min_size">1</property>

        <property name="hibernate.c3p0.timeout">6000</property>

         -->

       

        <!-- SQL dialect -->

        <mapping resource="com/sanpaolo/cibaudit/util/model/AuditLogOp.hbm.xml"/>

              <mapping resource="com/sanpaolo/cibaudit/util/model/StgAuditRevBdgAt.hbm.xml"/>

              <mapping resource="com/sanpaolo/cibaudit/util/model/StgAuditRevBdgPt.hbm.xml"/>

              <mapping resource="com/sanpaolo/cibaudit/util/model/StgAuditRetCons.hbm.xml"/>

              <mapping resource="com/sanpaolo/cibaudit/util/model/ViewAudit.hbm.xml"/>

              <mapping resource="com/sanpaolo/cibaudit/util/model/ScrAuditRetCons.hbm.xml"/>

              <mapping resource="com/sanpaolo/cibaudit/util/model/ScrAuditRevBdgAt.hbm.xml"/>

              <mapping resource="com/sanpaolo/cibaudit/util/model/ScrAuditRevBdgPt.hbm.xml"/>

     

     

         </session-factory>

    </hibernate-configuration>

    *********************************************************************************************************

     

    But now I have again this error:

     

    **********************************************************************************************************

    10:16:31,536 INFO  [DeployHandler] Begin start, [vfszip:/C:/Programmi/jboss-5.1.

    0.GA/server/default/deploy/CibAudit.war/]

    10:17:00,371 INFO  [TomcatDeployment] deploy, ctxPath=/CibAudit

    10:17:00,778 INFO  [DeployHandler] End start, [vfszip:/C:/Programmi/jboss-5.1.0.

    GA/server/default/deploy/CibAudit.war/]

    10:17:01,059 WARN  [AbstractManagedObjectPopulator] Cannot create String name fr

    om non-Simple property: ManagedProperty{JNDIName,JNDIName,metaType=SimpleMetaTyp

    e:java.lang.String}, value=null

    10:17:01,059 WARN  [AbstractManagedObjectPopulator] Cannot create String name fr

    om non-Simple property: ManagedProperty{JNDIName,JNDIName,metaType=SimpleMetaTyp

    e:java.lang.String}, value=null

    10:17:25,425 INFO  [STDOUT] 2012 04 19  10:17:25,425 |  WARN | common: - before

    property list

    10:17:25,425 INFO  [STDOUT] 2012 04 19  10:17:25,425 |  WARN | query: - START QU

    ERY CONFIGURATION PARAMETERS

    10:17:25,425 INFO  [STDOUT] 2012 04 19  10:17:25,425 |  WARN | util: - before to

    join the DB

    10:17:26,097 INFO  [STDOUT] 2012 04 19  10:17:26,097 | FATAL | DatasourceConnect

    ionProvider: - Could not find datasource: java:/comp/env/jdbc/ccib0Data

    javax.naming.NameNotFoundException: jdbc not bound

            at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)

            at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)

            at org.jnp.server.NamingServer.getObject(NamingServer.java:785)

            at org.jnp.server.NamingServer.lookup(NamingServer.java:396)

            at org.jnp.server.NamingServer.lookup(NamingServer.java:399)

            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)

            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:833)

            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

            at javax.naming.InitialContext.lookup(InitialContext.java:392)

            at org.hibernate.connection.DatasourceConnectionProvider.configure(Datas

    ourceConnectionProvider.java:52)

            at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi

    der(ConnectionProviderFactory.java:124)

            at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi

    der(ConnectionProviderFactory.java:56)

            at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFa

    ctory.java:414)

            at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:

    62)

            at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073

    )

            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav

    a:1298)

            at com.sanpaolo.cibaudit.util.HibernateUtil.<clinit>(HibernateUtil.java:

    20)

            at com.sanpaolo.cibaudit.util.query.Query.listPropertiesMap(Query.java:2

    99)

            at com.sanpaolo.cibaudit.controller.common.ConfigProperties.<clinit>(Con

    figProperties.java:30)

    ***********************************************************************************************

     

    Any ideas?

     

    Thanks a lot,

    Francesco

  • 5. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Phani Reddy V Newbie

    Francesco, I did completely replicated your scenario in my box. Found few changes which should fix your problem.

     

    1. Inside your jboss-web.xml change <jndi-name> value to java:ccib0Data
    2. Change hibernate-cfg.xml to <property name="hibernate.connection.datasource">java:comp/env/ccib0Data</property>
    3. I didn't had any thing on context.xml but you could try it (optional)

     

    Please let me know if that works.

  • 6. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Francesco Bonavia Newbie

    Dear Phani,

     

    I've done all the modify you've told me, but I still have the problem.

     

    *********************************************************************************************

    14:48:17,705 INFO  [STDOUT] 2012 04 19  14:48:17,705 |  WARN | util: - before to

    join the DB

    14:48:18,330 INFO  [STDOUT] 2012 04 19  14:48:18,330 | FATAL | DatasourceConnect

    ionProvider: - Could not find datasource: java:comp/env/ccib0Data

    javax.naming.NamingException: Could not dereference object [Root exception is ja

    vax.naming.NameNotFoundException: ccib0Data not bound]

            at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1352)

     

     

            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:817)

            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:833)

            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

    **************************************************************************************************

    I've done a screenshot of my Eclipse Project to check if all the files are in the correct directory:

     

    eclipse_cibaudit.JPG

    eclipse_cibaudit_2.JPG

     

    eclipse_cibaudit_3.JPG

     

    ccib0Data-ds.xml.JPG

     

    Could you send me your files so I can check with mine ?

    My email address is: f.bonavia@reply.it

     

    Thanks a lot

    Francesco

  • 7. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Phani Reddy V Newbie

    I have sent an email.Please take a look.

  • 8. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Francesco Bonavia Newbie

    The problem is solved.

    I was using the oracle driver classed12.jar and that's wrong.

     

    The correct oracle driver is: ojdbc14.jar

     

    Then this is the log of the application:

     

    **********************************************************************************************

    13:25:54,112 WARN  [query] START QUERY CONFIGURATION PARAMETERS

    13:25:54,128 WARN  [util] before to join the DB

    13:25:54,128 INFO  [Configuration] configuring from resource: hibernate-cfg.xml

    13:25:54,128 INFO  [Configuration] Configuration resource: hibernate-cfg.xml

    13:25:54,565 INFO  [Configuration] Configured SessionFactory: null

    13:25:54,565 INFO  [NamingHelper] JNDI InitialContext properties:{}

    13:25:54,612 INFO  [DatasourceConnectionProvider] Using datasource: java:comp/en

    v/ccib0Data

    13:25:55,128 INFO  [SettingsFactory] RDBMS: Oracle, version: Oracle Database 10g

    Enterprise Edition Release 10.2.0.3.0 - Production

    With the Partitioning, OLAP and Data Mining options

    13:25:55,128 INFO  [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 1

    0.2.0.3.0

    13:25:55,128 INFO  [Dialect] Using dialect: org.hibernate.dialect.Oracle10gDiale

    ct

    13:25:55,128 INFO  [TransactionFactoryFactory] Using default transaction strateg

    y (direct JDBC transactions)

    13:25:55,128 INFO  [TransactionManagerLookupFactory] No TransactionManagerLookup

    configured (in JTA environment, use of read-write or transactional second-level

    cache is not recommended)

    13:25:55,128 INFO  [SettingsFactory] Automatic flush during beforeCompletion():

    disabled

    13:25:55,128 INFO  [SettingsFactory] Automatic session close at end of transacti

    on: disabled

    13:25:55,128 INFO  [SettingsFactory] JDBC batch size: 30

    13:25:55,128 INFO  [SettingsFactory] JDBC batch updates for versioned data: disa

    bled

    13:25:55,128 INFO  [SettingsFactory] Scrollable result sets: enabled

    13:25:55,128 INFO  [SettingsFactory] JDBC3 getGeneratedKeys(): disabled

    13:25:55,128 INFO  [SettingsFactory] Connection release mode: auto

    13:25:55,128 INFO  [SettingsFactory] Default batch fetch size: 1

    13:25:55,128 INFO  [SettingsFactory] Generate SQL with comments: disabled

    13:25:55,128 INFO  [SettingsFactory] Order SQL updates by primary key: disabled

    13:25:55,128 INFO  [SettingsFactory] Order SQL inserts for batching: disabled

    13:25:55,128 INFO  [SettingsFactory] Query translator: org.hibernate.hql.ast.AST

    QueryTranslatorFactory

    13:25:55,128 INFO  [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory

    13:25:55,128 INFO  [SettingsFactory] Query language substitutions: {}

    13:25:55,128 INFO  [SettingsFactory] JPA-QL strict compliance: disabled

    13:25:55,128 INFO  [SettingsFactory] Second-level cache: enabled

    13:25:55,128 INFO  [SettingsFactory] Query cache: disabled

    13:25:55,128 INFO  [SettingsFactory] Cache region factory : org.hibernate.cache.

    impl.NoCachingRegionFactory

    13:25:55,128 INFO  [SettingsFactory] Optimize cache for minimal puts: disabled

    13:25:55,128 INFO  [SettingsFactory] Structured second-level cache entries: disa

    bled

    13:25:55,128 INFO  [SettingsFactory] Statistics: disabled

    13:25:55,128 INFO  [SettingsFactory] Deleted entity synthetic identifier rollbac

    k: disabled

    13:25:55,128 INFO  [SettingsFactory] Default entity-mode: pojo

    13:25:55,128 INFO  [SettingsFactory] Named query checking : enabled

    13:25:55,128 INFO  [SessionFactoryImpl] building session factory

    13:25:55,128 INFO  [SessionFactoryObjectFactory] Not binding factory to JNDI, no

    JNDI name configured

    13:25:55,128 WARN  [util] joined to DB

     

    *******************************************************************************************************

     

    A special thanks to Phani for all the help

     

    Regards,

    Francesco

  • 9. Re: JBOSS JNDI ERROR: Could not find datasource: ccib0Data
    Phani Reddy V Newbie

    You're welcome.Nice to hear it's working at the end.