setRequestProperty throwing java.lang.IllegalStateException: Cannot set request property after connection is made

siva

I am getting java.lang.IllegalStateException:

java.lang.IllegalStateException: Cannot set request property after connection is made error when setRequestProperty method is called after url.openConnection();

Here is what i am trying:

URL url = new URL("https://49.205.102.182:7070/obsplatform/api/v1/mediadevices/545b801ce37e69cc");
         urlConnection = (HttpsURLConnection) url
        .openConnection();
urlConnection.setRequestProperty("Content-Type","application/json");

any suggestions please? Thanks in advance.

Pablo Retyk

This usually happens if you have in the debug watchers calls, such as conn.getResponseCode() or anything that queries the request result before the request was actually issued or completed. This causes, that during debug, a request is performed by the watcher, before having properly set you request, and then it becomes invalid.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

setRequestProperty throwing java.lang.IllegalStateException: Cannot set request property after connection is made

From Dev

Exception; Cannot set request property after connection is made; occurs on Android lollipop HTC M8

From Dev

Chromecast mRemoteMediaClient throwing java.lang.IllegalStateException: No connection

From Dev

Getting java.lang.IllegalStateException even after adding set property webdriver

From Dev

Trouble with Spring async request processing in Controller - getting java.lang.IllegalStateException: Cannot forward after response has been committed

From Dev

java.lang.IllegalStateException: Cannot forward after response has been committed after add `return`

From Dev

java.lang.IllegalStateException: Cannot forward after response has been committed after add `return`

From Dev

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property;

From Dev

Selenium:-java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

From Dev

Exception in thread "main" java.lang.IllegalStateException:The path to the driver executable must be set by the : system property

From Dev

java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing in Microservices

From Dev

Error Rendering View: java.lang.IllegalStateException: Cannot create a session after the response has been committed

From Dev

Spring java.lang.IllegalStateException: Cannot create a session after the response has been committed

From Dev

Servlet with java.lang.IllegalStateException: Cannot forward after response has been committed

From Dev

Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed)

From Dev

setRequestProperty in java

From Dev

protractor throwing 'TypeError: Cannot read property 'statusCode' of undefined' on request callback

From Dev

TestNG Selenium Java -- java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

From Dev

Raven connection java.lang.IllegalStateException: Shutdown in progress

From Dev

Gradle Guides, Building Java Web Application - Gradle build throwing java.lang.IllegalStateException

From Dev

java.lang.IllegalStateException: Cannot forward after response has been committed while including HTML files using jsp:include

From Dev

Session validation in Rest-API [java.lang.IllegalStateException: Cannot create a session after the response has been committed]

From Dev

java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed at or.apache.catalina.connector.ResponseFacade

From Dev

java.lang.IllegalStateException: Cannot perform this operation because there is no current transaction

From Dev

java.lang.IllegalStateException: Cannot read while there is an open stream writer

From Dev

java.lang.IllegalStateException: Cannot read while there is an open stream writer

From Dev

java.lang.IllegalStateException: Cannot perform this operation because there is no current transaction

From Dev

java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout : XML

From Dev

java.lang.IllegalStateException: Ambiguous mapping. Cannot map method

Related Related

  1. 1

    setRequestProperty throwing java.lang.IllegalStateException: Cannot set request property after connection is made

  2. 2

    Exception; Cannot set request property after connection is made; occurs on Android lollipop HTC M8

  3. 3

    Chromecast mRemoteMediaClient throwing java.lang.IllegalStateException: No connection

  4. 4

    Getting java.lang.IllegalStateException even after adding set property webdriver

  5. 5

    Trouble with Spring async request processing in Controller - getting java.lang.IllegalStateException: Cannot forward after response has been committed

  6. 6

    java.lang.IllegalStateException: Cannot forward after response has been committed after add `return`

  7. 7

    java.lang.IllegalStateException: Cannot forward after response has been committed after add `return`

  8. 8

    java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property;

  9. 9

    Selenium:-java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

  10. 10

    Exception in thread "main" java.lang.IllegalStateException:The path to the driver executable must be set by the : system property

  11. 11

    java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing in Microservices

  12. 12

    Error Rendering View: java.lang.IllegalStateException: Cannot create a session after the response has been committed

  13. 13

    Spring java.lang.IllegalStateException: Cannot create a session after the response has been committed

  14. 14

    Servlet with java.lang.IllegalStateException: Cannot forward after response has been committed

  15. 15

    Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed)

  16. 16

    setRequestProperty in java

  17. 17

    protractor throwing 'TypeError: Cannot read property 'statusCode' of undefined' on request callback

  18. 18

    TestNG Selenium Java -- java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

  19. 19

    Raven connection java.lang.IllegalStateException: Shutdown in progress

  20. 20

    Gradle Guides, Building Java Web Application - Gradle build throwing java.lang.IllegalStateException

  21. 21

    java.lang.IllegalStateException: Cannot forward after response has been committed while including HTML files using jsp:include

  22. 22

    Session validation in Rest-API [java.lang.IllegalStateException: Cannot create a session after the response has been committed]

  23. 23

    java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed at or.apache.catalina.connector.ResponseFacade

  24. 24

    java.lang.IllegalStateException: Cannot perform this operation because there is no current transaction

  25. 25

    java.lang.IllegalStateException: Cannot read while there is an open stream writer

  26. 26

    java.lang.IllegalStateException: Cannot read while there is an open stream writer

  27. 27

    java.lang.IllegalStateException: Cannot perform this operation because there is no current transaction

  28. 28

    java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout : XML

  29. 29

    java.lang.IllegalStateException: Ambiguous mapping. Cannot map method

HotTag

Archive