Page 1 of 1

Error checkin new Version

PostPosted:Thu Oct 29, 2020 7:49 am
by DanielK
Hi, I am developing a java application and when i checkin a new version i get an Exception.
The upload is working but when reading the Version the Exception is thrown.

JDK 11.0.8
OpenKM 6.3.9

java code (from the example + checkout):
Code: Select all
package com.openkm;

import java.io.FileInputStream;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
	public static void main(String[] args) {
		String host = "http://10.23.16.115:8080/OpenKM";
		String username = "okmAdmin";
		String password = "admin";
		OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);

		try {
			InputStream is = new FileInputStream("c:\\tmp\\test.txt");
			ws.checkout("/okm:root/test.txt");
			ws.checkin("/okm:root/test.txt", is, "optional some comment");
			IOUtils.closeQuietly(is);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
maven dependencies:
Code: Select all
<dependencies>
		<dependency>
			<groupId>com.openkm</groupId>
			<artifactId>sdk4j</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.8.0</version>
		</dependency>
	</dependencies>
Exception:
Code: Select all
com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class com.openkm.sdk4j.bean.Version, and Java type class com.openkm.sdk4j.bean.Version, and MIME media type application/xml was not found

Re: Error checkin new Version

PostPosted:Sun Nov 01, 2020 6:23 pm
by jllort
You must use JDK 1.8.
What kind of project you have in mind ( here you have some samples https://docs.openkm.com/kcenter/view/sd ... lient.html ):
* standalone jar with everything into? ( I suggest use something like this project https://github.com/openkm/sdk4j-with-dependences )
* package into war file? ( I think is not your case )

Re: Error checkin new Version

PostPosted:Mon Nov 02, 2020 8:07 am
by DanielK
Hi, thanks that was the point.
I package openkm in a war file with a jsf application.