-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Logged by Sravan Kottam:
My test
String docId[] = {"/foo/test/myFoo1.txt","/foo/test/myFoo2.txt","/foo/test/myFoo3.txt"};
TextDocumentManager docMgr = client.newTextDocumentManager();
DocumentWriteSet writeset =docMgr.newWriteSet();
writeset.add(docId[0], new StringHandle().with("This is so foo1"));
writeset.add(docId[1], new StringHandle().with("This is so foo2"));
writeset.add(docId[2], new StringHandle().with("This is so foo3"));
docMgr.write(writeset);
assertEquals("Text document write difference", "This is so foo1", docMgr.read(docId[0], new StringHandle()).get());
assertEquals("Text document write difference", "This is so foo2", docMgr.read(docId[1], new StringHandle()).get());
assertEquals("Text document write difference", "This is so foo3", docMgr.read(docId[2], new StringHandle()).get());
Actual:
com.marklogic.client.FailedRequestException: Local message: failed to apply resource at documents: Internal Server Error. Server Message: XDMP-AS: (err:XPTY0004) $mimetype as xs:string -- Invalid coercion: () as xs:string. See the MarkLogic server error log for further detail.
at com.marklogic.client.impl.JerseyServices.checkStatus(JerseyServices.java:4028)
at com.marklogic.client.impl.JerseyServices.postResource(JerseyServices.java:3358)
at com.marklogic.client.impl.JerseyServices.postBulkDocuments(JerseyServices.java:3425)
at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:421)
at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:408)
at com.marklogic.javaclient.TestBulkWriteSample1.testWriteMultipleTextDoc(TestBulkWriteSample1.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
I see the following logging from client side
In setup
[DEBUG] ThreadSafeClientConnManager - Get connection: HttpRoute[{}->http://localhost:8011], timeout = 0
[DEBUG] ConnPoolByRoute - [HttpRoute[{}->http://localhost:8011]] total kept alive: 0, total issued: 0, total allocated: 0 out of 200
[DEBUG] ConnPoolByRoute - No free connections [HttpRoute[{}->http://localhost:8011]][null]
[DEBUG] ConnPoolByRoute - Available capacity: 100 out of 100 [HttpRoute[{}->http://localhost:8011]][null]
[DEBUG] ConnPoolByRoute - Creating new connection [HttpRoute[{}->http://localhost:8011]]
[DEBUG] DefaultClientConnectionOperator - Connecting to localhost/127.0.0.1:8011
[DEBUG] RequestAddCookies - CookieSpec selected: best-match
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] DefaultHttpClient - Attempt 1 to execute request
[DEBUG] DefaultClientConnection - Sending request: POST /v1/documents HTTP/1.1
[DEBUG] wire - >> "POST /v1/documents HTTP/1.1[\r][\n]"
[DEBUG] wire - >> "Content-Type: multipart/mixed; boundary=Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Accept: application/json[\r][\n]"
[DEBUG] wire - >> "Transfer-Encoding: chunked[\r][\n]"
[DEBUG] wire - >> "Host: localhost:8011[\r][\n]"
[DEBUG] wire - >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] headers - >> POST /v1/documents HTTP/1.1
[DEBUG] headers - >> Content-Type: multipart/mixed; boundary=Boundary_1_1299150774_1403115952401
[DEBUG] headers - >> Accept: application/json
[DEBUG] headers - >> Transfer-Encoding: chunked
[DEBUG] headers - >> Host: localhost:8011
[DEBUG] headers - >> Connection: Keep-Alive
[DEBUG] wire - >> "7e[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Content-Disposition: attachment; filename="/foo/test/myFoo1.txt"[\r][\n]"
[DEBUG] wire - >> "Content-Type: /[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "8f[\r][\n]"
[DEBUG] wire - >> "This is so foo1[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Content-Disposition: attachment; filename="/foo/test/myFoo2.txt"[\r][\n]"
[DEBUG] wire - >> "Content-Type: /[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "8f[\r][\n]"
[DEBUG] wire - >> "This is so foo2[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Content-Disposition: attachment; filename="/foo/test/myFoo3.txt"[\r][\n]"
[DEBUG] wire - >> "Content-Type: /[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "3a[\r][\n]"
[DEBUG] wire - >> "This is so foo3[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401--[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "0[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - << "HTTP/1.1 401 Unauthorized[\r][\n]"
[DEBUG] wire - << "WWW-Authenticate: Digest realm="public", qop="auth", nonce="443b7b7b0beff466f3c3fd8bace3c6a1", opaque="d47d20a7d7dd7b57"[\r][\n]"
[DEBUG] wire - << "Content-type: application/xml[\r][\n]"
[DEBUG] wire - << "Server: MarkLogic[\r][\n]"
[DEBUG] wire - << "Content-Length: 211[\r][\n]"
[DEBUG] wire - << "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - << "Keep-Alive: timeout=5[\r][\n]"
[DEBUG] wire - << "[\r][\n]"
[DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 401 Unauthorized
[DEBUG] headers - << HTTP/1.1 401 Unauthorized
[DEBUG] headers - << WWW-Authenticate: Digest realm="public", qop="auth", nonce="443b7b7b0beff466f3c3fd8bace3c6a1", opaque="d47d20a7d7dd7b57"
[DEBUG] headers - << Content-type: application/xml
[DEBUG] headers - << Server: MarkLogic
[DEBUG] headers - << Content-Length: 211
[DEBUG] headers - << Connection: Keep-Alive
[DEBUG] headers - << Keep-Alive: timeout=5
[DEBUG] DefaultHttpClient - Connection can be kept alive for 5000 MILLISECONDS
[DEBUG] DefaultHttpClient - Target requested authentication
[DEBUG] DefaultTargetAuthenticationHandler - Authentication schemes in the order of preference: [negotiate, NTLM, Digest, Basic]
[DEBUG] DefaultTargetAuthenticationHandler - Challenge for negotiate authentication scheme not available
[DEBUG] DefaultTargetAuthenticationHandler - Challenge for NTLM authentication scheme not available
[DEBUG] DefaultTargetAuthenticationHandler - Digest authentication scheme selected
[DEBUG] DefaultHttpClient - Authorization challenge processed
[DEBUG] DefaultHttpClient - Authentication scope: DIGEST 'public'@localhost:8011
[DEBUG] DefaultHttpClient - Credentials not found
[DEBUG] wire - << "<rapi:error xmlns:rapi="http://marklogic.com/rest-api">rapi:status-code401/rapi:status-coderapi:statusFailed Auth/rapi:statusrapi:message-code/rapi:messageUnauthenticated/rapi:message/rapi:error[\n]"
[DEBUG] ThreadSafeClientConnManager - Released connection is reusable.
[DEBUG] ConnPoolByRoute - Releasing connection [HttpRoute[{}->http://localhost:8011]][null]
[DEBUG] ConnPoolByRoute - Pooling connection [HttpRoute[{}->http://localhost:8011]][null]; keep alive for 5000 MILLISECONDS
[DEBUG] ConnPoolByRoute - Notifying no-one, there are no waiting threads
[DEBUG] ThreadSafeClientConnManager - Get connection: HttpRoute[{}->http://localhost:8011], timeout = 0
[DEBUG] ConnPoolByRoute - [HttpRoute[{}->http://localhost:8011]] total kept alive: 1, total issued: 0, total allocated: 1 out of 200
[DEBUG] ConnPoolByRoute - Getting free connection [HttpRoute[{}->http://localhost:8011]][null]
[DEBUG] DefaultHttpClient - Stale connection check
[DEBUG] RequestAddCookies - CookieSpec selected: best-match
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] DefaultHttpClient - Attempt 1 to execute request
[DEBUG] DefaultClientConnection - Sending request: POST /v1/documents HTTP/1.1
[DEBUG] wire - >> "POST /v1/documents HTTP/1.1[\r][\n]"
[DEBUG] wire - >> "Content-Type: multipart/mixed; boundary=Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Accept: application/json[\r][\n]"
[DEBUG] wire - >> "MIME-Version: 1.0[\r][\n]"
[DEBUG] wire - >> "Authorization: Digest username="admin",realm="public",nonce="443b7b7b0beff466f3c3fd8bace3c6a1",opaque="d47d20a7d7dd7b57",qop=auth,uri="/v1/documents",cnonce="46062b78",nc=00000001,response="97226cf4e65296733f2f38891f96b9f2"[\r][\n]"
[DEBUG] wire - >> "Transfer-Encoding: chunked[\r][\n]"
[DEBUG] wire - >> "Host: localhost:8011[\r][\n]"
[DEBUG] wire - >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] headers - >> POST /v1/documents HTTP/1.1
[DEBUG] headers - >> Content-Type: multipart/mixed; boundary=Boundary_1_1299150774_1403115952401
[DEBUG] headers - >> Accept: application/json
[DEBUG] headers - >> MIME-Version: 1.0
[DEBUG] headers - >> Authorization: Digest username="admin",realm="public",nonce="443b7b7b0beff466f3c3fd8bace3c6a1",opaque="d47d20a7d7dd7b57",qop=auth,uri="/v1/documents",cnonce="46062b78",nc=00000001,response="97226cf4e65296733f2f38891f96b9f2"
[DEBUG] headers - >> Transfer-Encoding: chunked
[DEBUG] headers - >> Host: localhost:8011
[DEBUG] headers - >> Connection: Keep-Alive
[DEBUG] wire - >> "7e[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Content-Disposition: attachment; filename="/foo/test/myFoo1.txt"[\r][\n]"
[DEBUG] wire - >> "Content-Type: /[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "8f[\r][\n]"
[DEBUG] wire - >> "This is so foo1[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Content-Disposition: attachment; filename="/foo/test/myFoo2.txt"[\r][\n]"
[DEBUG] wire - >> "Content-Type: /[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "8f[\r][\n]"
[DEBUG] wire - >> "This is so foo2[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401[\r][\n]"
[DEBUG] wire - >> "Content-Disposition: attachment; filename="/foo/test/myFoo3.txt"[\r][\n]"
[DEBUG] wire - >> "Content-Type: /[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "3a[\r][\n]"
[DEBUG] wire - >> "This is so foo3[\r][\n]"
[DEBUG] wire - >> "--Boundary_1_1299150774_1403115952401--[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - >> "0[\r][\n]"
[DEBUG] wire - >> "[\r][\n]"
[DEBUG] wire - << "HTTP/1.1 500 Internal Server Error[\r][\n]"
[DEBUG] wire - << "Content-type: application/xml[\r][\n]"
[DEBUG] wire - << "Server: MarkLogic[\r][\n]"
[DEBUG] wire - << "Content-Length: 365[\r][\n]"
[DEBUG] wire - << "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - << "Keep-Alive: timeout=5[\r][\n]"
[DEBUG] wire - << "[\r][\n]"
[DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 500 Internal Server Error
[DEBUG] headers - << HTTP/1.1 500 Internal Server Error
[DEBUG] headers - << Content-type: application/xml
[DEBUG] headers - << Server: MarkLogic
[DEBUG] headers - << Content-Length: 365
[DEBUG] headers - << Connection: Keep-Alive
[DEBUG] headers - << Keep-Alive: timeout=5
[DEBUG] DefaultHttpClient - Connection can be kept alive for 5000 MILLISECONDS
[DEBUG] wire - << "<rapi:error xmlns:rapi="http://marklogic.com/rest-api">rapi:status-code500/rapi:status-coderapi:statusINTERNAL ERROR/rapi:statusrapi:message-codeXDMP-AS/rapi:message-coderapi:messageXDMP-AS: (err:XPTY0004) $mimetype as xs:string -- Invalid coercion: () as xs:string. See the MarkLogic server error log for further detail./rapi:message/rapi:error[\n]"
[DEBUG] ThreadSafeClientConnManager - Released connection is reusable.
[DEBUG] ConnPoolByRoute - Releasing connection [HttpRoute[{}->http://localhost:8011]][null]
[DEBUG] ConnPoolByRoute - Pooling connection [HttpRoute[{}->http://localhost:8011]][null]; keep alive for 5000 MILLISECONDS
[DEBUG] ConnPoolByRoute - Notifying no-one, there are no waiting threads