There is an application on Angular, the backend is an application on Java-Spring.
Both of them are running on a server in a shared network, on a Windows OC machine in VirtualBox (Linux).
The essence of the problem is that when you try to open a web application in a browser, it runs completely on one computer out of five with Windows OC and on one of one on Linux OC.
The browser is everywhere Chrome, only in Linux Mozilla
The application itself is launched, but it does not receive data from the backend at startup.
At the same time I get an error
Failed to load resource:
http://10.151.78.6:5003/es-serv/api/v1/get-data/sh1 net::ERR_CONNECTION_RESET
Here is the controller method that receives requests, there is no call to it in the logs
#GetMapping("/get-data/" + RestApiConstants.VARIABLE_NAME)
public ResponseEntity<ListResponse<DataDto>> getData(
#PathVariable(RestApiConstants.PARAM_NAME_WORD) String name) {
log.info("getData -> start");
return converterDtoService.converterDataDto(name);
}
Moreover, if you just try to open the link in the browser bar
http://10.151.78.6:5003/es-serv/api/v1/get-data/sh1
Then I get the data every time, I have never noticed any failures.
Very similar to the problem with CORS, but then the browser gives a specific error to all requests. Yes, and cors is disabled in the Java application. And even then it is not clear why it still works on some browsers.
It doesn't look like a timeout problem either, because I get an error instantly, and when the server doesn't respond, some time passes and it's noticeable.
And another such moment, I added a forced data reading button to the application. And after 20-30 attempts to read the data, the answer may still come to those computers that did not receive them.
If it was a problem with the network, then it is unclear why on the same computer from the same browser, the GET request typed in the browser line gets answers all the time, without a single pass.
Tell me where to look to understand the reason?
The problem was solved by updating the browsers to the latest version. And before that, the browser version was not very old. I don't understand how this could affect the transmission of the GET request over the network?
Related
I'm using coldfusion.security.NTAuthentication provided with ColdFusion to inteorrgate an active directory setup on a Windows SBS, with the intention of returning the groups a specific user belongs to.
On my development machine, this is working absolutely fine - however on the live machine I'm seeing the following error:
Error in locating groups for user XXX in domain XXX.
The two machines are quite different, but not in any way that I think should matter.
Here's the set up:
Dev machine
Windows 2008
ColdFusion 11 Developer edition
Java 8.0.25.18
Production machine
Windows 2008 R2
ColdFusion 10 Standard edition
Java 8.0.710.15
Active directory machine
Windows SBS 2011
It's worth noting that while these machines aren't identical, both are able to authenticate a user via the authenticateUser() method.
This suggests that the class is functioning and able to connect to the AD server without problems.
I'm also able to use <cfldap> to retrieve information about a user.
Here's some very simple code:
Local.ntauth = createObject("java", "coldfusion.security.NTAuthentication");
Local.ntauth.init('MyDomain');
Local.Authenticated = Local.ntauth.authenticateUser('Username', 'Password'); // Returns 'YES'
Local.Groups = Local.ntauth.GetUserGroups('Username') // Throws error
The issue isn't limited to the GetUserGroups method, a similar error occurs when attempting to use IsUserInGroup.
Can anyone help?
This turned out to be an issue with Windows permissions. (Isn't everything?)
So, something I neglected to mention in the question is that the production server had been secured using the techniques detailed in the CF10 Lockdown Guide.
Part of this procedure involves creating a dedicated user for the ColdFusion service.
It seems that the GetUserGroups function worked if I used the standard 'Local System' user, but not if I used my dedicated ColdFusion user.
With a bit of help from the Process Monitor, I noticed that when the GetUserGroups function is called, a call is made to the Active Directory server to /PIPE/Samr.
When ColdFusion is running with the Local System user, this call is made by NT AUTHORITY\SYSTEM and returns a whole bunch of information - however when ColdFusion is running as the new dedicated user account, the call is made by that account and returns LOGIN FAILED.
Presumably there must be a way of granting the ColdFusion user, which is Local to the server, access to the Active Directory in such a way that a GetUserGroups call is allowed.
I'm not sure how to achieve that, so for now have reverted back to the Local System user, but I may revisit this and update my answer.
I am trying to achieve a TCP connection between a JavaScript client and a java server. (implementation must be this way I cannot swap to node for the server for example ).
Web sockets implmentation in java looked very complicated. I had a look at Jetty and JWebSocket and was quickly scared off. I have no idea what is going on in the source for them. – So I didn’t have much luck implementing a server using them.
So then I looked for websocket alternatives.
I noticed SocketBridge, It seems very straight forwards and offers exactly what I need for my project so I downloaded that.
I created a simple java server that just prints what I receives and sends a string as bytes back. I used the prebuilt JavaSocketBridge and modified the index.html to point to my server. My server recived the message but nothing showed up on the client.
function run(){
socket_connect('localhost', 31113);
socket_send("Hello from JavaSocketBridge applet");
}
I then decided to build the JavaSocketBridge to see if I could debug the read methods. However my build of JavaSocketBridge refuses to connect with the error.
Java Socket Bridge ERROR: Could not connect to localhost on port 31113
Access denied (“java.net.SocketPermission” “127.0.0.1:31113” “connect,resolve” )
(This was in chrome but it happens in firefox too)
So my questions:
Why does my build get a socket permission error?
Why does the client not receive anything even though the example does from google.com:80?
Notes.
My server appears to be working fine. (I have used a simple java client to test it.
I have used java 1.6 and 1.7 to build the JavaSocketBridge)
I have included C:\Program Files\Java\jre7\lib\plugin.jar
My System is Win7 64 and java SDK / JRE is up to date
Edit. Ive gone back to jetty and got a client/server working, however I will monitor this question.
I am building a simple websocket server for Android. (let us, say 3.2 - I tried some earlier Android versions with the same result). Before trying the code on Android, I tested it under Java SE on Windows, Linux. It worked OK with Chrome and Firefox .
However on Android it does not work. Please see the comments in code.
In short:
I successfully pass handshaking and browser confirms that connection is OK.
I happily receive all the messages from the browser via Websocket
I cannot send anything: It just does not get to the javascript callback.
After some retries (sometimes immediately) the browser closes websocket.
Here is the code:
//BufferedOutput myout=new BufferedOutput(mysocket.getOutputStream()));
//myout was successfully used for handshaking before
String msg=”I want to send this”;
try {
myout.write(129);//129=0x81); text frame 0x81=129
int payloadlen=msg.length();
myout.write(payloadlen);
byte[] bts=msg.getBytes(Charset.forName("UTF-8"));
myout.write(bts,0,payloadlen);
myout.flush();//after this command client Browser closes websocket
//firefox also gives error
}
catch(IOException ee)
{
System.out.println("Error sending websocket message"+ee);
try{myclose();}catch(IOException eio){}
}
}
Thank you
Where are you running this code? Inside an Activity or in a Service.
Notice that if you need to create your one customized Web Server and need to run it on Android you should implement it as a Service running on it own thread.
If you are running it on an Activity depending of the android version, the main thread should not (or can not, depending of the android version) perform I/O operation on the main thread.
I hope it helps.
I solved it. The reason was that in case of Android, I was sending something BEFORE via the SAME connection. And this "something", though was wrong, somehow did not produce any error in Chrome/Firefox. It took me two days and byte-to-byte comparison Wireshark results for both cases: my Sun Java Websocket Server and my Android Websocket Server.
I am facing a terrible problem with java Netbeans.
Each time I run my sendmail function used for registration successfully, which means that
1. my database is successfully updated with the new user;
2. email is successfully sent to designated recipent,
I will need to restart my glassfish after each run before I could do another registration with the function of sendmail.
If I don't restart my glassfish and do another registration, everything goes fine with the database (updated with no issues), however the mail does not get sent at all.
So in short, my sendmail could only work once, and would require restarting glassfish before another sendmail can be done.
Any java/netbeans gurus can help? Greatly appreciate!
http://www.vipan.com/htdocs/javamail.html
Perhaps you can run in debugging mode and post your log entries. Need more information on what happens after your first email is sent.
Really strange issue has been occurring lately with two legacy Struts applications running on separate RedHat 5/Tomcat 6 servers. Some brief details:
App 1 is the front-facing application
App 2 is an ancillary application which serves as a file repository system
App 1 has an upload form which forwards to App 2
App 2 expects multipart/form-data to be part of the Content-Type when an upload occurs
Uploading will work fine for a while, but will all of a sudden fail. When I look in the logs, App 2 is reporting that the Content-Type is missing and as such, cannot process the upload request. Furthermore, once it goes missing, it doesn't reappear. All attempts to upload will fail from that point forward and what's even more odd is that the only way to remedy the issue is to restart Tomcat hosting App 1, not App 2.
Other Oddities
Code that implements the upload feature has not changed in over a year
Using Wireshark (tshark) to sniff TCP packets
The Content-Type properly populated on the HTTP Request being sent from App1
Although Wireshark reports a malformed packet, the Content-Type is present on the HTTP Request received on App2
Any ideas why this could be happening?
I would suspect there is some sort of state change on App1 which is causing it to no longer user the Content-Type header in requests to App2. Without seeing the code there is little more that anyone could tell you.