I'm struggling to run grizzly-websockets-chat. I've successfully compiled the sample. HttpServer.createSimpleServer is running and serving a test index.html on localhost:8080. WebSocketEngine.getEngine().register("/chat", chatApplication) executes without complaint. However, localhost:8080/chat returns "Resource identified by path '/chat', does not exist.". This is not under Glassfish - just standalone Grizzly/2.2.19.
Comments in some places suggest that websocket support is off by default - I'm unable to determine how to turn it on outside of Glassfish. I have only the test index.html in docroot.. is anything else required?
I'm not running anything special on the client side - no js, nothing. I've not seen any such thing in the sample. Surprisingly, I've not found a good doc or running example. Maybe is a user problem? ;/
Looks like websocket code may be being invoked:
$ java -jar ./tyrus-client-cli-1.1.jar ws://localhost:8080/chat
# Connecting to ws://localhost:8080/chat...
# Failed to connect to ws://localhost:8080/chat due to Handshake error
Any help much appreciated!
Change your request URI to ws://localhost:8080/grizzly-websockets-chat/chat.
The ChatApplication has the following defined for isApplicationRequest():
#Override
public boolean isApplicationRequest(HttpRequestPacket request) {
return "/grizzly-websockets-chat/chat".equals(request.getRequestURI());
}
Related
I have a blazor web assembly app and I have 3 projects that were created. The client, server and shared. I assume all of these are deployed as standard when using the webdeploy?
The site works in that it displays the pages etc. However when I go to a page that contacts the server project via the Http.PostAsJsonAsync() method, I get the blazor error page (which I setup to say "oops").
Obviously I get no details as to what is going wrong. So I have no idea what is happening. Is the server app compiled into the Web assembly app? If so why would it not be running the server code? Plus I suppose the other question is how do I get it to report the error so that I can get an idea as to what is going wrong?
It works absolutely fine when running it through Visual Studio.
This is the first time I have deployed to a hosted server so there is a very high chance I have done something wrong...
The method I am calling literally does nothing other than returning a 200 message. So I assume the issue is with calling the server method itself.
Firstly, use Logging:
https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/logging?view=aspnetcore-5.0&pivots=server
#inject ILogger<MyComponent> Logger
Then wrap your Http.PostAsJsonAsync() call in a Try Catch block.
Log the error in the Catch block:
try
{
await Http.PostAsJsonAsync()
}
catch (Exception e)
{
Logger.LogError(e);
}
After deployment, edit your web.config file:
<aspNetCore processPath="dotnet"
arguments=".\Hospitillity.App.Server.dll"
stdoutLogEnabled="true" // <<< MAKE THIS true
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess">
Note, the setting stdoutLogEnabled="true". This will cause your hosting provider to generate log files.
Then recycle your app pool on your hosting provider.
Connect to your website again, and after the error you should have some more details about error logged in
\logs\stdout_nnnnnnnnnnnnnn_nnnnnn.log
on the hosting server.
Take it from there ...
I have an ASP.NET Core MVC application hosted on Google Compute Engine, and when I check the logs, it seems that www.mysite.com/home/index is constantly being requested even though I am not searching that URL in my browser and nobody else knows the actual URL. Why is this? I am concerned that it may be interfering with some of my processes.
I am running the app on Windows Server 2016 and I often Remote Desktop into it. Could either of these be the reason behind the logs I am getting?
{"#t":"2019-01-01T09:37:24.4301536Z","#m":"Request starting HTTP/1.1 GET http://10.142.0.4/ ","#i":"ca22a1cb","Protocol":"HTTP/1.1","Method":"GET","ContentType":null,"ContentLength":null,"Scheme":"http","Host":"10.142.0.4","PathBase":"","Path":"/","QueryString":"","HostingRequestStartingLog":"Request starting HTTP/1.1 GET http://10.142.0.4/ ","EventId":{"Id":1},"SourceContext":"Microsoft.AspNetCore.Hosting.Internal.WebHost","RequestId":"0HLJFPIU5NJ9V:00000001","RequestPath":"/","CorrelationId":null,"ConnectionId":"0HLJFPIU5NJ9V"}
{"#t":"2019-01-01T09:37:24.5299320Z","#m":"Route matched with \"{action = \\\"Index\\\", controller = \\\"Home\\\"}\". Executing action \"TelebotApplication.Controllers.HomeController.Index (TelebotApplication)\"","#i":"a44c0341","RouteData":"{action = \"Index\", controller = \"Home\"}","ActionName":"TelebotApplication.Controllers.HomeController.Index (TelebotApplication)","EventId":{"Id":1},"SourceContext":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","ActionId":"dc996f72-2933-4b90-9a5e-ccbfe11d91ba","RequestId":"0HLJFPIU5NJ9V:00000001","RequestPath":"/","CorrelationId":null,"ConnectionId":"0HLJFPIU5NJ9V"}
{"#t":"2019-01-01T09:37:24.5405482Z","#m":"Executing action method \"TelebotApplication.Controllers.HomeController.Index (TelebotApplication)\" - Validation state: Valid","#i":"dad538d7","ActionName":"TelebotApplication.Controllers.HomeController.Index (TelebotApplication)","ValidationState":"Valid","EventId":{"Id":1},"SourceContext":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","ActionId":"dc996f72-2933-4b90-9a5e-ccbfe11d91ba","RequestId":"0HLJFPIU5NJ9V:00000001","RequestPath":"/","CorrelationId":null,"ConnectionId":"0HLJFPIU5NJ9V"}
{"#t":"2019-01-01T09:37:24.5441766Z","#m":"Executed action method \"TelebotApplication.Controllers.HomeController.Index (TelebotApplication)\", returned result \"Microsoft.AspNetCore.Mvc.ViewResult\" in 0.4835ms.","#i":"50a9e262","ActionName":"TelebotApplication.Controllers.HomeController.Index (TelebotApplication)","ActionResult":"Microsoft.AspNetCore.Mvc.ViewResult","ElapsedMilliseconds":0.48350000000000004,"EventId":{"Id":2},"SourceContext":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","ActionId":"dc996f72-2933-4b90-9a5e-ccbfe11d91ba","RequestId":"0HLJFPIU5NJ9V:00000001","RequestPath":"/","CorrelationId":null,"ConnectionId":"0HLJFPIU5NJ9V"}
This seems to pretty much repeat itself endlessly.
Thanks
when I check the logs, it seems that www.mysite.com/home/index is constantly being requested even though I am not searching that URL in my browser and nobody else knows the actual URL
For this issue, it is caused by Health checking you configured in the GCP.
The issue I am facing, is occassionally, public static void
Main(string[] args) is re-entered without my instruction.
For this issue, it is usually caused by the application recycling. Exceptions in request would not make application recycling.
I am fairly new with using Selenium in my Ruby script. Basically my script will make a get request to some url and log in. However my script is failing to send the email and log in automatically due to the Google Chrome pop up about insecure content blocked since one of the images on the page is using http and not https.
I was able to run the script successfully months ago however just recently when trying again, it is unable to proceed with logging in so I dont know why it stopped working all of a sudden.
The error that I see in terminal is this. In irb, I can go through each line of code successfully including using Selenium's "send_keys" and "click" to automatically sign in.
[2018-09-26T13:02:55.002527 #14131] INFO -- : [#http://company.com/favicon.ico'. This request has been blocked; the content must be served over HTTPS.">]
web_app.rb:54:in `': Console Errors Found! (Exception)
I tried searching for some solution but have been unsuccessful. There has been some variations of responses to similar problem but not too much luck with getting it to work.
Any feedback on how to fix would be appreciated.
start Chrome manualy and disable the warning - https://www.thewindowsclub.com/disable-insecure-content-warning-chrome
and use the set browser profile, there is my setup:
#BeforeClass
public static void setUpClass() {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\pburgr\\Desktop\\chromedriver\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:\\Users\\pburgr\\AppData\\Local\\Google\\Chrome\\User Data");
driver = new ChromeDriver(options);
driver.manage().window().maximize();}
Good day all, I tried connecting to the back4app back end service using the new parse4cn1 lib .....I supplied the keys required but my app could not connect to the backend for some strange reasons.kept reporting (unable to connect to back end.........codename one revisions some long numbers)
Some help or direction will be appreciated.Thanks all
What keys are you using? You need to pass your App Id and Client Key to parse4cn1. I just ran the regression tests against back4app and I didn't get any connection error. Can you provide more details (e.g. a dump) of the error you're getting?
Where are you putting your Parse.initialize? Just went for some digging on parse4cn1 and it seems that it needs to be inside a "initVars" function, usually created within a state machine as you can see in the example below:
public class StateMachine extends StateMachineBase {
/**
* this method should be used to initialize variables instead of
* the constructor/class scope to avoid race conditions
*/
protected void initVars(Resources res) {
Parse.initialize(API_ENDPOINT, APP_ID, CLIENT_KEY);
}
}
Maybe that can help you on this connection issue. Also check the link below (A very useful guide) for further info:
https://github.com/sidiabale/parse4cn1/wiki/Usage-Examples
If Grizzly with a StaticHttpHandler is running, and a request is made to a static file (example index.html), then that file becomes locked. That is, it is impossible to edit and save index.html while Grizzly is running.
There's any solution or workaround to be able to save currently served static resources?
A possible workaround is to disable the FileCache.
HttpServer server = HttpServer.createSimpleServer();
server.getNetworkListener("grizzly").getFileCache().setEnabled(false);
If that doesn't help, I would suggest you log an issue so we can try to address it.
I couldn't find the server.getNetworkListnener method in Grizzly 2.3.16, so it worked for me when I did:
HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(baseUri), rc);
StaticHttpHandler staticHttpHandler = new StaticHttpHandler("docRoot");
staticHttpHandler.setFileCacheEnabled(false);
server.getServerConfiguration().addHttpHandler(staticHttpHandler);
I struggled with this for a while. The posts above work, but only if done after the server is started.
The server turns file caching back on when you start it, if you set it to false before it is running. Make sure to turn it off after you call server.start() as shown here.
It appears the Jersey 2.3.17 / Grizzly HttpServer turns caching on when you call
server.start();
despite setting it to false prior to starting it.
server.start(); // turns file cache back on
handler.setFileCacheEnabled(false); // turn it off again
// get every NetworkListener and set it to false (as these will also lock files)
for (NetworkListener l : server.getListeners()) {l.getFileCache().setEnabled(false); }