2016-07-24 57 views
0

我試圖將HANA雲文檔服務與CMIS集成到Maven和Spring中。 當我嘗試使用沒有Maven/Spring上下文的代碼時,它工作正常。 (爲了更好地理解,請大家看看這裏:http://scn.sap.com/community/developer-center/cloud-platform/blog/2013/04/13/document-management-using-hana-cloud-document-service-on-android發佈代理對象

 Session openCmisSession = null; 
     EcmService ecmSvc = null; 
     InitialContext ctx = new InitialContext(); 
     String lookupName = "java:comp/env/" + "EcmService"; 
     try 
     { 
      Object obj = ctx.lookup(lookupName); 
      ecmSvc = (EcmService) obj; 
     }  
     catch (Exception e) 
     { 
      e.printStackTrace(); 
     } 

使用Spring,當它試圖投代理對象發生異常。

ecmSvc = (EcmService) obj; //Here, the EcmService is a interface 

唯一的例外是:

java.lang.ClassCastException:com.sun.proxy $ Proxy146不能轉換到com.sap.ecm.api.EcmService

at com.msg.reinsurance.application.account.service.FindAccountFacadeImp.findContract(FindAccountFacadeImp.java:93) 

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 

at java.lang.reflect.Method.invoke(Method.java:498) 

at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) 

at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) 

at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189) 

at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) 

at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) 

at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) 

at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) 

at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) 

at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254) 

at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) 

at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) 

at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) 

at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180) 

at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298) 

at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:222) 

at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) 

at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273) 

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.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) 

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 

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:505) 

at com.sap.core.jpaas.security.auth.service.lib.AbstractAuthenticator.invoke(AbstractAuthenticator.java:168) 

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) 

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) 

at com.sap.core.tenant.valve.TenantValidationValve.invokeNextValve(TenantValidationValve.java:167) 

at com.sap.core.tenant.valve.TenantValidationValve.invoke(TenantValidationValve.java:91) 

at com.sap.js.statistics.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:34) 

at com.sap.core.js.monitoring.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:27) 

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) 

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) 

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) 

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) 

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) 

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 

at java.lang.Thread.run(Thread.java:745) 

任何幫助將不勝感激。謝謝。

回答

0

在一個最好的賭注我會認爲你打包resp。客戶端庫添加到您的應用程序中,以便與平臺已提供的應用程序衝突(由於不同的類加載器)。 仔細檢查。 此外,如果問題不是由我的假設引起的,則可以在此處檢查另一個解決方法:http://scn.sap.com/thread/3803685