I have a locally working JAVA RMI Applicaton(Server & Client).
I have used Eclipse & a plugin(Genady) to write & run these applications.
There are three parts in my project:
1. Server
2. Interface(Common for both client & server)
3. Client
Local deployment, using Eclipse(+plugin), works perfectly. The client uses the common interface(added to the "Build Path") to communicate(to n fro) with the server(which also has the common interface added to its Build Path in eclipse).
And now, I'm planning to test the same system in two different computers, both having Internet connection.
What do I do now?
Should I be installing Apache on one computer(Server) & put the Server+Interface files(class-files) into the web-accessible directory? & then run the Client-files(having both client & interface class files) from another computer(Client)??
Can someone help me configure this? I mean, a step-by-step guide as to what I should be doing in order for the remote deployment to work?
Is using Apache(or any web server application) compulsory?? Any other alternative for my application to work without using a web server(I mean, like direct connection or something?)?
(I feel I've given all the info that is required. But if any more info is needed, please ask.)
This is my final year project & my final demo is coming up soon!
Thank you, in advance!
I don't know what Genady does since I rarely use Eclipse.
Developing RMI applications is very easy anyway.
Pack the server code and run it on the remote machine (the R in RMI)(a.k.a. server host), it should register itself with the Registry which by default uses port 1099 but you can create a registry in any port you like:
MyRemoteInterface stub = (MyRemoteInterface) UnicastRemoteObject.exportObject(server, 0); //I don't know if this is needed anymore, or you could make the "server" extend UnicastRemoteObject
int thePortUsedInTheServer = 1099; //default
Registry registry = Registry.createRegistry(thePortUsedInTheServer);
registry.rebind("Server", stub));
Pack the client code and run it on the client(s) (the M+I in RMI), it should locate the Registry in the remote machine (host+port):
String host = ...; //the host where the server is
int port = ...; //the port used in the server
Registry registry = LocateRegistry.getRegistry(host, port);
MyRemoteInterface stub = (MyRemoteInterface)registry.lookup("Server");
stub.myRemoteMethod(); //call your remote methods
The javadoc should help you out. Nothing else is required, no Apache, etc. Watch out for aggresive anti-virus software, firewalls, and the like. Those are the only real issues after you get the gist of it.
Related
So apologies if what I ask is trivial but I am experimenting with Memcached and Jmeter. I have a Memcached server setup (as far as I can tell) and am able to make telnet requests to it via telnet IP PORT and additionally set and get using commands set and get appropriately.
Now point me to a different application if perhaps this is the wrong choice; but my understanding was that Jmeter should allow me to pound the server with equivalent Set and Get requests.
Unfortunately the experimental platform is a remote linux PC running Rockylinux which is similar to CentOS / RedHat to my understanding (I didn't set this part up); and as a result I do not have a GUI to launch while on the Linux PC. I have however opened Jmeter up on my local PC on windows and understand I should be able to send the test file over and run it.
I followed these instructions to try to setup a TCP sampler and set the "text to send" field as below; after doing the additional step in the link regarding the precompiler.
set tutorialspoint 0 900 9${CR}${LF}
memcached${CR}${LF}
quit${CR}${LF}
Running the above as a headless jmeter session doesn't generate any errors called [./jmeter -n -t "Sample.jmx" -l testresults.jtl"] but when I connect via telnet I'm also not seeing the value for the key "tutorialspoint" get updated. When manually doing the get and set I am seeing updates. Any ideas what I could be doing wrong? Checking the log indicates ResponseCode 200 OK as expected. Is there a good method to debug something in a Headless setup?
Thanks for your time.
I believe the easiest way is using Memcached Java Client library
Download spymemcached-2.12.3.jar and drop it to "lib" folder of your JMeter installation (or any other location in JMeter Classpath)
Restart JMeter to pick the .jar up
Add JSR223 Sampler to your test plan and use the following code snippets:
def client = new net.spy.memcached.MemcachedClient(new InetSocketAddress('your-memcached-host', your-memcached-port)) - for connecting to the server
client.set('tutorialspoint', 900, 'memcached').done to write memcached to the tutorialspoint key for 15 minutes
client.get('tutorialspoint') - to read the value of tutorialspoint key
client.shutdown() - to disconnect
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
Demo:
I am trying to connect to an OPC server of a Siemens S7 1200 PLC. For this I used the Matrikon application
That is configured on my local machine. With the JeasyOPC library I can make the connection, so it is like this:
JOpc jopc = new JOpc("localhost","Matrikon.OPC.SiemensPLC.1","JOPC1");
JOpc.coInitialize();
But this library can only be used in Windows and has problems when compiling binaries in 64.
So I have tried with OPC Foundation UA JAVA Legacy and I would like to make the same connection, however in the examples we ask for many more things:
String publicHostname = InetAddress.getLocalHost().getHostName();
String url = "opc.tcp://localhost:102/"; // ServerExample1
// String url = "Matrikon.OPC.SiemensPLC.1"; // This not work for me
EndpointDescription[] endpoints = myClient.discoverEndpoints(url);
I would like to emulate the operation of jeasyOPC as far as possible, in any case I can not find any example that works for me.
I would appreciate any example that would help me have a base client that would work with the Matrikon server
Thank you.
Okay. I answer to myself.
After many searches I have found my error:
There are two types of OPC: DA and UA.
The first of all (the DA) is to which I could connect with:
JOpc jopc = new JOpc ("localhost", "Matrikon.OPC.SiemensPLC.1", "JOPC1");
This version of the protocol is the one used historicaménte windows, uses COM libraries and can only be implemented under a Windows computer.
The second, the OPC UA, is the new implementation and connects like this:
String url = "opc.tcp: // localhost: 102 /"; // ServerExample1
This version is already compatible with Windows, Linux and any system that is capable of running the libria.
The problem was that, in my case, the S7 1200 only uses OPC DA, which made the UA option unfeasible for me if it did not use a compatible gateway.
I hope this information will help someone who is in my situation.
Greetings.
I am trying to connect opc kepware server through a Java program, I want to know what jar files can be used to connect to KepwareserverEx.V5 and what is the code without the use of password and username.
I have referenced http://www.opcconnect.com/uakit.php, and https://github.com/digitalpetri/ua-server-sdk, but it doesn't have anything that doesn't connect without a username and a pawssword. I have a program in vb that connects to kepware using Interop.OPCAutomation.dll file and uses the code:
ConnectedOPCServer = New OPCAutomation.OPCServer
ConnectedOPCServer.Connect("Kepware.KEPServerEX.V5", "")
ConnectedGroup = ConnectedOPCServer.OPCGroups.Add("MPM Group")
ConnectedGroup.UpdateRate = 1000
ConnectedGroup.IsSubscribed = True
ConnectedGroup.IsActive = True
I want to write Java code in a similar way. Searched through the internet to see various examples, but none have the above connection without a username and password not being specified.
First of all, I assume that you have created an "anonymous" and "SecurityPolicy.None" endpoint on KepServerEX.
You refer to digitalpetri's old and server SDK. The new project is called "Milo". I can recommend you take a look at the Milo project's client SDK examples using this link. There is an application of anonymous identity and none security policy.
In terms of jar, you can either build your client-sdk (see example here) or directly download the client-sdk jar from Maven Central.
NB Milo is considered to be in incubation. That is to say, it is not mature yet. Be careful using it in production systems.
Yes that's right. The security policy is none on the KepwareServerEX. I made some permission changes on the server where Kepware exists, so that my localhost computer would be able to talk to the Kepware server host. Provided credentials for my localhost, and able to connect.
I am trying to setup an application server for AWS Lambda but on a local network so that an application won't have to go out to the internet to execute. I would prefer to use a linux box and my programming environment is Java.
The skill from the echo will execute and then communicate with the local server rather than going out to the internet and communicating with Amazon's application server.
My question is this: How do I setup the application server to handle the skill? I've done the example from Amazon, do I only need to have the linux box run the Java application or is there more to the setup than that? I see there are AMIs (Amazon Machine Images) but can I deploy those locally or are they only for use on the AWS console?
Any insight into this would be great, thank you.
So this is how usual interaction between echo works:
User--->Echo--->Skill--->(Internet)Applicaton server (I'm using Amazon hosted AWS lambda)
I would like to use :
User--->Echo--->Skill--->(LAN)Application server (without ever using the internet).
Currently I have setup echo and a skill but no application server on the LAN. What do I need for the application server? JAWS and something else?
I'm not sure if this question is still relevant or not, but I'm using DEEP Framework to test the code locally and/or deploy it on AWS Lambda. Check this out:
npm install deepify -g
deepify run-lambda --help
run-lambda#1.6.8 - Run Lambda function locally
Usage example: deepify run-lambda path/to/the/lambda -e='{"Name":"John Doe"}'
Arguments:
path: The path to the Lambda (directory of handler itself)
Options:
--event|-e: JSON string used as the Lambda payload
--skip-frontend-build|-f: Skip picking up _build path from the microservices Frontend
--db-server|-l: Local DynamoDB server implementation (ex. LocalDynamo, Dynalite)
--version|-v: Prints command version
--help|-h: Prints command help
Also, you might want consider using the server option:
deepify server --help
server#1.6.9 - Run local development server
Usage example: deepify server path/to/web_app -o
Arguments:
path: The path to the Lambda (directory of handler itself)
Options:
--build-path|-b: The path to the build (in order to pick up config)
--skip-frontend-build|-f: Skip picking up _build path from the microservices Frontend
--skip-backend-build|-s: Skip building backend (dependencies installation in Lambdas and linking aws-sdk)
--skip-build-hook|-h: Skip running build hook (hook.build.js)
--port|-p: Port to listen to
--db-server|-l: Local DynamoDB server implementation (ex. LocalDynamo, Dynalite)
--open-browser|-o: Open browser after the server starts
--version|-v: Prints command version
--help|-h: Prints command help
Disclosure: I am one of the contributors to this framework
I am using the basic RMI-based client/server app shown in Java Tutorials. I am running the server and client on different machines. I also export the remote objects for both the server and client, and make them available to each other.
However, there is a firewall turned on the client side and so the RMI calls fail (from client to server or server back to client). Also, when the machine has Windows 7 instead of WindowsXP, just allowing the popup message from firewall makes everything run fine. Somehow, the same does not happen on WindowsXP.
I have looked at http://download.oracle.com/javase/6/docs/technotes/guides/rmi/faq.html#firewall mentioned in other similar questions and I am trying the fixed port approach (where in remote object listens on a fixed port).
The code is something like this:
Server
Compute engine = new ComputeEngine();
Compute stub = (Compute) UnicastRemoteObject.exportObject(engine,1299);
Registry registry = LocateRegistry.createRegistry(1299);
registry.rebind("Compute", stub);
Client
String host = "192.168.x.y";
Registry registry = LocateRegistry.getRegistry(host, 1299);
Compute comp = (Compute) registry.lookup("Compute");
Pi task = new Pi(Integer.parseInt(args[0]));
BigDecimal pi = comp.executeTask(task);
Please let me know if you have faced similar problem or if you can point out where I am going wrong.
Thanks,
Abhinav.
first try comment out this line:
Registry registry = LocateRegistry.createRegistry(1299);
and check do you have security.policy file if not then create that
then try this code in that:
grant {
permission java.security.AllPermission "", "";
};
and might be you are not setting security manager:
set that like this in your main method:
System.setSecurityManager(new RMISecurityManager());