Hi,
Iam trying to use the Apache Stanbol client to add content to the content hub.
I followed same code as given in Stanbol client test.

I have a simple text file which I want to upload .  As part of uploading I want 
to run my custom enhancement chain on this.

I got the exception  "A message body writer for Java type, class 
com.sun.jersey.multipart.FormDataMultiPart, and MIME media type, 
multipart/form-data, was not found
"  while running the add command to content hub.  The complete exception is 
listed at end of mail.
Src line -  String docUri = 
client.contenthub().add(StanbolContenthubStoreService.STANBOL_DEFAULT_INDEX, 
"default", request);


While debugging I was pointed that it could be because of lack of mimepull as 
well as jersey-multipart.  I included both these in build path but even then 
the exception is coming.
Any pointers on how this could be resolved.

Have attached relevant piece of code at end of mail.

Thanks and Rgds,
Arthi

Code.
public void addToContentHub() throws Exception {
              File testFile = new File("./filetoread.txt");

              final StanbolClient client = new 
StanbolClientImpl(STANBOL_ENDPOINT);
               // contenthub request
               ContentHubDocumentRequest request = new 
ContentHubDocumentRequest();


               request.setTitle("Enhance");
               request.setURI(TEST_URI);
              // request.setContentFile(testFile);

               
request.setContentStream(this.getClass().getResourceAsStream("./filetoread.txt"));

               // add content
              //  String docUri = 
client.contenthub().add(StanbolContenthubStoreService.STANBOL_DEFAULT_INDEX, 
"MyCustomChain1", request);
               String docUri = 
client.contenthub().add(StanbolContenthubStoreService.STANBOL_DEFAULT_INDEX, 
"default", request);


               // load content
               ContentItem ci = 
client.contenthub().get(StanbolContenthubStoreService.STANBOL_DEFAULT_INDEX, 
docUri, true);

               // checks

               model = ci.getEnhancementGraph();
               model.write(System.out, "RDFXML") ;

             }


Exception :
Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: 
com.sun.jersey.api.client.ClientHandlerException: A message body writer for 
Java type, class com.sun.jersey.multipart.FormDataMultiPart, and MIME media 
type, multipart/form-data, was not found
       at 
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151)
       at com.sun.jersey.api.client.Client.handle(Client.java:648)
       at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)
       at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
       at 
com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:568)
       at 
org.apache.stanbol.client.restclient.RestClientImpl.post(RestClientImpl.java:279)
       at 
org.apache.stanbol.client.contenthub.store.services.impl.StanbolContenthubStoreServiceImpl.add(StanbolContenthubStoreServiceImpl.java:165)
       at EnhanceContent.addToContentHub(EnhanceContent.java:45)
       at EnhanceContent.main(EnhanceContent.java:62)
Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body 
writer for Java type, class com.sun.jersey.multipart.FormDataMultiPart, and 
MIME media type, multipart/form-data, was not found
       at 
com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)
       at 
com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:213)
       at 
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)
       ... 8 more

Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

Reply via email to