i am working on a project using Hibernate 3.3.SP1 + Spring 1.2.6 on Weblogic 10.3.1 with Oracle DB 10g. Recently, we migrated Hibernate from v3.0.5 to 3.3.SP1.A strange error occurs (that did not happen before) when trying to insert LOB (BLOB or CLOB). I get the following error :
189202 [[ACTIVE] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)']
WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
189202 [[ACTIVE] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)']
ERROR org.hibernate.util.JDBCExceptionReporter - Pool connect failed :
weblogic.common.ResourceException:
my.wls.datasource(dtJndiName): 0:
Could not connect to 'oracle.jdbc.OracleDriver'.
The returned message is:
ORA-01017: invalid username/password; logon denied
It is likely that the login or password is not valid.
It is also possible that something else is invalid in
the configuration or that the database is not available.
After that, the datasource gets "corrupted" and after 10 consecutive false connection attempts Oracle locks the account.
I must notice that the application has absolutely no code for connecting to the database, other than the pre-configured datasource in Weblogic. Since the application works just fine until a LOB is inserted in the DB it is safe to assume that the datasource is properly configured.
A sample mapping (I cannot post the exact hbm.xml) is :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="my.model.persist">
<class name="LobTable" table="LOB_TABLE">
<id name="id" type="long" column="RS_ID" unsaved-value="null" length="10">
<generator class="native"></generator>
</id>
<property name="blob1" type="org.springframework.orm.hibernate3.support.BlobByteArrayType" column="BLOB1"></property>
<property name="blob2" type="org.springframework.orm.hibernate3.support.BlobByteArrayType" column="BLOB2"></property>
</class>
</hibernate-mapping>
The code tries to persist some LOB values in three tables. The error appears when trying to save to the first. If I remove the code for saving to the first, the error appears on the second and so on.
The only solution I have found up to now, is to set the Initial Capacity of the datasource connections to the max connections (15). In this case, the system seems stable. However this solution is not acceptable since we do not understand the nature of the problem.
I have tried this in four different environments (Weblogic + Oracle). The error does not appear always with the same frequency (in some systems it works for a while before failing to insert a LOB). Also, while debugging I noticed that if I increase the log output (I simply added more debug messages in log4j) the error stop appearing. This made me think it could be a sync problem between WLS and DB.
Do you have any ideas? Please let me know if you need more clarifications.
The result after enabling Hibernate query output and changing the hbm.xml to have LOBs as the last fields declared is still the same error:
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into LOB_TABLE_1 (field20, field21, field22, field23, field24, field25, field26, field27, field28, field29, field30, field31, LOB_FIELD_3, LOB_FIELD_4, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into LOB_TABLE_2 (field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, field11, field12, field13, field14, field15, field16, LOB_FIELD_1, LOB_FIELD_2, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
105039 [[ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
105039 [[ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR org.hibernate.util.JDBCExceptionReporter - Pool connect failed : weblogic.common.ResourceException:
my.wls.datasource(dtJndiName): 0:
Could not connect to 'oracle.jdbc.OracleDriver'.
The returned message is: ORA-01017: invalid username/password; logon denied
It is likely that the login or password is not valid.
It is also possible that something else is invalid in
the configuration or that the database is not available.