How to access Jade Main Container via internet? - java

I am working on an Agent based application and i want to access agents running on a container in a machine. I am using jadeGateWay to connect to Main container. It is working in localhost but when i run the jadeGateWay on a server it doesn't connect eventhough correct IP address of the jade main container are given. Can anybody suggest me a work around? Thanks in advance.

I suggest you, for the beginning, that you try to make the connection using jadegateway in the same machine, if works, try to do the same in other machine, as you want. If do not works, you could send more information about the problem.
And if you did not read yet, it's interesting read the jadegateway api on: http://jade.tilab.com/doc/api/jade/wrapper/gateway/JadeGateway.html.

Related

Requesting API service from docker container fails

I have a docker container running java program, which is using API service of a third party. When I run the jar file on ec2 machine, it works well and gets connected to service and fetches the data also but when I containerize the jar file, it doesn't connect to the API service. API service exposes itself on port 14002. I do understand that container can send the things out but cant receive anything unless we tell it to do.
Can anybody tell me, how do I tell my java program to get the service of API running on 14002 port?
Thanks
thanks all for your comments here. I was able to resolve this issue, simply by changing the base image from FROM openjdk:8-jdk-alpine to FROM openjdk:8-jdk. In the alpine image, I was not able to ping the api dns from inside the container usining telnet. But after changing it to only openjdk:8-jdk, I was able to ping the external dns. So it was the issue in image

How to make a local test server for an android app?

I basically need to create a test server, something that I can use locally to perform tasks for my application.
So my android app is basically a search engine, however the search queries will be made on the server and the results then fetched from the server on the mobile device as JSON objects.
Is there any way to replicate this functionality locally? I would just like to set up a server, include the Spring framework, the Google Custom Search API and develop it all in Java, then ship it to a live server directly when it's finished. (Most presumably a free tier Amazon AWS server, either EC2 or Lambda, not sure what the difference is).
Not quite sure where or how to get started so any help is appreciated, thank you!
p.s. I may try dabbling in some machine learning at a later date, but I don't know if this will affect anything, this will most likely be after I've got a live server up and running.
EDIT: Sorry, so how would I fetch data from a local server from my mobile device? Do I need special software? Do I need to configure a local server? How can my mobile device fetch data from a second project when its being run on the first?
My app will fetch data from a server, so how can I create a dummy server, for it to fetch data from? Will I need to create a fully functioning online server, or can this just be done through creating a local server of some sort and then simply plugging my android device in and running the code? I have absolutely no idea how to test it without putting it online.
You can run a local installation of Tomcat server on your own machine.
Access the server by visiting "http://localhost:8080/" (or) http://127.0.0.1:8080". You can basically listening to your own local machine / host's 8080 port. Sometimes, it could be port 80 instead of 8080.
Please explore on how to host a Spring or Java application on a local server.
A good starting point would be to learn J2EE or Enterprise Java. You can configure Databases from your local installation.
If you opt for PHP as your language on server side, there is a pre-defined package called WAMP (for Windows), LAMP (for Linux), MAMP (for MAC) and XAMPP.
The above package are nothing but a package which contains a Server, Database and a Server side language usually PHP, if needed Python or Perl.
Please explain in which step you are getting issues so that anyone can help you exactly.

Deploying webservice on remote machine

This might sound a very basic question for the N/W gurus so please try to help me here.
I have developed a simple Webservice in Java and deployed it on a local machine using Eclipse/Ant. The path looks like this -
http://localhost:8284/myws?wsdl
Now, I have provided a static IP for the local machine say XX.XX.XXX.XX and I can ping it from any remote machine over internet.
In my Java program, I have provided endpoint name as -
"http://localhost:8284/myws" and it works fine on local machine and opens the wsdl just fine in a browser.
Now, I want to deploy this webservice in a way that, I can access it remotely using my static IP i.e XX.XX.XXX.XX
Problem 1:
When I try to assign the endpoint as
"http://XX.XX.XXX.XX:8284/myws" my Java program gives error saying
Server Runtime Error: java.net.BindException: Cannot assign requested address: bind
Problem 2:
If I deploy it as "http://localhost:8284/myws", I am not able to access it over internet using URL like http://XX.XX.XXX.XX:8284/myws?wsdl.
Things I have did so far - -
a. Turned off the firewall
b. Created 2 rules inbound/outbound with port 8284 allowed.
My question is, will I need a router to do a port-forwarding thing? Or will I need an IIS to deploy it?
I really want to ignore both of them. If there is any simple way to do that please let me know. Am I missing something? I am able to ping the IP and can also connect through RDC.
Info -
Machine is on Windows 7.
Any help will be greatly appreciated.
Thanks.
I got it solved. I used http://0.0.0.0:8284/cal while binding and not localhost:8284/cal
Works like a gem now! Hope it helps someone.
Regards,
Bhushan.

Failed port-forward for my diy application in Openshift

I have a java application with a server socket, but i don't know how to connect with another java web application in openshift. Looking in forums i saw i had to do port-forward to see wich ports i had to use in the connection between the web application(client) and the java application(server). But i have this error:
http://postimg.org/image/gjrrs80lp/
I did ssh -N 536(..) too, but it didn't work. I'm full blocked, i've never worked with sockets and ports and i'm blocked.
Thanks for the help guys ;)
You might do better to read up on sockets and ports then. Can you give a specific error that you are getting? If you are trying to use a non-supported port, then it will be blocked. If you want to do port forwarding between gears then you need to make sure you have a public/private key setup on your gears for that purpose and added to your account.

Uniquely connect an android application to a java applet on pc

I want to connect my android application to an applet which is running on my pc on Google chrome on Wi-fi.. where my phone works as a wi-fi hotspot and pc as the connected device. I want the connection to work uniquely as I want commands to be passed from my application to the specific applet, on the execution of which my applet does specific tasks. Please tell me the APIs which I can look in both Java and Android or the technology I have to use to make it work..
You need to use any program, such as wamp server, to make your computer to be a localserver. It will install PHP 5, MySQL and Apache. In other hand, you will also need a little bit of knowledge in Php language to create you own web services.
Another thing you need to be aware is that to handle you connection between server and device (and by this I mean which IP you are going to use) you will have a little headache; but first things first..break your problem in little parts thus will be easier to solve them.
I recommend this tutorial.
I think the simple way to connect these two softwares is using UDP.
It is fast, it is easy to program but it is generally unreliable according to TCP. But it is already local network. I dont think that is a case you need to take care in your local wifi network.
So take a look at this tutorial http://tutorials.jenkov.com/java-networking/udp-datagram-sockets.html
There are other ways like https://www.alljoyn.org/. It has more functinality but more complicated.
You must install Server on your PC(Apache httpd or apache tomcat or other based on your interest). A server listens to request from clients. When your mobile is connected to your pc(doesn't matter wire or wireless), you can make a request to an url(say, localhost:8080/welcome) from your app.
Create an applet and connect it with your web application(in the server) using java.net.URL and java.net.URLConnection.
On performing some operation on the client, call the url of the server application and forward the response to the applet.

Categories

Resources