Web server to multiple ejb server call using tomee - cluster-computing

I am using TomEE server and i want to deploy my ejb application to multiple instances and want to access it using a web application.
I want to add a load balancer between web application and ejb application.
How can i achieve this.
I already have a load balancer for web application multiple instances using mod_jk,but i need this configuration somewhere in INITIALCONTEXT properties file.
Attaching a pic of how i want to build my app architecture.architecture pic
I'm struggling in this from quite some time. Any help will be appreciable.

We can use TOMEE multipoint discovery feature using failover in initial context PROVIDER URL and give multiple URL.
multipoint.properties file we add in conf.

Related

(How) Can I run more than one Spring Boot application on the same server and port?

I have a Spring Boot web application that I'd like to split up into about six separate applications; one would provide the homepage and login at endpoints under "/", and the others would each claim a subdirectory path ("/subsystem1", "/subsystem2", etc...). I have a pretty clear idea how I could use JWT to pass authentication/authorization from the login app to the others.
The main reason for this is so that each subsystem can be modified or updated without shutting down the others. And organizationally, so we don't have to subject the entire app to a QA process when only one subsystem is changed.
Is it possible to set up multiple Spring Boot instances to run on the same server at the same time and the same port, with different paths/directories to their endpoints? How?
I was unable to find any duplicate question, but here are two related questions that may offer clues:
From Is there a standard way to customize the deploy path in Spring Boot? I learned that I can set the application property server.servlet.context-path to prefix the whole application with a subdirectory name (e.g. "/subsystem1"). But I still can't run two apps at the same time, even if both claim different subdirectories. Spring Boot reports "Web server failed to start. Port 8080 was already in use."
There's Multiple Spring-boot applications running on one Tomcat
but I'd prefer to use standalone Spring applications with their embedded Tomcat instances rather than the less-recommended WAR packaging and deployment to an external Tomcat container.
This one looks promising -- Deploying Multiple Spring Boot Web Applications in Single Server -- but the answers focus on whether standalone or Tomcat container deployments are better, and doesn't touch on the "how-to" question.
Acceptable answers:
If, as ekalin suggests, it is impossible to have multiple Spring Boot apps listen to the same port, here are a couple of ideas I have brainstormed (but don't know how to accomplish):
Perhaps the instances could be running on different ports but the main app (the one with the login page) could "forward" or redirect to the other apps in some way that hides their true URLs? E.g. "localhost:8080/subsystem1" would be an alias for "localhost:8081/".
Perhaps the applications could each have their own Docker containers, all running within a shared Docker network, and we use Docker somehow to map each URL path to the right app? Could this be set up with docker-compose?
We set up a proxy server of some kind that remaps URL paths to the separate applications.
You can't have more than one application listening on a port. How would the kernel which application to send the packages to?
You could run an http server such as nginx listening on 8080, and each application in a different port, and then proxy the requests based on the URL to the desired application.

Is it possible to deploy multiple Spring Boot applications to a server?

We can create restful API in spring boot jar file?
1)can we split multiple jar file in Apache server?
2) if we split multiple jar file how will identify which jar contain correct rest APIs
How spring boot jar file will work in server?
For Development Environment
You can configure ports via application.properties or via system properties.
Or with option to jvm --server.port=8081
So, there is no problem to run a few APIs on single machine with different ports.
You don't need Apache Server. Spring Boot has it's own embedded for you. So, you can easily use it.
Let's say you have two APIs.
localhost:8081 (Checkout Service)
localhost:8082 (Payment Service)
Hostname and port - it's your identification for each service.
When you trying to search something in Google.
You browser - it's a client.
And Google's servers - it's a server.
The same here. Checkout Service trying to delegate some job to Payment Service. So, Checkout Service - it's a client. And this client should know the address of Payment Service.
For Production Environment
You should think twice, how you will monitor performance, manage scalability and so on.

Does application server provides what spring can provide

Bit confused with Spring framework and what capabilities application server provides.
I was reading this answer on same site
There he says,
Additionally App Server have components and features to support
Application level services such as Connection Pooling, Object Pooling,
Transaction Support, Messaging services etc.
That means we can optionally use apis of application server to manage transaction in our web application (inject web application :()and I think spring also provides transaction apis. So whats the difference?
Please, help me to make it clear. Thanks you.
When you use app server resources (transactions, connection pools etc.) directly in your application code, you can only run it when it is deployed on an application server or even worse only on that syme type of application server.
Spring allows you to use those resources and configure your application for different environments. The application can be run on any application server or on a simple Tomcat, or on different servers in the cloud.
Spring also allows you to run your code in tests (unit tests) without the need to start up an application server. This is absolutely needed to write automated tests.
Everything that can be done with an application server, can be done with spring as well.
There is a whole world of spring libraries and framework that provide features that are not available directly on application servers.
I can really recomand to give spring a try.....

Spring Remote, configure httpinvoker and JAX on the same server

I have a server running on tomcat exposing Spring services using HttpInvoker.
I have exposed the methods of 5 services using HTTPInvoker.
This works very well.
The spring configuration is described in a file named remoting-servlet.xml; and the remoting servlet (DispatcherServlet) is described in the web.xml.
I now have an additional need to expose one additional service using JAX-WS this time (I will have C# clients).
I will use Spring support to JAX-WS.
I have the option to use the default deployment, or to use JAX-WS RI's to deploy this additional service to the same server as the remoting servlet.
I would prefer this last solution, because I would have only one server providing the remote services (whether they are web services or httpinvokers).
My question is: is this possible?
I think that I can I put the 2 servlets on the same port. But my issue is that it seems to me that I will have to provide 2 different application contexts. One for the DispatcherServlet, and one for the WSSpringServlet.
Is that correct?
Is it possible to put the WSSpringServlet context definition to the same file as the one for the httpinvokers (remoting-servlet.xml)?
Many thanks
Gilles

How to deploy a spring integration component?

I've developed a spring integration component that is to sit on a server and process messages coming in over an inbound RMI channel do some processing/filtering and then send out some messages over a different RMI channel.
Currently, for testing, I've been running it using a Main class that just loads the context, which sets up the inbound RMI gateway and it's working fine. But I don't think that this is appropriate for a production environment.
What is the best way to deploy this type of project to a server?
If I were working in a .Net I'd be deploying this type of application as a windows service, is that what I should be doing here?
The application that is sending me data is hosted in Tomcat, would it be a good idea to also run this application within the same Tomcat container (Current requirements are for both components to be on the same machine this may change)? And if so how?
I'm currently looking into Spring Boot, am I on the right path?
I think the best would be Spring Boot, as it's made to easily allow running different types of applications. Also, you don't need Tomcat if you can run the same component with a simple Main and not using UI. Spring Boot, also, has a sample using Spring Integration here, so you should be up and running in no time.

Resources