java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream

Oracle Community | 807594 | 1 decade ago
  1. 0

    java.lang.ClassCastException by url.getContent()

    Oracle Community | 1 decade ago | 807594
    java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream
  2. 0

    Set tag error when Keystore loads PKCS12 cert

    Oracle Community | 1 decade ago | 843811
    java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection
  3. 0

    Java Login 'Exception Error'- what does it mean?

    Stack Overflow | 2 years ago | Ben Harvey
    java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    h3. Summary 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 is seen on the logs: {code:title=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 {code} h3.Workaround 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_|https://confluence.atlassian.com/display/STASH/Installing+and+upgrading+Git#InstallingandupgradingGit-InstallorupgradeGitonWindows] and [define this Git binary in Bamboo as a capability|https://confluence.atlassian.com/display/BAMBOO/Defining+a+new+version+control+capability]. This should get Bamboo off the bundled jgit version and resolve the issue.

    Atlassian JIRA | 2 years ago | Turner Benard [Atlassian]
    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
  6. 0

    h3. Summary 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 is seen on the logs: {code:title=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 {code} h3.Workaround 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_|https://confluence.atlassian.com/display/STASH/Installing+and+upgrading+Git#InstallingandupgradingGit-InstallorupgradeGitonWindows] and [define this Git binary in Bamboo as a capability|https://confluence.atlassian.com/display/BAMBOO/Defining+a+new+version+control+capability]. This should get Bamboo off the bundled jgit version and resolve the issue.

    Atlassian JIRA | 2 years ago | Carlen Benard
    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

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      sun.net.www.protocol.http.HttpURLConnection$HttpInputStream

      at Snatch.main()
    2. Unknown
      Snatch.main
      1. Snatch.main(Snatch.java:9)
      1 frame