You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by hbf <fi...@inf.ethz.ch> on 2009/05/17 22:14:21 UTC

Long text/CLOB – SQLException: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'

Dear list,

I need to store a long text in a field of my entity and have run into a
problem: When my app was under load it threw the exception pasted below. I
use the following mapping, which uses CLOB as indicated at
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501 because
Derby's TEXT only stores 32K.

@Entity()
public class Profile implements Identifiable, Serializable
{
  @Id
  @GeneratedValue
  @Column(name = "id")
  private int id;

  @Column(nullable = false)
  private String profileName;

  @Column(nullable = true)
  private String profileEntityUri;

  @Column(nullable = false)
  private Boolean isIndividual;

  @CollectionOfElements(targetElement = String.class)
  @JoinTable(joinColumns = @JoinColumn(name = "id"))
  @IndexColumn(name = "position", base = 1)
  @Column(name = "fNames", nullable = false)
  private List<String> knownFirstNames;

  @CollectionOfElements(targetElement = String.class)
  @JoinTable(joinColumns = @JoinColumn(name = "id"))
  @IndexColumn(name = "position", base = 1)
  @Column(name = "mNames", nullable = false)
  private List<String> knownMiddleNames;

  @CollectionOfElements(targetElement = String.class)
  @JoinTable(joinColumns = @JoinColumn(name = "id"))
  @IndexColumn(name = "position", base = 1)
  @Column(name = "lNames", nullable = false)
  private List<String> knownLastNames;

  @CollectionOfElements(targetElement = String.class)
  @JoinTable(joinColumns = @JoinColumn(name = "id"))
  @IndexColumn(name = "position", base = 1)
  @Column(name = "names", nullable = false)
  private List<String> knownFullNames;

  @CollectionOfElements(targetElement = String.class)
  @JoinTable(joinColumns = @JoinColumn(name = "id"))
  @IndexColumn(name = "position", base = 1)
  @Column(name = "urls", nullable = false)
  private List<String> urls;

  @Embedded
  private SummaryProgression progression;

  @Column(nullable = false, columnDefinition = "CLOB NOT NULL")
  private String log;

  ...
}

>From the exception (see SQLChar.getString below) it seems that this is
related to the 'log' property with CLOB NOT NULL. 

Does anybody have an idea how to solve this or what exactly the problem is?

I am using Derby 10.4.2.0 and Hibernate 3.2.6.ga.
Many thanks,
Kaspar

--

WARN  - JDBCExceptionReporter      - SQL Error: 0, SQLState: XJ001
ERROR - JDBCExceptionReporter      - Java exception: '-1:
java.lang.ArrayIndexOutOfBoundsException'.
...
INFO  - SQLErrorCodesFactory       - SQLErrorCodes loaded: [DB2, Derby, H2,
HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
ERROR - RequestCycle               - Error attaching this container for
rendering: [MarkupContainer [Component id = profiles-table]]
org.apache.wicket.WicketRuntimeException: Error attaching this container for
rendering: [MarkupContainer [Component id = profiles-table]]
	at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1732)
	at org.apache.wicket.Component.onBeforeRender(Component.java:3884)
	at org.apache.wicket.Component.internalBeforeRender(Component.java:1063)
	at org.apache.wicket.Component.beforeRender(Component.java:1097)
	at org.apache.wicket.Component.prepareForRender(Component.java:2242)
	at org.apache.wicket.Component.prepareForRender(Component.java:2269)
	at
org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:770)
	at
org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:667)
	at
org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:579)
	at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
	at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1245)
	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1316)
	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1415)
	at org.apache.wicket.RequestCycle.request(RequestCycle.java:543)
	at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:456)
	at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:289)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:613)
Caused by: org.springframework.jdbc.UncategorizedSQLException: Hibernate
operation: could not execute query; uncategorized SQLException for SQL [/*
criteria query */ select this_.id as id0_0_, this_.isIndividual as
isIndivi2_0_0_, this_.log as log0_0_, this_.profileEntityUri as
profileE4_0_0_, this_.profileName as profileN5_0_0_, this_.doneState as
doneState0_0_, this_.progress as progress0_0_, this_.state as state0_0_,
this_.status as status0_0_, this_.summary as summary0_0_ from Profile
this_]; SQL state [XJ001]; error code [0]; Java exception: '-1:
java.lang.ArrayIndexOutOfBoundsException'.; nested exception is
java.sql.SQLException: Java exception: '-1:
java.lang.ArrayIndexOutOfBoundsException'.
	at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
	at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
	at
org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
	at
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
	at
org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
	at
org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
	at
org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1055)
	at
org.myorg.util.dao.HibernateSimpleDao.executeQueryWithPagination(HibernateSimpleDao.java:95)
	at
org.myorg.util.dao.HibernateSimpleDao.findAsList(HibernateSimpleDao.java:71)
	at org.myorg.util.dao.HibernateSimpleDao.find(HibernateSimpleDao.java:64)
	at
org.myorg.myproject.profile.ProfileServiceImpl.findProfiles(ProfileServiceImpl.java:150)
	at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
	at org.apache.wicket.proxy.$Proxy29.findProfiles(Unknown Source)
	at
org.myorg.myproject.ui.web.pages.ProfilesPage$ProfilesProvider.iterator(ProfilesPage.java:300)
	at
org.apache.wicket.markup.repeater.data.DataViewBase$ModelIterator.<init>(DataViewBase.java:106)
	at
org.apache.wicket.markup.repeater.data.DataViewBase.getItemModels(DataViewBase.java:76)
	at
org.apache.wicket.markup.repeater.AbstractPageableView.getItemModels(AbstractPageableView.java:102)
	at
org.apache.wicket.markup.repeater.RefreshingView.onPopulate(RefreshingView.java:94)
	at
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131)
	at
org.apache.wicket.markup.repeater.AbstractPageableView.onBeforeRender(AbstractPageableView.java:116)
	at org.apache.wicket.Component.internalBeforeRender(Component.java:1063)
	at org.apache.wicket.Component.beforeRender(Component.java:1097)
	at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1720)
	... 33 more
Caused by: java.sql.SQLException: Java exception: '-1:
java.lang.ArrayIndexOutOfBoundsException'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
	at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedResultSet.noStateChangeException(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedResultSet.getString(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedResultSet.getString(Unknown Source)
	at
com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
	at org.hibernate.type.StringType.get(StringType.java:18)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
	at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
	at
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
	at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
	at org.hibernate.loader.Loader.getRow(Loader.java:1206)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
	at org.hibernate.loader.Loader.doQuery(Loader.java:701)
	at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
	at org.hibernate.loader.Loader.doList(Loader.java:2220)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
	at org.hibernate.loader.Loader.list(Loader.java:2099)
	at
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
	at
org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1065)
	at
org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
	... 54 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
	at org.apache.derby.impl.store.raw.data.BasePage.getHeaderAtSlot(Unknown
Source)
	at
org.apache.derby.impl.store.raw.data.StoredPage.restorePortionLongColumn(Unknown
Source)
	at
org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(Unknown
Source)
	at
org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(Unknown
Source)
	at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:262)
	at org.apache.derby.iapi.types.SQLChar.readExternal(Unknown Source)
	at org.apache.derby.iapi.types.SQLChar.getString(Unknown Source)
	... 76 more


-- 
View this message in context: http://www.nabble.com/Long-text-CLOB-%E2%80%93%C2%A0SQLException%3A-Java-exception%3A-%27-1%3A-java.lang.ArrayIndexOutOfBoundsException%27-tp23587108p23587108.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Long text/CLOB – SQLException: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'

Posted by hbf <fi...@inf.ethz.ch>.
Hi Kristian,

I am using read uncommitted. I disabled the feature that uses this column
for the time being. Once I have time to test, I can try with other levels. 

Kaspar


Kristian Waagan-4 wrote:
> 
> hbf wrote:
>> Dear Knut,
>>
>> Thanks a lot for your quick reply. It's a known issue then.
>>   
> 
> Hello Kaspar,
> 
> Can you tell us which isolation level you are using when you see this
> error?
> I'm wondering if the bug is restricted to read uncommitted, or if it can 
> be seen with other isolation levels as well under heavier loads (or 
> higher concurrency).
> 
> 
> Thank you,
> -- 
> Kristian
>> Thanks again,
>> Kaspar
>>
>>
>> Knut Anders Hatlen wrote:
>>   
>>> hbf <fi...@inf.ethz.ch> writes:
>>>
>>>     
>>>> Dear list,
>>>>
>>>> I need to store a long text in a field of my entity and have run into a
>>>> problem: When my app was under load it threw the exception pasted
>>>> below.
>>>> I
>>>> use the following mapping, which uses CLOB as indicated at
>>>> http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
>>>> because
>>>> Derby's TEXT only stores 32K.
>>>>
>>>>       
>>> [...]
>>>
>>>     
>>>> From the exception (see SQLChar.getString below) it seems that this is
>>>> related to the 'log' property with CLOB NOT NULL. 
>>>>
>>>> Does anybody have an idea how to solve this or what exactly the problem
>>>> is?
>>>>       
>>> Hi Kaspar,
>>>
>>> I cannot answer how to solve it, but it looks like you've been hit by
>>> this bug: https://issues.apache.org/jira/browse/DERBY-3811
>>>
>>> -- 
>>> Knut Anders
>>>
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Long-text-CLOB-%E2%80%93%C2%A0SQLException%3A-Java-exception%3A-%27-1%3A-java.lang.ArrayIndexOutOfBoundsException%27-tp23587108p23593893.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Long text/CLOB – SQLException: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'

Posted by Kristian Waagan <Kr...@Sun.COM>.
hbf wrote:
> Dear Knut,
>
> Thanks a lot for your quick reply. It's a known issue then.
>   

Hello Kaspar,

Can you tell us which isolation level you are using when you see this error?
I'm wondering if the bug is restricted to read uncommitted, or if it can 
be seen with other isolation levels as well under heavier loads (or 
higher concurrency).


Thank you,
-- 
Kristian
> Thanks again,
> Kaspar
>
>
> Knut Anders Hatlen wrote:
>   
>> hbf <fi...@inf.ethz.ch> writes:
>>
>>     
>>> Dear list,
>>>
>>> I need to store a long text in a field of my entity and have run into a
>>> problem: When my app was under load it threw the exception pasted below.
>>> I
>>> use the following mapping, which uses CLOB as indicated at
>>> http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
>>> because
>>> Derby's TEXT only stores 32K.
>>>
>>>       
>> [...]
>>
>>     
>>> From the exception (see SQLChar.getString below) it seems that this is
>>> related to the 'log' property with CLOB NOT NULL. 
>>>
>>> Does anybody have an idea how to solve this or what exactly the problem
>>> is?
>>>       
>> Hi Kaspar,
>>
>> I cannot answer how to solve it, but it looks like you've been hit by
>> this bug: https://issues.apache.org/jira/browse/DERBY-3811
>>
>> -- 
>> Knut Anders
>>
>>
>>     
>
>   


Re: Long text/CLOB – SQLException: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'

Posted by hbf <fi...@inf.ethz.ch>.
Dear Knut,

Thanks a lot for your quick reply. It's a known issue then.

Thanks again,
Kaspar


Knut Anders Hatlen wrote:
> 
> hbf <fi...@inf.ethz.ch> writes:
> 
>> Dear list,
>>
>> I need to store a long text in a field of my entity and have run into a
>> problem: When my app was under load it threw the exception pasted below.
>> I
>> use the following mapping, which uses CLOB as indicated at
>> http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
>> because
>> Derby's TEXT only stores 32K.
>>
> 
> [...]
> 
>> From the exception (see SQLChar.getString below) it seems that this is
>> related to the 'log' property with CLOB NOT NULL. 
>>
>> Does anybody have an idea how to solve this or what exactly the problem
>> is?
> 
> Hi Kaspar,
> 
> I cannot answer how to solve it, but it looks like you've been hit by
> this bug: https://issues.apache.org/jira/browse/DERBY-3811
> 
> -- 
> Knut Anders
> 
> 

-- 
View this message in context: http://www.nabble.com/Long-text-CLOB-%E2%80%93%C2%A0SQLException%3A-Java-exception%3A-%27-1%3A-java.lang.ArrayIndexOutOfBoundsException%27-tp23587108p23591595.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Long text/CLOB – SQLException: Java exception: '-1: java.lang.ArrayIndexOutOfBoundsException'

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
hbf <fi...@inf.ethz.ch> writes:

> Dear list,
>
> I need to store a long text in a field of my entity and have run into a
> problem: When my app was under load it threw the exception pasted below. I
> use the following mapping, which uses CLOB as indicated at
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501 because
> Derby's TEXT only stores 32K.
>

[...]

> From the exception (see SQLChar.getString below) it seems that this is
> related to the 'log' property with CLOB NOT NULL. 
>
> Does anybody have an idea how to solve this or what exactly the problem is?

Hi Kaspar,

I cannot answer how to solve it, but it looks like you've been hit by
this bug: https://issues.apache.org/jira/browse/DERBY-3811

-- 
Knut Anders