-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Error while connecting oracle
PostPosted: Tue Mar 08, 2011 8:38 am 
Newbie

Joined: Tue Mar 08, 2011 8:24 am
Posts: 2
hello,
I m trying to connect to the Oracle 9i
the Oracle is not on my machine its on some other PC in the network

the same code works for MySQL
but whenever i try to connect to oracle it gives some error specifying as :
could not obtain connection metadata

log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
797 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
844 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.1.Final
860 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
875 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
891 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
3188 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.app.spring.hbm.pojos.Customer -> CUSTOMER
3313 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.app.spring.hbm.pojos.Account -> ACCOUNT
3375 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: com.app.spring.hbm.pojos.Customer.accounts -> ACCOUNT
3422 [main] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
3500 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
3532 [main] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
8750 [main] WARN org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
java.sql.SQLException: Unsupported feature
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:689)
at oracle.jdbc.OracleDatabaseMetaData.getDatabaseMajorVersion(OracleDatabaseMetaData.java:4442)
at org.apache.commons.dbcp.DelegatingDatabaseMetaData.getDatabaseMajorVersion(DelegatingDatabaseMetaData.java:249)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:117)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2833)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2829)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1840)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:900)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.app.spring.hbm.main.CreateBankCustomerClient.main(CreateBankCustomerClient.java:24)
8828 [main] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as connection was null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exampleSessionFactory' defined in class path resource [springexample-hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:900)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.app.spring.hbm.main.CreateBankCustomerClient.main(CreateBankCustomerClient.java:24)


Here is my configuration file :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<!--
- Application context definition for Express on Hibernate.
-->
<beans>
<!-- for MySQL -->
<!--
<bean id="exampleDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/test</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>123456</value>
</property>
</bean>
-->
<!-- For Oracle -->
<bean id="exampleDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@172.25.12.241:1521:cosdb</value>
</property>
<property name="username">
<value>LOCKER</value>
</property>
<property name="password">
<value>123456</value>
</property>
</bean>

<bean id="exampleHibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</prop>
<prop key="hibernate.query.substitutions">true 'T', false 'F'</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.c3p0.minPoolSize">5</prop>
<prop key="hibernate.c3p0.maxPoolSize">20</prop>
<prop key="hibernate.c3p0.timeout">600</prop>
<prop key="hibernate.c3p0.max_statement">50</prop>
<prop key="hibernate.c3p0.testConnectionOnCheckout">false</prop>
</props>
</property>
</bean>



<!-- Hibernate SessionFactory -->
<bean id="exampleSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="exampleDataSource"/></property>
<property name="hibernateProperties">
<ref bean="exampleHibernateProperties" />
</property>
<!-- Must references all OR mapping files. -->
<property name="mappingResources">
<list>
<value>com/app/spring/hbm/pojos/Customer.hbm.xml</value>
<value>com/app/spring/hbm/pojos/Account.hbm.xml</value>
</list>
</property>
</bean>

<!-- Pass the session factory to our UserDAO -->
<bean id="customerDAOTarget" class="com.app.spring.hbm.services.impl.CustomerDAOImpl">
<property name="sessionFactory"><ref local="exampleSessionFactory"/></property>
</bean>


<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref bean="exampleSessionFactory"/></property>
</bean>

<bean id="userDAO"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="target"><ref local="customerDAOTarget"/></property>
<property name="transactionAttributes">
<props>
<prop key="addCustomer">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans>



does anyone has any inputs for the same
thank you
--
Aditya


Top
 Profile  
 
 Post subject: Re: Error while connecting oracle
PostPosted: Thu Mar 10, 2011 7:29 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
that's a warning, not an error. Hibernate attempts to log the database version, but the Oracle driver blows up when you try to, but it's not going to prevent Hibernate from working.
Make sure you specify the Dialect explicitly, as automatic detection needs this metadata which it couldn't retrieve.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Error while connecting oracle
PostPosted: Fri Mar 11, 2011 12:34 am 
Newbie

Joined: Tue Mar 08, 2011 8:24 am
Posts: 2
thanks for reply
my problems got resolved when i changed my oracle driver from classes12 to classes14
i was using old version of the driver for connection
by using latest version solves my problem


Top
 Profile  
 
 Post subject: Re: Error while connecting oracle
PostPosted: Fri Mar 11, 2011 7:45 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
hi, great.
Could you please write the exact driver version which was failing? I'd like to keep track of that.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.