Configuring Java Client for Hazelcast - java

I am trying to configure a JAVA client for Hazelcast. I have a web application deployed on tomcat servers. The example that I am following is this
Basic Clients Hazelcast. I have copied the code into my local machine and when I simply run it without running anything else and without the addAddress() step I get a java.net.ConnectionException. My doubts are:
1) What is the client in this case (I am assuming it is the web application that probably means I have to get the Hazelcast server up and running then what is to be done)?
2) How do I establish a link between the web app, the tomcat server and hazelcast cluster? The web app uses MongoDB as the backend. I was able to do a only MongoDB with Hazelcast integration but not the web app on tomcat server integration. What role does tomcat play here in this setup?
3) In the example what are the start.sh and stop.sh supposed to do? Where should I run them? If I simply open the git bash and run it. It doesn't seem to work.
I have looked at the documentation provided in the Hazelcast manual but I wasn't able to understand it as my current level of knowledge is woefully inadequate. If somebody could explain it to me or paste the links to some of the obvious stuff that I should know it would be great.

The answers are inline:
What is the client in this case(I am assuming it is the web
application that probably means I have to get the Hazelcast server up
and running then what is to be done)
The web application can be a Hazelcast client if you would like to use Hazelcast in client-server topology.
How do I establish a link between the web app, the tomcat server and
hazelcast cluster. The web app uses MongoDB as the backend. I was able
to do a only MongoDB with Hazelcast integration but not the web app on
tomcat server integration. What role does tomcat play here in this
setup.
Your web app runs in Tomcat server (web container) and the Hazelcast client you use in your web app can directly connect to the Hazelcast cluster members (server). You will just need to configure your client properly such as adding cluster member address by using clientConfig.getNetworkConfig().addAddress() API. Please see for more details about configuring client in this link: http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#configuring-java-client
In the example what are the start.sh and stop.sh supposed to do.
Where should I run them. If I simply open the git bash and run it. It
doesnt seem to work.
Those are sample start scripts for the sample client and member application. You don't need to use them in your application.
Please see the following guides for using Hazelcast in client-server topology:
https://hazelcast.org/getting-started-with-hazelcast/
http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#getting-started-with-java-client

Related

How to have Azure App Service Tomcat to forward all 80/443 traffic to JBoss running on the same App Service

First of all, my Azure subscription is through a Cloud Service Provider, so I don't have access to certain features (i.e. cannot install a marketplace tomcat, only the native one; with the native Tomcat I do not have access to server.xml, which I need for some traffic rerouting solutions - modifying Connectors).
The basic need is to have IBM's B2B Client app running and sending files back and forth. It comes with its own JBoss, and all you do is put the app in a directory on Azure App Service and run the executable. This is already not a problem, and I have it starting with the app service using a WebJob.
Problem:
App Service only has two inbound ports open - 80 and 443, and they are both being used by Tomcat.
So I need to either:
1) Disable Tomcat, and only have JBoss running and listening on those ports without conflicts;
or
2) Have native Tomcat forward traffic to JBoss.
How can I do either of those in this environment, and are there better solutions for this problem?
According to the subsection Network endpoint listening of the wiki page Azure Web App sandbox of Kudu for Azure App Services, you couldn't use the other ports on Azure App Service besides 80 & 443 to access the application server from the internet. So if you can't create a JBoss AS instance from Azure Marketplace, per my experience, I think the only way is that creating an Azure VM instance to install a JBoss AS instance to deploy your specified Java Application.
Hope it helps. Any concern, please feel free to let me know.

Deploy Java restful web service to live server

I have just learned to create java rest API using jersey and Oracle database.
I'm developing in eclipse and using weblogic server to run and test web service on localhost.
My question is what are the options of live servers to deploy this service so that I can access this API in my android application or any web application???
You can do that. But you have to make sure that all the dependent jars are packaged with the your WAR project(eg; Oracle db related things).
Some blog entries which give you an idea about what are all these servers and which one to pick for open development and common standards - http://blogs.forrester.com/mike_gualtieri/11-07-15-stop_wasting_money_on_weblogic_websphere_and_jboss_application_servers,
and this one http://zeroturnaround.com/rebellabs/the-great-java-application-server-debate-with-tomcat-jboss-glassfish-jetty-and-liberty-profile/
This will give pretty good idea about what is all these servers :)

HTML5 and Java server application deployment on AWS

I have created a Java restful server application which can be compiled as a JAR/WAR file and I have another front-end application built using knockoutjs and HTML5 which talks to the Restful Server side application.
I am trying to deploy both on to Amazon Linux AMI EC2 Instance. I was successfully able to deploy the JAR after setting up a glassfish server on the server. The server side application is running completely fine.
I am having problems in understanding how the HTML5 application needs to be deployed on the AWS server. So that both can be accessible from the same server.
It would be great if some best practices are also suggested.Appreciate any help
Thanks
You probably want to put your GlassFish application server behind an HTTP server like Apache HTTPd or nginx, and either of those servers could then also serve your static content -- your HTML and JS. Check out http://www.codefactorycr.com/glassfish-behind-apache.html

how to deploy struts2 eclipse web application on remote server

I want to check deploying procedure of my struts2 web application developed using eclipse juno on local tomcat server. I want to deploy it to a remote host like 000webhost. Can you provide me any information how to do that?
well, I run my application by typing
http://localhost:8080/Struts2starter/
on browser I want to run it by typing
http://myapp.com/Struts2starter
like something on browser. I wanted to know how to do it.
I don't believe you can deploy a Java application in 000webhost. For example, you can deploy on Google App Engine. Here is an example of how to do that: http://www.mkyong.com/google-app-engine/google-app-engine-struts-2-example/
It depends on server in question. Most servers provide some kind of remote deployment using manager applications / rmi connectors / whaever else exitic means , and eclipse can work with most of them. But of course it needs to be configured on both sides in order to work. Be more specific about your server config, and you will surely get proper answer

running php and java on the same server

I have web services written using java which interacts with the android application only now we need to implement a front end web portal using php frame work codeigniter. We have common database mysql 5.1 which interacts with both the web services and also web portal, is it possible to configure the LAMP stack in a server which is already running tomcat6 servlet container but with out apache web server. How do I processed further and when Iwas search for same issuse I found something called php java bridge is that what I have to use??
Let me be more precise on this, I have ec2 ubuntu instance already running, domain is parked in godaddy, i have configured the A records with the ip of my ec2 instance, so when the requests comes in it will be directed to the application which is running in the tomcat6/webapps/ROOT but now I need to redirect it to the php application how do I do it and also requests from android should be directed to web services which are java based, how do I manage this?
Kindly help out
You can proxy requests to the tomcat server from Apache ... have two virtual hosts, one for the tomcat and one for the php ... all co-ordinated by apache.
http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
It is recommended that you also read the Workers HowTo document to learn how to setup the working entities between your web server and Tomcat Engines. For more detailed configuration information consult the Reference Guide for workers.properties, uriworkermap and Apache.

Categories

Resources