Page 1 of 1

OpenKM Exception while dispatching incoming RPC call

PostPosted:Sun Jul 02, 2017 4:11 pm
by vhlen
I've got an issue with login-logout-login scenarios. When I login to the system, sometime it redirects to wrong page.
I think the problem is the spring filter stores the last requested URL and uses that value as the target to redirect after login.
Can you help me resolve this problem?
Code: Select all
2017-07-02 21:53:20,851 [http-bio-0.0.0.0-8080-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/OpenKM]- Exception while dispatching incoming RPC call
javax.servlet.ServletException: Content-Type was '(null)'. Expected 'text/x-gwt-rpc'.
	at com.google.gwt.user.server.rpc.RPCServletUtils.checkContentTypeIgnoreCase(RPCServletUtils.java:427)
	at com.google.gwt.user.server.rpc.RPCServletUtils.readContent(RPCServletUtils.java:160)
	at com.google.gwt.user.server.rpc.RPCServletUtils.readContentAsGwtRpc(RPCServletUtils.java:205)
	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.readContent(AbstractRemoteServiceServlet.java:182)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:239)
	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Mon Jul 03, 2017 7:31 am
by jllort
Yes, spring take in consideration the last URL what you have accessed. If you logout correctly ( with the menu option ) this issue should not happens.

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Mon Jul 03, 2017 9:14 am
by vhlen
Thanks jllort for your reply.
I logout correctly ( with the menu option ) but the issue will be appear if I was working multiple OpenKM tab on the browser.
It seems the spring stored last URL and redirected me to wrong page after I login.
I can reproduce this issue with demo web version (https://demo.openkm.com)
  • Step 3: On tab 2, We logout with the menu option (Click File -> Exit). It will show us the popup say that "The OpenKM has closed correctly". And then click "Close" button to go to the login page.
  • Step 4: Switch to tab 1, Click something on the website (Such as we click a file or a folder on the desktop dashboard) The website will show an error popup "Error when communicating with server".
  • Step 5: Switch to tab 2, Login again with an user/pass. It will redirect to wrong page with an error message: "The call failed on the server; see server log for details"
I think the root cause is on the step 4. The Spring was stored the last URL on this step and redirect us to the URL request after login.
In reality, the Users need to use multiple tabs in some cases. It would be nice if we can fix it.

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Tue Jul 04, 2017 3:20 pm
by jllort
Working with 2 tabs are doing logout from one side and with another are trying to get protected resources, obviously in this scenario the last url have been tryed to accessing is from the tab where you have not logout, might be any of the url periodically used for refreshing data.

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Thu Jul 06, 2017 2:23 am
by vhlen
You are right. Do we have a solution for this issue? Since the Users can use multiple tabs on our system. We shouldn't show error page for this case.

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Sat Jul 08, 2017 10:44 am
by jllort
For my understanding is not possible, but we are open for a solution. I do not know if you have using other application and there is solved if you discover how to solve it, share with us and we will study it.

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Thu Jul 27, 2017 9:25 am
by vhlen
Hi jllort,
After I did some researches, I have a temporary solution for this issue: We can force the website always redirect into index page when user login successfully.
Add bellow code:
Code: Select all
always-use-default-target="true"
into form-login tag on appContext.xml
Code: Select all
<security:form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?error=1" always-use-default-target="true"/>
There is a small problem with this solution. If we use this configuration, the OpenKM will not redirect destination page when we are not logged the system. (Because we force the login form always redirect to index page).
I hope someone has better solution than this solution. We need to consider when we use this solution.

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Fri Jul 28, 2017 9:13 am
by jllort
We are going to check the workaround and if it's going right we will update the source code. Thanks for sharing it.

If you want to apply the change in our github repository https://github.com/openkm/document-management-system ( create a new branch and ask for a merge to 6.3-DEV branh ) you are welcome.

Re: OpenKM Exception while dispatching incoming RPC call

PostPosted:Thu Aug 31, 2017 9:50 am
by pavila
I've tried and the solution has problems. If the user is not authenticated and access to OpenKM using an URL like this http://localhost:8080/OpenKM/index.jsp? ... 2828b9531b , it won't pass the uuid parameter after the login page and OpenKM won't jump to the document. I think this is what you said, but I didn't understand you :)