2013年11月19日星期二

A very strange question , queryForInt if the dynamic parameter passing on the error , the direct fight to the sql no problem

No problem wrote :
JdbcTemplate jt = new JdbcTemplate (dataSource);
String sql = "select count (1) from t_sale_type where sale_type = '" + saleType + "'";
return jt.queryForInt (sql);

this written question:
JdbcTemplate jt = new JdbcTemplate (dataSource);
String sql = "select count (1) from t_sale_type where sale_type =?";
return jt.queryForInt (sql, new Object [] {saleType});


error message :


java.lang.NullPointerException
at weblogic.utils.wrapper.WrapperFactory.getCachedWrapperClass (WrapperFactory.java: 52)
at weblogic.utils.wrapper.WrapperFactory.getWrapperClass (WrapperFactory.java: 242)
at weblogic.utils.wrapper.WrapperFactory.getWrapperClass (WrapperFactory.java: 230)
at weblogic.utils.wrapper.WrapperFactory.createWrapper (WrapperFactory.java: 219)
at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper (JDBCWrapperFactory.java: 184)
at weblogic.jdbc.rmi.internal.PreparedStatementStub.readResolve (PreparedStatementStub.java: 46)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)
at java.lang.reflect.Method.invoke (Unknown Source)
at java.io.ObjectStreamClass.invokeReadResolve (Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject (Unknown Source)
at java.io.ObjectInputStream.readObject0 (Unknown Source)
at java.io.ObjectInputStream.readObject (Unknown Source)
at weblogic.utils.io.ChunkedObjectInputStream.readObject (ChunkedObjectInputStream.java: 195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject (MsgAbbrevInputStream.java: 565)
at weblogic.utils.io.ChunkedObjectInputStream.readObject (ChunkedObjectInputStream.java: 191)
at weblogic.rmi.internal.ObjectIO.readObject (ObjectIO.java: 62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn (ResponseImpl.java: 217)
at weblogic.rmi.internal.BasicRemoteRef.invoke (BasicRemoteRef.java: 224)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_1030_WLStub.prepareStatement (Unknown Source)
at weblogic.jdbc.rmi.SerialConnection.prepareStatement (SerialConnection.java: 212)
at org.springframework.jdbc.core.JdbcTemplate $ SimplePreparedStatementCreator.createPreparedStatement (JdbcTemplate.java: 1203)
at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java: 532)
at org.springframework.jdbc.core.JdbcTemplate.query (JdbcTemplate.java: 588)
------ Solution ---------------- ----------------------------
Thank you to share . I put the original test came to prepare the same problems encountered searched friends refer to this post :
------------------------------------------ dividing line - ----------------------------------------------
found today : spring jdbctemplate case as long as the binding parameters on the incorrect implementation of sql statement

weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection

_oracle_jdbc_driver_T4CConnection_1030_WLStub.

prepareStatement (Unknown Source)

No problem wrote :
JdbcTemplate jt = new JdbcTemplate (dataSource);
String sql = "select count (1) from t_sale_type where sale_type = '" + saleType + "'";
return jt.queryForInt (sql);

this written question:
JdbcTemplate jt = new JdbcTemplate (dataSource);
String sql = "select count (1) from t_sale_type where sale_type =?";
return jt.queryForInt (sql, new Object [] {saleType});
error message :
java.lang.NullPointerException
at weblogic.utils.wrapper.WrapperFactory.getCachedWrapperClass (WrapperFactory.java: 52)
at weblogic.utils.wrapper.WrapperFactory.getWrapperClass (WrapperFactory.java: 242)
at weblogic.utils.wrapper.WrapperFactory.getWrapperClass (WrapperFactory.java: 230)
at weblogic.utils.wrapper.WrapperFactory.createWrapper (WrapperFactory.java: 219)
at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper (JDBCWrapperFactory.java: 184)
at weblogic.jdbc.rmi.internal.PreparedStatementStub.readResolve (PreparedStatementStub.java: 46)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)
at java.lang.reflect.Method.invoke (Unknown Source)
at java.io.ObjectStreamClass.invokeReadResolve (Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject (Unknown Source)
at java.io.ObjectInputStream.readObject0 (Unknown Source)
at java.io.ObjectInputStream.readObject (Unknown Source)
at weblogic.utils.io.ChunkedObjectInputStream.readObject (ChunkedObjectInputStream.java: 195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject (MsgAbbrevInputStream.java: 565)
at weblogic.utils.io.ChunkedObjectInputStream.readObject (ChunkedObjectInputStream.java: 191)
at weblogic.rmi.internal.ObjectIO.readObject (ObjectIO.java: 62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn (ResponseImpl.java: 217)
at weblogic.rmi.internal.BasicRemoteRef.invoke (BasicRemoteRef.java: 224)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_

T4CConnection_1030_WLStub.prepareStatement (Unknown Source)
at weblogic.jdbc.rmi.SerialConnection.prepareStatement (SerialConnection.java: 212)
at org.springframework.jdbc.core.JdbcTemplate $ SimplePreparedStatementCreator.createPreparedStatement (JdbcTemplate.java: 1203)
at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java: 532)
at org.springframework.jdbc.core.JdbcTemplate.query (JdbcTemplate.java: 588)

Solution: The tests found that the current environment is weblogic version cited jar package version mismatch caused

what specifically jar package, it is not clear , just know , will replace 10.0 weblogic no current issue

And if weblogic version 10.3 then there is the problem mentioned above
------------------------------------------ dividing line - ----------------------------------------------
- ----- For reference only ---------------------------------------
Jia, online answers
------ For reference only -------------------------------- -------
alas, my own roof , the problem has been resolved, because version of the problem , as detailed


http://www.meirirm.com/meirirm/index.php/385.html


------ For reference only ---------------------------------- -----
problems have been solved , because version of the problem , as detailed in < / a>



没有评论:

发表评论