Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Getting NegativeArraySizeException: allocArray
Getting NegativeArraySizeException: allocArray [message #387450] Tue, 05 May 2009 15:14 Go to next message
Amod M is currently offline Amod MFriend
Messages: 11
Registered: July 2009
Junior Member
Hi,

I am using EclipseLink 1.0.2 in my J2EE app. I am getting following error
randomly while accessing any page of my application. Though I am not able
to reproduce it consistently, I get it intermittently.
Can anyone please give any suggestions/feedback?
Any help is highly appreciated.

Exception [EclipseLink-7107] (Eclipse Persistence Services - 1.0.2 (Build
20081024)): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered during string decryption.
Internal Exception: java.lang.NegativeArraySizeException: allocArray
at
org.eclipse.persistence.exceptions.ValidationException.error DecryptingPassword(ValidationException.java:827)
at
org.eclipse.persistence.internal.security.JCEEncryptor.decry ptPassword(JCEEncryptor.java:102)
at
org.eclipse.persistence.sessions.DatasourceLogin.prepareProp erties(DatasourceLogin.java:324)
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDa tasource(DatasourceLogin.java:164)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.connectInternal(DatasourceAccessor.java:324)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.connectInternal(DatabaseAccessor.java:264)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.reconnect(DatasourceAccessor.java:546)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.reconnect(DatabaseAccessor.java:1372)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.incrementCallCount(DatasourceAccessor.java:300)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.basicExecuteCall(DatabaseAccessor.java:544)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.executeCall(DatabaseAccessor.java:500)
at
org.eclipse.persistence.sessions.server.ServerSession.execut eCall(ServerSession.java:522)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:204)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:190)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeSelectCall(DatasourceCallQueryMechanism.jav a:261)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.selectAllRows(DatasourceCallQueryMechanism.java:59 4)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2 506)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRows(ExpressionQueryMechanism.java:2464)
at
org.eclipse.persistence.queries.ReadAllQuery.executeObjectLe velReadQuery(ReadAllQuery.java:478)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute DatabaseQuery(ObjectLevelReadQuery.java:879)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.java:666)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:840)
at
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAll Query.java:456)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute InUnitOfWork(ObjectLevelReadQuery.java:902)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.int ernalExecuteQuery(UnitOfWorkImpl.java:2587)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1178)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1162)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1108)
Re: Getting NegativeArraySizeException: allocArray [message #387761 is a reply to message #387450] Wed, 06 May 2009 12:33 Go to previous messageGo to next message
Gordon Yorke is currently offline Gordon YorkeFriend
Messages: 78
Registered: July 2009
Member
Can you please post the full stack trace including the "cause".
--Gordon
Re: Getting NegativeArraySizeException: allocArray [message #387769 is a reply to message #387761] Fri, 08 May 2009 10:14 Go to previous messageGo to next message
Amod M is currently offline Amod MFriend
Messages: 11
Registered: July 2009
Junior Member
Hi,

This error is coming randomly at any web page of the application.i.e. its
not related to any particular DB query/functionality.
If we look at exception stack trace,(I have given full stack trace in the
end)
a. It is trying to reconnect to DataSource
b. Then it trying to decrypt password (method decryptPassword() from class
org.eclipse.persistence.internal.security.JCEEncryptor):
Here it is giving the exception. Has it do something with JCEEncryptor?


at
org.eclipse.persistence.internal.security.JCEEncryptor.decry ptPassword(JCEEncryptor.java:102)
at
org.eclipse.persistence.sessions.DatasourceLogin.prepareProp erties(DatasourceLogin.java:324)
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDa tasource(DatasourceLogin.java:164)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.connectInternal(DatasourceAccessor.java:324)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.connectInternal(DatabaseAccessor.java:264)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.reconnect(DatasourceAccessor.java:546)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.reconnect(DatabaseAccessor.java:1372)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.incrementCallCount(DatasourceAccessor.java:300)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.basicExecuteCall(DatabaseAccessor.java:544)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.executeCall(DatabaseAccessor.java:500)
at
org.eclipse.persistence.sessions.server.ServerSession.execut eCall(ServerSession.java:522)


EclipseLink site mentions:
ECLIPSELINK-07107: Error encountered during string decryption.
Cause: Error encountered during password string decryption.
Action: An exception was raised while trying to decrypt the password
string. A common reason for this exception is the usage of JDK 1.3 and
earlier versions. The EclipseLink JCE encryption mechanism requires JDK
1.4 and later (or JDK 1.3 configured with the JCE plug-in) to function
properly

Since I am using JDK1.5 (along with weblogic9), it might not be the cause.
Also I am able to execute db related functionality im all use cases.
Only sometimes this exception is coming.

Thanks a lot for the help.

Exception Description: Error encountered during string decryption.

Internal Exception: java.lang.NegativeArraySizeException: allocArray
at
org.eclipse.persistence.exceptions.ValidationException.error DecryptingPassword(ValidationException.java:827)
at
org.eclipse.persistence.internal.security.JCEEncryptor.decry ptPassword(JCEEncryptor.java:102)
at
org.eclipse.persistence.sessions.DatasourceLogin.prepareProp erties(DatasourceLogin.java:324)
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDa tasource(DatasourceLogin.java:164)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.connectInternal(DatasourceAccessor.java:324)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.connectInternal(DatabaseAccessor.java:264)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.reconnect(DatasourceAccessor.java:546)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.reconnect(DatabaseAccessor.java:1372)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.incrementCallCount(DatasourceAccessor.java:300)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.basicExecuteCall(DatabaseAccessor.java:544)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.executeCall(DatabaseAccessor.java:500)
at
org.eclipse.persistence.sessions.server.ServerSession.execut eCall(ServerSession.java:522)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:204
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:190
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeSelectCall(DatasourceCallQueryMechanism.ja
va:261)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.selectAllRows(DatasourceCallQueryMechanism.java:5
94)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRowsFromTable(ExpressionQueryMechanism.java:
2506)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRows(ExpressionQueryMechanism.java:2464)
at
org.eclipse.persistence.queries.ReadAllQuery.executeObjectLe velReadQuery(ReadAllQuery.java:478)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute DatabaseQuery(ObjectLevelReadQuery.java:879)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.java:666)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:840)
at
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAll Query.java:456)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute InUnitOfWork(ObjectLevelReadQuery.java:902)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.int ernalExecuteQuery(UnitOfWorkImpl.java:2587)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1178)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1162)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1108)
Re: Getting NegativeArraySizeException: allocArray [message #387772 is a reply to message #387769] Fri, 08 May 2009 16:04 Go to previous messageGo to next message
Gordon Yorke is currently offline Gordon YorkeFriend
Messages: 78
Registered: July 2009
Member
There should be a "caused by" at the end of the EclipseLink stacktrace.
Have you posted all of the lines of the stacktrace?

Do you have any Session Customizers? Can you post your persistence.xml
file?
--Gordon
Re: Getting NegativeArraySizeException: allocArray [message #387773 is a reply to message #387772] Fri, 08 May 2009 18:30 Go to previous messageGo to next message
Bruno Felaco is currently offline Bruno FelacoFriend
Messages: 1
Registered: July 2009
Junior Member
Hi,

I'm a colleague of Amod. Yes, we do have a session customizer. This is
legacy code, and we're not using the standard JPA configuration. The only
thing I can think of that might be relevant here is the code we have for
determining the DataSourcePlatform for us:

Platform datasourcePlatform =
session.getDatasourceLogin().getDatasourcePlatform();
DatabasePlatform newPlatform;
if (DBUtils.isMsSqlConnection()) {
// Use customized SQLServerPlatform to resolve Unicode issues.
newPlatform = new SQLServerPlatform();
} else if (DBUtils.isOracleConnection()) {
// Use the Oracle10Platform which is currently identical to
the Oracle9Platform.
// This is required to handle DATE fields properly.
// We no longer support Oracle8.
newPlatform = new Oracle10Platform();

// Oracle has a limit of 4000 characters for String constants.
This enables
// SQL binding for CLOBs.
newPlatform.setUsesStringBinding(true);
newPlatform.setStringBindingSize(4000);
// Byte array binding is required for persisting BLOBs
newPlatform.setUsesByteArrayBinding(true);
} else if (DBUtils.isDB2()) {
newPlatform = new DB2Platform();
} else {
throw new
DataAccessException("err.dataAccess.unsupportedDatabase",
new Object[] {""}, null);
}

newPlatform.setDefaultSequence(datasourcePlatform.getDefault Sequence());
newPlatform.setSequences(datasourcePlatform.getSequences());

newPlatform.setTableQualifier(datasourcePlatform.getTableQua lifier());
session.getDatasourceLogin().setDatasourcePlatform(newPlatfo rm);


In any case, what I found is that even though we're using a J2EE
DataSource and no password is required, the class DataSourceLogin is still
always decrypting the empty password. The decryptPassword method in
TopLink was synchronized, but now it is not. I recommended to Amod that
we simply call DataSourceLogin.setEncryptedPassword("") to circumvent the
unnecessary decryption. Does that sound plausible? If that's not
sufficient, then I would try overriding the decryptPassword method to
check for the empty string.

- Bruno
Re: Getting NegativeArraySizeException: allocArray [message #387776 is a reply to message #387772] Sat, 09 May 2009 03:12 Go to previous message
Amod M is currently offline Amod MFriend
Messages: 11
Registered: July 2009
Junior Member
Hi,

This is the complete stack trace
Caused by: Exception [EclipseLink-7107] (Eclipse Persistence Services -
1.0.2 (Build 20081024)):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered during string decryption.
Internal Exception: java.lang.NegativeArraySizeException: allocArray
at
org.eclipse.persistence.exceptions.ValidationException.error DecryptingPassword(ValidationException.java:827)
at
org.eclipse.persistence.internal.security.JCEEncryptor.decry ptPassword(JCEEncryptor.java:102)
at
org.eclipse.persistence.sessions.DatasourceLogin.prepareProp erties(DatasourceLogin.java:324)
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDa tasource(DatasourceLogin.java:164)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.connectInternal(DatasourceAccessor.java:324)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.connectInternal(DatabaseAccessor.java:264)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.reconnect(DatasourceAccessor.java:546)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.reconnect(DatabaseAccessor.java:1372)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.incrementCallCount(DatasourceAccessor.java:300)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.basicExecuteCall(DatabaseAccessor.java:544)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.executeCall(DatabaseAccessor.java:500)
at
org.eclipse.persistence.sessions.server.ServerSession.execut eCall(ServerSession.java:522)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:204)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeCall(DatasourceCallQueryMechanism.java:190)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.executeSelectCall(DatasourceCallQueryMechanism.jav a:261)
at
org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism.selectAllRows(DatasourceCallQueryMechanism.java:59 4)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2 506)
at
org.eclipse.persistence.internal.queries.ExpressionQueryMech anism.selectAllRows(ExpressionQueryMechanism.java:2464)
at
org.eclipse.persistence.queries.ReadAllQuery.executeObjectLe velReadQuery(ReadAllQuery.java:478)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute DatabaseQuery(ObjectLevelReadQuery.java:879)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.java:666)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:840)
at
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAll Query.java:456)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute InUnitOfWork(ObjectLevelReadQuery.java:902)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.int ernalExecuteQuery(UnitOfWorkImpl.java:2587)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1178)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1162)
at
org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1108)
Caused by: java.lang.NegativeArraySizeException: allocArray
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA12275)
at javax.crypto.Cipher.doFinal(DashoA12275)
at javax.crypto.CipherInputStream.close(DashoA12275)
at
java.io.ObjectInputStream$PeekInputStream.close(ObjectInputS tream.java:2252)
at
java.io.ObjectInputStream$BlockDataInputStream.close(ObjectI nputStream.java:2587)
at java.io.ObjectInputStream.close(ObjectInputStream.java:853)
at
org.eclipse.persistence.internal.security.JCEEncryptor.decry ptPassword(JCEEncryptor.java:91)

Thanks for the help.
Previous Topic:Help using the Dynamic JPA
Next Topic:Interface annotation?
Goto Forum:
  


Current Time: Sun Apr 05 17:50:54 GMT 2020

Powered by FUDForum. Page generated in 0.01857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top