Fixes are available
7.0.0.25: WebSphere Application Server V7.0 Fix Pack 25
8.5.0.1: WebSphere Application Server V8.5 Fix Pack 1
8.0.0.5: WebSphere Application Server V8.0 Fix Pack 5
7.0.0.27: WebSphere Application Server V7.0 Fix Pack 27
8.5.0.2: WebSphere Application Server V8.5 Fix Pack 2
8.0.0.6: WebSphere Application Server V8.0 Fix Pack 6
7.0.0.29: WebSphere Application Server V7.0 Fix Pack 29
8.0.0.7: WebSphere Application Server V8.0 Fix Pack 7
8.0.0.8: WebSphere Application Server V8.0 Fix Pack 8
7.0.0.31: WebSphere Application Server V7.0 Fix Pack 31
7.0.0.27: Java SDK 1.6 SR13 FP2 Cumulative Fix for WebSphere Application Server
7.0.0.33: WebSphere Application Server V7.0 Fix Pack 33
8.0.0.9: WebSphere Application Server V8.0 Fix Pack 9
7.0.0.35: WebSphere Application Server V7.0 Fix Pack 35
8.0.0.10: WebSphere Application Server V8.0 Fix Pack 10
7.0.0.37: WebSphere Application Server V7.0 Fix Pack 37
8.0.0.11: WebSphere Application Server V8.0 Fix Pack 11
7.0.0.39: WebSphere Application Server V7.0 Fix Pack 39
8.0.0.12: WebSphere Application Server V8.0 Fix Pack 12
7.0.0.41: WebSphere Application Server V7.0 Fix Pack 41
8.0.0.13: WebSphere Application Server V8.0 Fix Pack 13
7.0.0.43: WebSphere Application Server V7.0 Fix Pack 43
8.0.0.14: WebSphere Application Server V8.0 Fix Pack 14
7.0.0.45: WebSphere Application Server V7.0 Fix Pack 45
8.0.0.15: WebSphere Application Server V8.0 Fix Pack 15
7.0.0.25: Java SDK 1.6 SR11 Cumulative Fix for WebSphere Application Server
7.0.0.27: Java SDK 1.6 SR12 Cumulative Fix for WebSphere Application Server
7.0.0.29: Java SDK 1.6 SR13 FP2 Cumulative Fix for WebSphere Application Server
7.0.0.45: Java SDK 1.6 SR16 FP60 Cumulative Fix for WebSphere Application Server
7.0.0.31: Java SDK 1.6 SR15 Cumulative Fix for WebSphere Application Server
7.0.0.35: Java SDK 1.6 SR16 FP1 Cumulative Fix for WebSphere Application Server
7.0.0.37: Java SDK 1.6 SR16 FP3 Cumulative Fix for WebSphere Application Server
7.0.0.39: Java SDK 1.6 SR16 FP7 Cumulative Fix for WebSphere Application Server
7.0.0.41: Java SDK 1.6 SR16 FP20 Cumulative Fix for WebSphere Application Server
7.0.0.43: Java SDK 1.6 SR16 FP41 Cumulative Fix for WebSphere Application Server
APAR status
Closed as program error.
Error description
The following exception occurs when persisting a stream contained in a JPA entity: Caused by: <openjpa-1.2.3-SNAPSHOT-r422266:1152904 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: String or buffer length not valid. FailedObject: prepstmnt 1608671202 UPDATE PMYPJRK SET lastModificationDate = ?, fileLength = ?, fileName = ?, inputStream = ? WHERE id = ? [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedS tatement] ......... Caused by: java.sql.SQLException: String or buffer length not valid. at com.ibm.as400.access.JDError.throwSQLException(JDError.java:415) at com.ibm.as400.access.AS400JDBCPreparedStatement.setBinaryStream( AS400JDBCPreparedStatement.java:2098) at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setBinaryStrea m(WSJdbcPreparedStatement.java:1444) at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.setBinar yStream(DelegatingPreparedStatement.java:340) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingCo nnection$LoggingPreparedStatement.setBinaryStream(LoggingConnect ionDecorator.java:1104) at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.setBinar yStream(DelegatingPreparedStatement.java:340) at org.apache.openjpa.jdbc.sql.DBDictionary.setBinaryStream(DBDicti onary.java:875) at org.apache.openjpa.jdbc.sql.DBDictionary.setTyped(DBDictionary.j ava:1244) at org.apache.openjpa.jdbc.sql.RowImpl.flush(RowImpl.java:890) at org.apache.openjpa.jdbc.sql.RowImpl.flush(RowImpl.java:850) at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerI mpl.flushSingleRow(BatchingPreparedStatementManagerImpl.java:249 ) at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerI mpl.flushBatch(BatchingPreparedStatementManagerImpl.java:157) ... 138 more
Local fix
candidate to be fix in next release
Problem summary
**************************************************************** * USERS AFFECTED: All users of IBM WebSphere Application * * Server V7.0, V8.0, and V8.5 who make * * use of InputSteams (streams) in a JPA * * entity. * **************************************************************** * PROBLEM DESCRIPTION: 'PersistenceException: String or * * buffer length not valid.' occurs when * * persisting a JPA entity. * **************************************************************** * RECOMMENDATION: * **************************************************************** The exception occurs because the particular JDBC driver checks the value of the 'length' variable passed to the 'PreparedStatement.setBinaryStream' method: setBinaryStream(int parameterIndex, InputStream x, int length) The 'length' parameter of method 'setBinaryStream' is supposed to be the length of the InputStream parameter. OpenJPA code is passing a value of '-1' for the length as the length is not known. Some JDBC drivers allow this value. Technically speaking the javadoc for 'PreparedStatement.setBinaryStream' doesn't state that a negative value is not acceptable or what should happen when a negative length is passed to 'setBinaryStream' (which is likely why some drivers allow a negative value and others do not). On the other hand, it doesn't make sense for a length of an InputStream to be negative. Given this, and the fact that OpenJPA is not aware of the length of the stream, this fix provides a solution which uses a JDBC 4.0 version of 'setBinaryStream' which doesn't take a length. The fix will of course require JDK 6 and a JDBC 4.0 driver runtime. The code for this fix is also gated by a system property.
Problem conclusion
With this fix, code has been added to allow OpenJPA code to use a 'PreparedStatement.setBinaryStream' which doesn't not take a length as an input parameter. The code for this fix is enbled by a custom property. The custom propery can be set as a JVM system property, or can be defined in the user's persistence.xml file as follows: <property name="openjpa.jdbc.DBDictionary" value="useJDBC4SetBinaryStream=true"/> The fix for this APAR is currently targeted for inclusion in Service Levels (Fix Packs) 7.0.0.25, 8.0.0.5, and 8.5.0.1 of WebSphere Application Server versions 7.0.0, 8.0.0, and 8.5.0. Please refer to the Recommended Updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
Temporary fix
Comments
APAR Information
APAR number
PM51309
Reported component name
WEBS APP SERV N
Reported component ID
5724H8800
Reported release
700
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-11-01
Closed date
2012-05-17
Last modified date
2012-07-17
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
PM59470
Fix information
Fixed component name
WEBS APP SERV N
Fixed component ID
5724H8800
Applicable component levels
R61A PSY
UP
R61H PSY
UP
R61I PSY
UP
R61P PSY
UP
R61S PSY
UP
R61W PSY
UP
R61Z PSY
UP
R700 PSY
UP
R800 PSY
UP
R850 PSY
UP
Document Information
Modified date:
28 October 2021