It's all about the answers!

Ask a question

[6.0.3] Connecting to RTC with the Plain Java API using SSL


0
1
Annie Steenson (134) | asked May 11 '17, 11:31 a.m.
edited May 11 '17, 4:04 p.m.

I am trying to login using

ITeamRepository teamRepository = TeamPlatform.getTeamRepositoryService().getTeamRepository(repository);
teamRepository.registerLoginHandler(new LoginHandler(username, password));
teamRepository.login(null);

However, the login is failing because of an SSL Handshake exception (attached below). My code is extremely dependent on the Plain Java API. How can I add SSL to the teamRepository login?

2017/05/11 11:26:55 [DEBUG] RemoteTeamServer:99 - Entering buildHttpClient
2017/05/11 11:26:55 [DEBUG] SSLUtils:339 - SSL Algorithm Priority: null
2017/05/11 11:26:55 [DEBUG] SSLUtils:339 - Creating SSL_TLSv2 context
2017/05/11 11:26:55 [DEBUG] SSLUtils:345 - SSL_TLSv2 SSLContext not available
java.security.NoSuchAlgorithmException: SSL_TLSv2 SSLContext not available
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
    at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
    at com.ibm.team.repository.transport.client.SSLUtils.createSSLContext(SSLUtils.java:207)
    at com.ibm.team.repository.transport.client.SSLUtils.createSSLContext(SSLUtils.java:168)
    at com.ibm.team.repository.transport.client.SSLUtils.createSSLContext(SSLUtils.java:189)
    at com.ibm.team.repository.transport.client.SSLContextUtil.createSSLContext(SSLContextUtil.java:55)
    at com.ibm.team.repository.transport.client.SecureInterruptableSocketFactory2.<init>(SecureInterruptableSocketFactory2.java:112)
    at com.ibm.team.repository.transport.client.SecureInterruptableSocketFactory2.<init>(SecureInterruptableSocketFactory2.java:103)
    at com.ibm.team.repository.transport.client.RemoteTeamServer.buildHttpClient(RemoteTeamServer.java:539)
    at com.ibm.team.repository.transport.client.RemoteTeamServer.getHttpClient(RemoteTeamServer.java:363)
    at com.ibm.team.repository.transport.client.RemoteTeamServer.access$1(RemoteTeamServer.java:357)
    at com.ibm.team.repository.transport.client.RemoteTeamServer$1.execute(RemoteTeamServer.java:300)
    at com.ibm.team.repository.transport.client.RemoteTeamServer.executePrimitiveRequest(RemoteTeamServer.java:1904)
    at com.ibm.team.repository.transport.client.RemoteTeamServer.executeWithAuthHandling(RemoteTeamServer.java:1578)
    at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1204)
    at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1153)
    at com.ibm.team.repository.transport.client.RestClientConnectionBase.executeMethod(RestClientConnectionBase.java:375)
    at com.ibm.team.repository.transport.client.RestClientConnectionBase.doMethod(RestClientConnectionBase.java:211)
    at com.ibm.team.repository.transport.client.RestClientConnectionBase.doGet(RestClientConnectionBase.java:144)
    at com.ibm.team.repository.transport.client.TeamRawRestServiceClient$RawRestClientConnection.doGet(TeamRawRestServiceClient.java:96)
    at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(ServiceInterfaceProxy.java:254)
    at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:110)
    at com.ibm.team.repository.client.internal.RawRestServiceClientProxy$RestClientConnectionProxy.invoke(RawRestServiceClientProxy.java:121)
    at com.sun.proxy.$Proxy111.doGet(Unknown Source)
    at com.ibm.team.repository.client.internal.TeamRepository.fetchClientVersionJSONObject(TeamRepository.java:1702)
    at com.ibm.team.repository.client.internal.TeamRepository.access$0(TeamRepository.java:1699)
    at com.ibm.team.repository.client.internal.TeamRepository$5.run(TeamRepository.java:1770)
    at com.ibm.team.repository.client.internal.TeamRepository$5.run(TeamRepository.java:1)
    at com.ibm.team.repository.client.internal.TeamRepository$3.run(TeamRepository.java:1328)
    at com.ibm.team.repository.common.transport.CancelableCaller.call(CancelableCaller.java:79)
    at com.ibm.team.repository.client.internal.TeamRepository.callCancelableService(TeamRepository.java:1323)
    at com.ibm.team.repository.client.internal.TeamRepository.checkServerVersionMatches(TeamRepository.java:1773)
    at com.ibm.team.repository.client.internal.TeamRepository.internalLogin(TeamRepository.java:1521)
    at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:654)
    at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:628)
    at com.ibm.dashboard.service.impl.RtcClientServiceImpl.loginTeamRepository(RtcClientServiceImpl.java:98)
    at com.ibm.dashboard.service.impl.DefectReportServiceImpl.retrieveDefectReportData(DefectReportServiceImpl.java:103)
    at com.ibm.dashboard.service.impl.DefectReportServiceImpl.generateChart(DefectReportServiceImpl.java:77)
    at com.ibm.dashboard.controller.DefectReportAction.getDefectReport(DefectReportAction.java:89)
    at com.ibm.dashboard.controller.DefectReportAction$$FastClassBySpringCGLIB$$f2840c.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:68)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at com.ibm.dashboard.controller.DefectReportAction$$EnhancerBySpringCGLIB$$ad0ee640.getDefectReport(<generated>)
    at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)
    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:748)
2017/05/11 11:26:55 [DEBUG] SSLUtils:339 - Failed to create SSL_TLSv2 context






Comments
Ralph Schoon commented May 11 '17, 1:45 p.m. | edited May 11 '17, 1:51 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Rumor has it I have fun having to post this 4 times a day but, in fact, I don't: How should I ask a question in the Forum if I want to receive useful answers?  

Version numbers is the minimum expected from anyone asking on this forum, Annie.


Ralph Schoon commented May 11 '17, 1:48 p.m. | edited May 11 '17, 4:22 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Just to add to this, SSL is being used in 99% of all RTC installs worldwide, including plain Java automation and the client e.g. Eclipse. It is being the standard and no one actually ever thinks about it, because it usually works.

So it is not anything extraordinary. But there might be special variants out there with issues.

2 answers



permanent link
Ralph Schoon (55.5k23642) | answered May 11 '17, 1:55 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Comments
Ralph Schoon commented May 11 '17, 4:16 p.m. | edited May 11 '17, 4:19 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Sorry. Version number well hidden in the subject.......
Stupid me.

We have seen an issue with https://rsjazz.wordpress.com/2016/09/21/cant-connect-to-rtc-running-with-jazz-authentication-server/ Jazz authentication error. I have seen issues with connecting to Jetty versions earlier than 5.x due to older TLS versions no longer being accepted in current  browsers..

A connection problem of the plain java client libraries (version 6.0.3) and version 6.0.3 jetty server indicates a problem I am not sure I ever heared about, Maybe contact support. Maybe that is related to the post above. I am not sure what version that was. Maybe 6.0.3


permanent link
Donald Nong (14.3k213) | answered May 11 '17, 10:53 p.m.

It appears that you have "-Dcom.ibm.team.repository.transport.client.protocol=SSL_TLSv2" specified in your environment. Changing it to "-Dcom.ibm.team.repository.transport.client.protocol=TLSv1.2" should resolve the problem.

SSL protocol "SSL_TLSv2" is available in IBM Java only. If you specify this protocol and use Oracle Java or OpenJDK, you will get this problem. "TLSv1.2" is available in all current Java versions so it should work just fine.

IBM documents about setting the "-Dcom.ibm.team.repository.transport.client.protocol" property seem inconsistent as some places say "TLSv1.2" and yet others say "SSL_TLSv2". It can surely cause some confusion.

Your answer


Register or to post your answer.