The Hibernate program appears nullpointerexceptio when a transaction is committed using the was connection pool

Source: Internet
Author: User
Tags commit tomcat oracle database websphere application server

The hibernate application is deployed to WebSphere Application Server 5.1, using the connection pool of was, after the program has handled the more Session.save (object) operations, executing the submit thing The following exception occurred while Trans.commit ()

java.lang.NullPointerException
at Oracle.jdbc.dbaccess.DBData.clearItem (dbdata.java:431)
at Oracle.jdbc.dbaccess.DBDataSetImpl.clearItem (dbdatasetimpl.java:3528)
at Oracle.jdbc.driver.OraclePreparedStatement.clearParameters (oraclepreparedstatement.java:3401)
at Com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.resetStatement (wsjdbcconnection.java:1719)
at Com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement (wsjdbcconnection.java:1415)
at Com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement (wsjdbcconnection.java:1381)
at Org.hibernate.jdbc.AbstractBatcher.getPreparedStatement (abstractbatcher.java:497)
at Org.hibernate.jdbc.AbstractBatcher.prepareStatement (abstractbatcher.java:94)
at Org.hibernate.jdbc.AbstractBatcher.prepareStatement (abstractbatcher.java:87)
at Org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement (abstractbatcher.java:218)
at Org.hibernate.persister.entity.AbstractEntityPersister.insert (abstractentitypersister.java:2220)
at Org.hibernate.persister.entity.AbstractEntityPersister.insert (Abstractentitypersister.java : 2656)
at Org.hibernate.action.EntityInsertAction.execute (entityinsertaction.java:52)
at Org.hibernate.engine.ActionQueue.execute (actionqueue.java:248)
at Org.hibernate.engine.ActionQueue.executeActions (actionqueue.java:232)
at Org.hibernate.engine.ActionQueue.executeActions (actionqueue.java:139)
at Org.hibernate.event.def.AbstractFlushingEventListener.performExecutions (abstractflushingeventlistener.java:28)
at Org.hibernate.event.def.DefaultFlushEventListener.onFlush (defaultflusheventlistener.java:27)
at Org.hibernate.impl.SessionImpl.flush (sessionimpl.java:1000)
at Org.hibernate.impl.SessionImpl.managedFlush ( sessionimpl.java:338)
at Org.hibernate.transaction.JDBCTransaction.commit (jdbctransaction.java:106)

Because the development of the Tomcat application server, the configuration of the Tomcat connection pool, so run in the local operation will not have such a mistake, the cost of a good time also failed to locate, the error is always affected by java.lang.NullPointerException, Look at the code over and over again, which variable is not initialized?

Self tortured for a while, but when the time to go online Google (in fact, it should have done so, also because of the suspicion of the problem in the code), only to find that others have encountered similar problems, Hibernate's official forum also has such a discussion.

http://www.google.cn/search?complete=1&hl=zh-CN&newwindow=1&q=+ Oracle.jdbc.dbaccess.dbdatasetimpl.clearitem&meta=

On the internet there is a problem that is driven, there is said to be Hibernate database dialect problems, but also said that the maximum cache statements

1. Delete Object Error http://forum.hibernate.org/viewtopic.php?t=934050

The mention of the exchange of Oracle database driver, someone tried to replace Ojdcbc14.jar solution, and finally someone said set C3P0 hibernate.c3p0.max_statements for 0 on the line

2. NullPointerException on Transaction.commit () http://forum.hibernate.org/viewtopic.php?t=973414&sid= 04bbd1a8951b3051c52e374a7888d35e

The reply said is to replace the org.hibernate.dialect.OracleDialect to Org.hibernate.dialect.Oracle9Dialect, but someone to take this approach ineffective, not to mention I use or 8.0.5 The oracle,i are not taken.

3. The question of DataSource on was 6 http://www.itpub.net/743938.html

This post is directly the owner of the name of the data Source command cache can only be set to 0, once more than 0 reported above errors, it seems that this is a more definitive solution. So I set the statement cache size for my connection pool to 0 under the console of was, and then restarted was, and the problem was resolved. It is not known how the Statement will affect performance, you need to know more about it.

I have also tried to change the database-driven approach to replace the original driver in my local available Class12.jar package, no effect. Again change Ojdbc.jar bag try, still useless.

Summary of the above error resolution, set was data source property Command cache (that is, the statement cache size) of 0, if the use of other connection pool products, to set the corresponding max_statements to 0, attribute name specific reference to the corresponding connection pool products.

Note that the data source settings that were changed by was will need to be restarted by.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.