Page 1 of 1

ServiceConstructionException while accessing OKM webservices

PostPosted:Thu Dec 27, 2012 11:25 am
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?

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Sat Dec 29, 2012 10:58 am
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 ?

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Wed Jan 02, 2013 5:54 am
by preethism
The tomcat and jboss use different ports and the problem occurs when the client accesses the OpenKM through jboss only.
When tried outside Jboss, using Junit tests, the problem doesn't occur.

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Thu Jan 03, 2013 6:31 pm
by jllort
could be a problem with org.apache compatibility. But not always you get the error or you get always ?

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Fri Jan 04, 2013 1:04 pm
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.

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Sun Jan 06, 2013 6:03 pm
by jllort
Can you share some minimal code to take a look on it ? I would like to see all steps are right.

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Mon Jan 07, 2013 9:45 am
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.

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Tue Jan 08, 2013 5:48 pm
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.

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Thu Jan 10, 2013 9:20 am
by preethism
Nope. We do not access any web services other than OKM.
So jboss webservices and the jbossws jars are not included as part of the application lib.

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Sat Jan 12, 2013 5:17 pm
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 )

Re: ServiceConstructionException while accessing OKM webserv

PostPosted:Tue Jan 22, 2013 5:13 am
by preethism
Yeah.. Will try in the JBoss forum too. Thanks for the help, jllort!