2

I have configured jackrabbit 2.16.2 with mysql 8. when i try to upload a file more than 1 mb it fails. i am able to upload less than 1 mb files.

sample code used to upload.

        Sardine webdavClient = SardineFactory.begin(new String("****"), new String("****"));
        System.out.println("file name :: "+file.getName().replaceAll(" ", "_"));
        byte[] content = Files.readAllBytes(file.toPath());
        webdavClient.put(dirPath+"/"+file.getName().replaceAll(" ", "_"), content);

please find the repository.xml content below :

<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
  <param name="driver" value="com.mysql.jdbc.Driver"/>
  <param name="url" value="jdbc:mysql://127.0.0.1:3306/jackrabbit"/>
  <param name="user" value=""/>
  <param name="password" value=""/>
  <param name="schema" value="mysql"/>
  <param name="schemaObjectPrefix" value="fs_test_store"/>
</FileSystem>

<!--
    data store configuration
-->

<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
    <param name="url" value="jdbc:mysql://127.0.0.1:3306/jackrabbit"/>
    <param name="user" value=""/>
    <param name="password" value=""/>
    <param name="databaseType" value="mysql"/>
    <param name="driver" value="com.mysql.cj.jdbc.Driver"/>
    <param name="minRecordLength" value="2048"/>
    <param name="maxConnections" value="10"/>
    <param name="copyWhenReading" value="false"/>
    <param name="tablePrefix" value=""/>
    <param name="schemaObjectPrefix" value="test_"/>
</DataStore>

please find workspace configuration below

<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
  <param name="driver" value="com.mysql.jdbc.Driver"/>
  <param name="url" value="jdbc:mysql://127.0.0.1:3306/jackrabbit"/>
  <param name="user" value=""/>
  <param name="password" value=""/>
  <param name="schema" value="mysql"/>
  <param name="schemaObjectPrefix" value="fs_test_ws_"/>
</FileSystem>

<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
      <param name="driver" value="com.mysql.cj.jdbc.Driver" />
      <param name="url" value="jdbc:mysql://127.0.0.1:3306/jackrabbit"/>
      <param name="user" value="" />
      <param name="password" value="" />
      <param name="schema" value="mysql"/>
      <param name="schemaObjectPrefix" value="pm_ws_${wsp.name}_"/>
    </PersistenceManager>

I have changed mysql paramter

max_allowed_packet=100M

i am receiving the below exception

2019-02-18 16:11:01 [main] DEBUG:: http-outgoing-3 >> "[write] I/O error: Software caused connection abort: socket write error"
2019-02-18 16:11:01 [main] DEBUG:: http-outgoing-3: Close connection
2019-02-18 16:11:01 [main] DEBUG:: http-outgoing-3: Shutdown connection
2019-02-18 16:11:01 [main] DEBUG:: Connection discarded
2019-02-18 16:11:01 [main] DEBUG:: Connection released: [id: 3][route: {}->http://localhost:8080][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
2019-02-18 16:11:01 [main] DEBUG:: Cancelling request execution
Exception in thread "main" java.net.SocketException: Software caused connection abort: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
    at org.apache.http.impl.conn.LoggingOutputStream.write(LoggingOutputStream.java:74)
    at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:124)
    at org.apache.http.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:160)
    at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:113)
    at org.apache.http.entity.ByteArrayEntity.writeTo(ByteArrayEntity.java:114)
    at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:156)
    at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:160)
    at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:238)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
    at com.github.sardine.impl.SardineImpl.execute(SardineImpl.java:1043)
    at com.github.sardine.impl.SardineImpl.execute(SardineImpl.java:1012)
    at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:923)
    at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:906)
    at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:894)
    at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:828)
    at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:821)
    at com.x.platform.core.webdav.test.Test.main(Test.java:46)

Note: Jackrabbit is deployed on tomcat.

safeer
  • 31
  • 1
  • 3
  • What does the server's log say? – Julian Reschke Feb 18 '19 at 12:52
  • There is no log created for failed entry for successful upload i am getting this infomartion ====> 2019-02-19 14:55:46.366 INFO [http-nio-8080-exec-2] ClusterNode.java:712 [1] 1 admin@default:/test125/photo-1535498730771-e735b998cd64.jpeg/jcr:content (2427) – safeer Feb 19 '19 at 09:33
  • Maybe Tomcat limits the payload? See https://stackoverflow.com/questions/2947683/httprequest-maximum-allowable-size-in-tomcat – Julian Reschke Feb 19 '19 at 11:07
  • One possibility could be the maxSavePostSize attribute on tomcat connector, refer: https://tomcat.apache.org/tomcat-9.0-doc/config/http.html By default it is 4K i..e Tomcat will not save/buffer more than 4K of data before the authentication process is over. Though it does not explicitly mention, it perhaps is same for PUT requests. Worth a try to check though. – Ironluca Feb 19 '19 at 19:22
  • i have tried adding below connector properties still it fails ==== – safeer Feb 20 '19 at 10:35
  • when I use jetty server i am able to uploads – safeer Feb 20 '19 at 10:36

0 Answers0