Hi Arthi,
The Stanbol client you are using is not currently part of the Stanbol
project. Actually, we developed it at Zaizi (my current company) as a
way to ease the integration of Apache Stanbol in our Java projects
through consuming the Stanbol RESTful API. If you are experimenting
issues using it, you can directly report them in the project page in
GitHub (https://github.com/zaizi/apache-stanbol-client/). I will be
happy to help you there and try to fix the issues. By the way, initially
I would say you might have a conflict between the client's dependencies
and yours.
Regards
El 24/07/13 15:05, arthi.ven...@wipro.com escribió:
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
--
------------------------------
This message should be regarded as confidential. If you have received this
email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy
by an authorised signatory.
Zaizi Ltd is registered in England and Wales with the registration number
6440931. The Registered Office is Brook House, 229 Shepherds Bush Road,
London W6 7AN.