• ServiceConstructionException while accessing OKM webservices

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #20029  by preethism
 
Hi,

We have a web application deployed in JBoss 7 and it uses OpenKM 6.2( bundled with Tomcat ) to manage documents.
I have created a client jar (as per the steps in the OpenKM Wiki) and the application accesses the OpenKM web services through this client jar.
While accessing the OKM services, occasionally we get the "ServiceConstructionException" when we access com.openkm.ws.client.document.OKMDocument or com.openkm.ws.client.folder.OKMFolder.

One scenario is to read a document from OpenKM repository:
1)Login to the OKM server by calling the service com.openkm.ws.client.auth.OKMAuth - login(user,pwd)
2)Call the service com.openkm.ws.client.document.OKMDocument - getContent(token, path, checkout) - to read the contents of a given file
3)Logout of the OKM server by calling the service com.openkm.ws.client.auth.OKMAuth - logout(token)

The first step executes fine, but an exception happens on step 2.
The wsdl matches with the classes in the client jar and if we restart the Jboss server the exception doesn't occur for some time.
I couldn't fix on any particular reason when exactly this exception happens, it occurs randomly.

Here is the stack trace of the exception we get:
Code: Select all
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.openkm.ws.client.document.OKMDocument does not implement the create method.
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:333)
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)
	at javax.xml.ws.Service.getPort(Service.java:99)
	at com.openkm.ws.client.document.OKMDocument_Service.getOKMDocumentPort(OKMDocument_Service.java:72)
	at xxx.yyyy.zzzz.component.impl.OKMDocumentManagement.getDocument(OKMDocumentManagement.java:128)
	at xxx.yyyy.zzzz.service.impl.ApplicationServiceImpl.xxx(ApplicationServiceImpl.java:438)
	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:601)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy277.getApplicationForRoSdo(Unknown Source)
	at xxx.yyyy.zzzz.web.controller.ApplicationController.xxx(ApplicationController.java:492)
	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:601)
	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
	at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.openkm.ws.client.document.OKMDocument does not implement the create method.
	at org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:68)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.bindOperation(JaxWsServiceFactoryBean.java:280)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperation(JaxWsServiceFactoryBean.java:254)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:645)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:289)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:392)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:499)
	at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
	at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
	at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152)
	at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
	at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)
	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)
	... 73 more
Caused by: java.lang.NoSuchMethodException: com.openkm.ws.client.document.OKMDocument.create(java.lang.String, com.openkm.ws.client.document.Document, [B)
	at java.lang.Class.getMethod(Class.java:1622)
	at org.apache.cxf.jaxws.JAXWSMethodDispatcher.getImplementationMethod(JAXWSMethodDispatcher.java:88)
	at org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:55)
	... 87 more
Can someone shed some light on how to solve this?
Last edited by preethism on Thu Jan 24, 2013 7:01 am, edited 1 time in total.
 #20046  by jllort
 
Could be some problem with ports ( tomcat and jboss ). To be sure is not it I suggest stop jboss and execute the client ... if all goes fine then the problem is with jbos / tomcat configuration.

The problem is ramdonly for what you told ? with jboss stopped too or not ?
 #20590  by preethism
 
No.The error does not occur always..
Also, the problem doesn't happen when the authentication is done using:
com.openkm.ws.client.auth.OKMAuth - login() and logout()

After logging in successfully through code, when we try to read or write a file, this error occurs sometimes.
 #20614  by preethism
 
Here is the code snippet which makes this call:
Code: Select all
public byte[] getDocument(String filePath) {
		byte[] content = null;
		String token = login();
		String path = OKM_ROOT + filePath;
		OKMDocument docService = new OKMDocument_Service().getOKMDocumentPort();
		try {
			logger.info("OKM DOCUMENT : filePath " + filePath);
			content = docService.getContent(token, path, false);
		} catch (com.openkm.ws.client.document.AccessDeniedException_Exception
				| com.openkm.ws.client.document.DatabaseException_Exception | IOException_Exception
				| PathNotFoundException_Exception | com.openkm.ws.client.document.RepositoryException_Exception e) {
			logger.info("Exception in get Document:" + e);
		}
		logout(token);
		return content;
	}

	private String login() {
		String token = null;
		OKMAuth okmAuth = new OKMAuth_Service().getOKMAuthPort();
		try {
			token = okmAuth.login("okmAdmin", "admin");
		} catch (AccessDeniedException_Exception | DatabaseException_Exception | RepositoryException_Exception e) {
			logger.error("method login error" + e);
		}
		return token;
	}
The client jar is included in the WEB-INF/lib of the web application war file.
 #20630  by jllort
 
Seems right. Do you got jbossws.sar deployed ? and do you use jboss webservices ( otherside we could try to remove it ) ?
All seems some library incompatibility or similar and it's not easy find this kind of problems.
 #20718  by jllort
 
I do not know the cause of the problem but for what you explain here seems in some cases the ws method do not exists from your environment and other yes. I suggest you make the question at jboss forum because seems there's some problem there and sure you're not the first who got this kind of problem (probably not with openkm but sure accessing to other ws )

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.