sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection Error in Git repositories
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
問題
After being updated to Bamboo 5.8.1 this error is being thrown on an attempted connection to Stash:
- Git checkouts fail for builds.
- Git commits fail to trigger builds.
The following appears in the atlassian-bamboo.log
com.atlassian.bamboo.repository.RepositoryException: java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:398)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:286)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:185)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:142)
at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.performDelayedChangeDetection(ManualBuildDetectionAction.java:172)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:224)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:277)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:213)
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:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy124.delayedStart(Unknown Source)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1$1.run(PlanExecutionManagerImpl.java:430)
at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:85)
at com.atlassian.bamboo.util.CacheAwareness.whileReadingThroughCaches(CacheAwareness.java:102)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:425)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1$1.call(PlanExecutionManagerImpl.java:417)
at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)
at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:805)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$300(PlanExecutionManagerImpl.java:128)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$2$1.run(PlanExecutionManagerImpl.java:411)
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:132)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:176)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:501)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:358)
... 33 more
Caused by: com.atlassian.bamboo.repository.RepositoryException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:342)
at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:214)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:506)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$2.call(DefaultChangeDetectionManager.java:502)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108)
... 38 more
Caused by: java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
at org.eclipse.jgit.transport.http.JDKHttpConnection.configure(JDKHttpConnection.java:191)
at com.atlassian.bamboo.plugins.git.jgit.transport.http.AllTrustingHttpConnectionFactory.customizeConnection(AllTrustingHttpConnectionFactory.java:74)
at com.atlassian.bamboo.plugins.git.jgit.transport.http.AllTrustingHttpConnectionFactory.create(AllTrustingHttpConnectionFactory.java:65)
at org.eclipse.jgit.transport.TransportHttp.httpOpen(TransportHttp.java:544)
at org.eclipse.jgit.transport.TransportHttp.httpOpen(TransportHttp.java:529)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:468)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:309)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.withFetchConnection(JGitOperationHelper.java:928)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.obtainLatestRevision(JGitOperationHelper.java:439)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.access$100(JGitOperationHelper.java:71)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper$4.doWithRepository(JGitOperationHelper.java:425)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper$4.doWithRepository(JGitOperationHelper.java:420)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.withRepository(JGitOperationHelper.java:878)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.obtainLatestRevision(JGitOperationHelper.java:420)
at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:226)
... 42 more
原因
Occurs when native JGit is in use.
回避策
This issue is related with the native git installation (Jgit) used by default by Bamboo.
To workaround this, install your own version of Git on the Bamboo server and define this Git binary in Bamboo as a capability.
This should get Bamboo off the bundled jgit version and resolve the issue.
ソリューション
- BAM-16019 - Getting issue details... STATUS