RMI connection in javafx standalone application - java

I have the following problem with my javafx application:
I'm using RMI to connect client app to server, and everything goes fine, until I run application in web browser or standalone mode. In this case, RMI doesn't work properly, but don't throw any exceptions. I cant send any message to server. Problem disappears when I run program in IDE or by clicking on jar file.
I think, that it can be connected with some browser privileges, and application launched in that context probably doesn't have access to network adapter.
Any ideas how to fix that?
EDIT: There was an exception that was invisible for me: java.net.SocketPermission. So as I thought, access to socked is denied. What is the solution to this problem?

An unsigned applet can only connect to the host it was loaded from. So, either change your topology or sign the applet.

Related

Error 401 when restart springboot application

I have an application run on port 8082, config to working with spring security and keycloak (keycloak-springboot-2-adapter, spring-boot-starter-security, ..) And run the standalone keycloak server on port 8080.
Everything working well, but I meet an issue like that:
When I call a web-view by chrome to application 8082 without logging before, the request will be direct to login-page by keycloak manage (I'm using credentials), after I login success and go to the web-view have a button generate random string on the screen.
Stop here and then I restart the application on 8082 (server keycloak still running on 8080). when the application restarts success, I try to click on the button to make an AJAX request to application (api generate random string), but ajax response an error 401 Unauthorized and I don't see any error or exception on both application or keycloak server, just show on console of chrome like that
If I reload the page and click button again or open link error in console with new tab will return the random string I want. The important thing is I still logging and call another webview success.
If instead restart application 8082 I restart keycloak server and do everything as above again so the button still working well
I hope you can help me to find out the problem. Sorry for my English if you feel hard to understand my question because english isn't my native language.
Thank you very much for reading!

Java windows Service starts a new process but I'm unable to see it (although it's present on Task Manager)

I have a java app (which I made windows service using nnsm) that sets up sockets on localhost. When a message is received by that app it opens internet explorer.
When I run the app using cmd (e.g java -jar myServer.jar) it works as expected. An internet explorer instance starts.
When the app is being set up as a windows service and receives a message, it opens internet explorer but I'm unable to see it (although it is visible in Task Manager).
I want the process to start on the local system and be able to see it and interact with it
Any help or idea would be much appreciated.
Thanks

Java web start security issue

I'm having a strange problem. I have a Java application which I want to run using Java web start. This Java application is signed by a trusted authority (digicert) certificate. When I deploy my application to my local glass fish 4.1 server and run the Java I get the dialogue "do you want to trust ....). So far so good. When I deploy the exact same app to a glass fish server hosted on a remote machine (Amazon instance) and attempt to run the Java web start app, I get. "This application is blocked" message, as if the Java app is not signed. What is the cause of this behavior? My remote server uses ssl connections, but even when I specify http in the jnlp I get the same problem (my server listens to both http and https). This has been driving me crazy for three days now. Please help.
There are other hoops to jump through. You need a permissions applet
tag, and the main jar has to have a matching permissions line, and
a codebase line compatible with the site being loaded from.
All the jars have to be listed in the jnlp.

How to run external application from a Java EE web application?

I have been working on a Web Application for Intranet use only. I work with Apache 7 and Windows Server 2003.
In one of my page, I need to open an external application that we can locate in C:/Program Files/etc... with some parameters already initialized. Of course, the user has to use the web application on the server to make it work (that will be the case).
To open the application, I use the ProcessBuilder object.
The problem:
When I work locally with Eclipse and run the server by hand, it works perfectly. Any application can open itself from a web page.
But when I use the tomcat windows service (and that's what we want to use on the server), it just never launches. Or to be more specific, it launches and stops the application directly. No java errors thrown and process.waitFor() with an exit value of 0. The fact is that we can run processes via the web application (I tried to run simple batch files), but when there is an UI involved, it will never appear.
Again, on the server this time, if I launch tomcat7.exe (that we can find in the %CATALINA_HOME%/bin directory) with a double click or cmd, the UI in the web application will appear. If I launch it with services.msc or tomcat7w.exe or tomcat7 start via cmd, it will not.
I thought of several things:
use another user to start the service
change the way the service is launched (StartMode: jvm, java. I did not succeed with exe)
I read Tomcat 7 Windows Service How-To many times but didn't find out anything to solve my issue.
Have you any idea of what is happening, and how to solve this issue ?
What is the big difference between running tomcat as a service and from the command line?
Option 1
If you open your service's properties window, go to the Log On tab then check the "Allow service to interact with desktop" check box you will get the behavior you want. Also depending on what app you what to run you may need to change the log on account.
see Launching GUI App from Windows Service - Window Does Not Appear
Option 2
Did you try start a cmd and there use
start /c "c:\path to\exe"
in cmd.exe type
help start
Option 3
You will need a daemon service that is not run as a service. windows puts certain restrictions on service apps.
This sleeping app can be started by tomcat or other your self. it can listen on a port or poll a folder for a new file, and when it gets a job to do it starts the app you want. Via port or text file you can send the parameters.

Connection Error: javax.microedition.io.ConnectionNotFoundException:TCP open

I posted this error here cuz it has been disturbing me for long time whenever i try to connect to my web api from my j2me application.I just would like to share this if somebody has same problem as me.
When this error happened to me, it was because my web server (tomcat) was not running. Make sure that your web server is up and running then try again.
my solution to this error is i changed in host file which is located at C:\Windows\system32\drivers\etc\ and i opened the ip that i m trying to call.
the other attempt i did if this one is not working is check the instances whether they are already run or not. This is also one option which really did solve the TCP open error.

Categories