I followed this tutorial to build a spring websocket application. I've kept each file as it is but I'm neither using maven nor gradle. I run the index.html file on the tomcat server. When I click connect I get:
Opening Web Socket... GET http://localhost:8080/hello/info 404 (Not
Found) Whoops! Lost connection to undefined
in my Chrome's Developer window.
Why is this happening?
link may help. here I have given whole example.
for this you will require stomp.js, sockjs on your client side
and spring-websocket & spring-messaging 4.2.6.RELEASE jar in your server side,
Related
While working through a programming book, I implemented a local REST service running in Tomact on port 8081 in the folder webapi (http://localhost:8081/lwchapter1/webapi/user/login). When running a request in Postman I get an error:
Could not send request
Error: connect ECONNREFUSED 127.0.0.1:8081
I dont understand, how to debug this and therefore kindly ask for help!
The service is implemented (as far as I understand) like this:
Postman to test the API
Tomcat to provide the service
compiled War File
maven as a build tool
java class listening for POST requests in a specific folder
The java project compiles, undeploy/ deploy works and the war file is in the tomcat folder, tomcat is running.
Edit: I found a developer console in Postman giving additional information. Unfortunately this doesn't help either since there is no parameter in the request:
Could not find on r. Missing or invalid parameter.
No revision id found for response
I found the solution by:
checking which ports are open and listened by using
netstat -a -n -p tcp | grep 127.0.0.1*
in the terminal
understanding in which folder the REST service listens by checking the actual java program
Thanks to #MattVickery for your kind help, I really appreciated it!
We have a Java web application at http://ourapp.com hosted at Heroku and the frontend of the app cannot connect to the WebSocket endpoint (endpoint) running in a Heroku dyno. We have tried these URIs:
ws://ourapp.com/endpoint
ws://ourapp.com:80/endpoint
ws://ourapp.com:8080/endpoint
ws://ourapp.com:8084/endpoint
ws://ourapp.com:443/endpoint
wss://ourapp.com/endpoint
wss://ourapp.com:80/endpoint
wss://ourapp.com:8080/endpoint
wss://ourapp.com:8084/endpoint
wss://ourapp.com:443/endpoint
None of the above open a connection. What are we missing here?
PS: I have set up a test ground: http://vakuutustiedot-dev.herokuapp.com/websocket.test.html (the URI is PROTOCOL:vakuutustiedot-dev.herokuapp.com:PORT/trial)
The target app runs in a Heroku Apache Tomcat 8.5.38.
What comes to the port number, I am not sure how to get one.
Perhaps you have missed adding the support of WebSockets to Heroku, like in this answer (https://stackoverflow.com/a/50002416/11197115)?
Maybe you should try configuring the proxy attribute of devServer. This attribute is used when the frontend app and backend api are not running on the same host. Perhaps the below setting might solve your problem.
module.exports = {
devServer: {
proxy: 'ws://ourapp.com:8080/endpoint'
}
}
For more info see the docs: https://cli.vuejs.org/config/#devserver
My company’s web application is using GWT both for front-end and back-end and we’d like to remove GWT from the project. Our current objective would be to make a new login page in Angular2 using the existing GWT back-end.
The main problem we encounter at the moment is that all the requests coming from outside the current GWT front-end seem to be intercepted/blocked and don’t return anything. I’m currently using Postman to make GET requests from the server.
Here is the URL I’m calling : http://localhost:9997/RestServer/api/users/1.
Postman’s response:
« Could not get any response
There was an error connecting to http://localhost:9997/RestServer/api/users/1. »
GWT Development Mode’s console returns an error:
[TRACE] Connection received from 127.0.0.1:60296
[ERROR] Unrecognized command for client; closing connection
com.google.gwt.dev.shell.BrowserChannelException: Invalid message type 71
at com.google.gwt.dev.shell.BrowserChannel$Message.readMessageType(BrowserChannel.java:1135)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:248)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Thread.java:745)
Have you got any idea why my requests are intercepted? Why I can't even receive a http response?
If you need more informations to answer just ask for it.
Port 9997 in the old dev mode is not an HTTP server. This is the port on which the legacy browser plugin (unsupported in modern FF and Chrome due to breaking changes in those browsers) would connect to run Java code and enable remote debugging, hotswapping, etc.
Instead, you need to connect to the HTTP port, which is 8888 or 8080 or something like that.
I am running my java web application on glassfish server v4.1 in netbeans v8.0.2, using sqljdbc42 and this connection code-
Connection connection;
String url = "jdbc:sqlserver://localhost:1433;databaseName=Lista;integratedSecurity=true";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection = DriverManager.getConnection(url);
When i open my ide and run my project for the first time the glassfish server starts automatically since my project's server is glassfish, and i can perform any crud operation with my Ms-Sql server2012.
But the problem starts when i make changes in any file keeping the server on and run the project again and try to perform any crud operation i get this following error-
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not
configured for integrated authentication
But if i stop the server before changing any file and start after changing and run the project then it works without any error.
Stopping and re-starting the server again and again taking so many times from my total project time! Any help or suggestion will be appreciated.
Thank You.
I solved my problem!
The error (described in my question above) i was getting because the glassfish server had not any access on sqljdbc42.jar file. so i have placed the sqljdbc42.jar file into my glassfish server in this location-
glassfish-4.1\glassfish\domains\domain1\lib.
And it's now working perfectly.
Thank you everyone!
I have an AIR application that uses remote objects to communicate with the server. It works perfectly when the application connects to my localhost server. But as soon as I change the url to point to a remote test server, I get the following error:
fault.message: faultCode:Client.Error.MessageSend faultString:'Send failed'
faultDetail:'Channel.Connect.Failed error NetConnection.Call.Failed: HTTP:
Failed: url: 'http://remoteserver:80/app/messagebroker/amf''
fault.name: Error
fault.faultcode: Client.Error.MessageSend
fault.faultstring: Send failed
fault.faultdetail: Channel.Connect.Failed error NetConnection.Call.Failed: HTTP:
Failed: url: 'http://remoteserver:80/app/messagebroker/amf'
What might cause this error? My local server is a glassfish 3.1, the remote one uses apache for load balancing in front of a glassfish.
When I navigate in the browser to the url of amf channel, it displays a blank page (which is fine).
I have also noticed that when I use tcp/ip monitor from eclipse, (I change the url to point to some port on localhost; tcp/ip monitor forwards the request to the remote server), the application works fine, no error occurs. Still, it appends a jsessionid to the url.
How can I resolve this issue?