java.lang.NegativeArraySizeException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • While trying to upload a huge file, the following exception is fired: {noformat} 2010-03-26 11:36:43,050 [http://wikilinux.gidi.it:8081/xwiki/bin/upload/Prova/Pagina1] WARN web.UploadAction - Saving uploaded file failed com.xpn.xwiki.XWikiException: Error number 3232 in 3: Exception while saving attachment <huge_file_name> of document Prova.Pagina1 Wrapped Exception: Error number 3004 in 3: Exception while manipulating the archive for file <huge_file_name> Wrapped Exception: null at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.saveAttachmentContent(XWikiHibernateAttachmentStore.java:122) at com.xpn.xwiki.doc.XWikiDocument.saveAttachmentContent(XWikiDocument.java:3726) at com.xpn.xwiki.web.UploadAction.uploadAttachment(UploadAction.java:189) at com.xpn.xwiki.web.UploadAction.action(UploadAction.java:106) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:213) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:118) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) 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.valves.RequestFilterValve.process(RequestFilterValve.java:276) at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81) 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:873) 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:619) Wrapped Exception: com.xpn.xwiki.XWikiException: Error number 3004 in 3: Exception while manipulating the archive for file ibmlotusnotes-8.5.i586.rpm Wrapped Exception: null at com.xpn.xwiki.doc.XWikiAttachmentArchive.updateArchive(XWikiAttachmentArchive.java:139) at com.xpn.xwiki.doc.XWikiAttachment.updateContentArchive(XWikiAttachment.java:548) at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.saveAttachmentContent(XWikiHibernateAttachmentStore.java:79) at com.xpn.xwiki.doc.XWikiDocument.saveAttachmentContent(XWikiDocument.java:3726) at com.xpn.xwiki.web.UploadAction.uploadAttachment(UploadAction.java:189) at com.xpn.xwiki.web.UploadAction.action(UploadAction.java:106) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:213) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:118) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) 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.valves.RequestFilterValve.process(RequestFilterValve.java:276) at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81) 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:873) 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:619) Wrapped Exception: java.lang.NegativeArraySizeException at org.apache.commons.codec.binary.Base64.encodeBase64(Base64.java:258) at org.apache.commons.codec.binary.Base64.encodeBase64(Base64.java:178) at com.xpn.xwiki.doc.XWikiAttachment.toXML(XWikiAttachment.java:351) at com.xpn.xwiki.doc.XWikiAttachment.toStringXML(XWikiAttachment.java:290) at com.xpn.xwiki.doc.XWikiAttachmentArchive.updateArchive(XWikiAttachmentArchive.java:129) at com.xpn.xwiki.doc.XWikiAttachment.updateContentArchive(XWikiAttachment.java:548) at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.saveAttachmentContent(XWikiHibernateAttachmentStore.java:79) at com.xpn.xwiki.doc.XWikiDocument.saveAttachmentContent(XWikiDocument.java:3726) at com.xpn.xwiki.web.UploadAction.uploadAttachment(UploadAction.java:189) at com.xpn.xwiki.web.UploadAction.action(UploadAction.java:106) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:213) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:118) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) 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.valves.RequestFilterValve.process(RequestFilterValve.java:276) at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81) 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:873) 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:619) {noformat} The file size is about 330MB. The strange behaviour is the following: - the page refreshes showing the attachment with the right size, and if i try to download it just after the uploading phase, the attachment seems to be present in the database, (but it's not!!!) so i can download it without any problem. - if i restart the server or wait a lot of time, the file isn't available anymore: when i click to download it the page shows the message: "Error This template does not exist" - in the page attachments section, now the file is shown with size 0. - in tables, the related row is present in XWIKIATTACHMENT but no rows for XWIKIATTACHMENT_ARCHIVE and XWIKIATTACHMENT_CONTENT. note that files up to 50/60 MB can be uploaded without problems. Thanks claudio
    via by Claudio Coreggioli,
  • We're getting this exception when we're trying to send a large (>200Mb) message to a subsequent action. Full stacktrace follows: ERROR [org.jboss.soa.esb.client.ServiceInvoker] (pool-58-thread-1) Unexpected throwable during attempted message delivery using Courier for EPR [JMSEpr ... ]]. java.lang.NegativeArraySizeException at org.apache.commons.codec.binary.Base64.encodeBase64(Base64.java:258) at org.apache.commons.codec.binary.Base64.encodeBase64(Base64.java:178) at org.jboss.internal.soa.esb.util.Encoding.encodeBytes(Encoding.java:43) at org.jboss.internal.soa.esb.util.Encoding.encodeObject(Encoding.java:62) at org.jboss.internal.soa.esb.message.format.xml.marshal.SerializedMarshalUnmarshalPlugin.marshal(SerializedMarshalUnmarshalPlugin.java:83) at org.jboss.internal.soa.esb.message.format.xml.marshal.MarshalUnmarshalManager.marshal(MarshalUnmarshalManager.java:145) at org.jboss.internal.soa.esb.message.format.xml.BodyImpl.writeChildContent(BodyImpl.java:146) at org.jboss.internal.soa.esb.util.stax.ElementContent.writeContent(ElementContent.java:41) at org.jboss.internal.soa.esb.util.stax.StreamHelper.writeElement(StreamHelper.java:125) at org.jboss.internal.soa.esb.message.format.xml.MessageImpl.writeChildContent(MessageImpl.java:236) at org.jboss.internal.soa.esb.util.stax.ElementContent.writeContent(ElementContent.java:41) at org.jboss.soa.esb.util.Util.serialize(Util.java:188) at org.jboss.internal.soa.esb.couriers.JmsCourier.internalDeliver(JmsCourier.java:224) at org.jboss.internal.soa.esb.couriers.JmsCourier.deliver(JmsCourier.java:187) at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.deliver(TwoWayCourierImpl.java:189) at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.attemptDelivery(ServiceInvoker.java:702) at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.access$200(ServiceInvoker.java:604) at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:392) at org.jboss.soa.esb.client.ServiceInvoker.deliverAsync(ServiceInvoker.java:265) An upgrade of the commons-codec libraries from the currently bundled version 1.3 includes a fix for CODEC-61 [1]. This would allow to Base64 encode input data up to 2GB, instead of the ~250MB limitation in common codecs version 1.3. [1] https://issues.apache.org/jira/browse/CODEC-61
    via by Martin Weiler,
    • java.lang.NegativeArraySizeException at org.apache.commons.codec.binary.Base64.encodeBase64(Base64.java:258) at org.apache.commons.codec.binary.Base64.encodeBase64(Base64.java:178) at com.xpn.xwiki.doc.XWikiAttachment.toXML(XWikiAttachment.java:351) at com.xpn.xwiki.doc.XWikiAttachment.toStringXML(XWikiAttachment.java:290) at com.xpn.xwiki.doc.XWikiAttachmentArchive.updateArchive(XWikiAttachmentArchive.java:129) at com.xpn.xwiki.doc.XWikiAttachment.updateContentArchive(XWikiAttachment.java:548) at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.saveAttachmentContent(XWikiHibernateAttachmentStore.java:79) at com.xpn.xwiki.doc.XWikiDocument.saveAttachmentContent(XWikiDocument.java:3726) at com.xpn.xwiki.web.UploadAction.uploadAttachment(UploadAction.java:189) at com.xpn.xwiki.web.UploadAction.action(UploadAction.java:106) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:213) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:118) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) 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.valves.RequestFilterValve.process(RequestFilterValve.java:276) at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81) 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:873) 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:619)
    No Bugmate found.