Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Error on redirect from another application


Error on redirect from another application


I am trying to redirect my request from another application (J2EE) to a Thingworx Portal created by us.

I have added the following in the URL as well :  appKey=4865d586-a267-4e52-bc63-7d97c2757412&x-thingworx-session=true

But on the first first hit it gives an error page (401 unauthorised) and if I refresh the page the URL is picked up and gets me into the application.

Could you please advise the possible problem. Do I need to make some configuration changes.

I am using Thingworx 5.0.x and on 64 bit.

I am attaching the access logs as below:

Error Log - - "GET /Thingworx/Mashups/ValidateWelcomePage?appKey=90dc2dea-6506-472c-8dd1-88a342cbbd1d&x-thingworx-session=true HTTP/1.1" 401 1149

Correct Page Access Logs - - "GET /Thingworx/Mashups/ValidateWelcomePage?appKey=90dc2dea-6506-472c-8dd1-88a342cbbd1d&x-thingworx-session=true HTTP/1.1" 302 - - - "GET /Thingworx/Runtime/index.html HTTP/1.1" 304 - - - "POST /Thingworx/Subsystems/PlatformSubsystem/Services/GetAllStyleDefinitions HTTP/1.1" 200 169475 - - "POST /Thingworx/Subsystems/PlatformSubsystem/Services/GetAllStateDefinitions HTTP/1.1" 200 18612 - - "POST /Thingworx/Resources/RuntimeLocalizationFunctions/Services/GetEffectiveTokens HTTP/1.1" 200 11450 - - "POST /Thingworx/Resources/CurrentSessionInfo/Services/GetGlobalSessionValues?Accept=application%2Fjson-compressed&Content-Type=application%2Fjson HTTP/1.1" 200 3881 - - "POST /Thingworx/Resources/CurrentSessionInfo/Services/GetCurrentUserExtensionProperties?Accept=application%2Fjson-compressed&Content-Type=application%2Fjson HTTP/1.1" 200 2321 - - "POST /Thingworx/Resources/CurrentSessionInfo/Services/GetPersistentValue?Accept=application%2Fjson-compressed&Content-Type=application%2Fjson HTTP/1.1" 200 34 - - "POST /Thingworx/Resources/CurrentSessionInfo/Services/GetPersistentValue?Accept=application%2Fjson-compressed&Content-Type=application%2Fjson HTTP/1.1" 200 12

The URL is same in both the cases. All I am doing is pressing F5 after the first 401 unauthorised failure.

Kindly advise



5-Regular Member

Hi Saurabh,

Have you tested this programmatically? We've noticed some weirdness when using a web browser to make these calls that you don't see when making them programmatically.

– Adam


I am trying to call the URL from a Spring Web application deployed on the same server.

I am using a redirect to hit the URL from the Spring. 

Also, I tried to use the below mentioned code snippet. But I a still getting 401 error.

 try {


       HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();





       int responseCode = connection.getResponseCode();

       return (200 <= responseCode && responseCode <= 399);

   } catch (IOException exception) {

       return false;


Top Tags