Bind IP address per ejb exposed as web service - jboss - java

How can I run ejbs exposed as a web services on the same jboss (version 4.2.3) using different IPs.
For example:
I have two web service locations (two different ejb components) and one server with two network interfaces:
http://192.168.0.1/test/TestService1
http://192.168.0.1/test/TestService2
and I want to have this:
http://192.168.0.1/test/TestService1
http://192.168.0.2/test/TestService2
Thanks

If JBoss is anything similar to websphere in it's architecture, I think you'll have two create to separate server instances and bind each to a specific IP. Then you'll deploy the EJB:s to the respective instance bound to the desired IP.

Related

Multiple jetty instances for different applications

I am new to applications deployments in web servers altogether. Is it OK to add different instances of jetty webserver for two application - One data service and another angular UI application. Or Do I need to deploy the two applications from the same jetty instance.
Suggestions
Single jetty server hosting both applications
Use this approach when you own both the services and understand the RPS/throughout/latency/memory requirements of both the services. A bottleneck in one service can cause issue to another service
If the available memory/cpu/capacity is limited and hence don't want to waste additional memory for server by running another server instance
Both services are light weight
Both services are not deployed frequently or there is proper a BCP
Separate jetty server per application - preferably containerized(Docker?)
Provides good isolation to services
Control over resources per application
Easy to manage/scale independently depending on load
Easy to identify and fix issues
Personally, i would prefer to run them independently with or without containerization.

Wildfly remote EJB calls through outbound connection through loadbalancer

We have some Wildfly servers running in standalone mode.
Every single instance provides a bunch of stateless services that can be accessed through ejb remote calls (http-remoting) from some webapplications.
The outbound connection of the webapplication points to a http loadbalancer using round robin, no stickiness. This balancers checks the availability of the service applications before connecting.
This work so far, failover also.
The problem:
The number of standalone servers could vary. Once an outbound connection is established from one of the webapps it will never be closed. So always the same standalone server is reached until it would die.
The purpose that under heavy load we just start another VM running a standalone server that would also be used by the loadbalancer does not work, because no new connection is established from the webapps.
Question:
Is this a scenario that could work, and if, is it possible to configure the webapps to start a new connection after some time, requests counts, or whatever?
I tried no keep alives for tcp or http header in undertow and request idle time, but no success so far.
Kind regards
Marcus
There is no easy way to dynamically load balance ejb remote calls due to their binary nature. The JBoss EJB client enables specifications of multiple remote connections, that are invoked in round-robin fashion, but the list is still hardcoded in your client config.
Example jboss client config jboss-ejb-client.properties:
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=node1,node2
remote.connection.node1.host=192.168.1.105
remote.connection.node1.port = 4447
remote.connection.node1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.node1.username=appuser
remote.connection.node1.password=apppassword
remote.connection.node2.host=192.168.1.106
remote.connection.node2.port = 4447
remote.connection.node2.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.node2.username=appuser
remote.connection.node2.password=apppassword
I understand, that your web application is also java based. Is there any reason why not run both the EJB layer and Web on the same server within a single .ear deployment? That way you could use local access, or even inject #EJB beans directly into your web controllers without the need to serialize all calls into binary form for remote EJB with the benefit of much simpler configuration and better performance.
If your application is actually a separate deployment then the preferred way is to expose your backend functionality via REST API(JAX-RS). This way it would be accessible via HTTP, that you could simply access from your web app and you can load balance it just like you did with your web UI(you can choose to keep your API http context private - visible only locally for the services on the same network, or make it public e.g. for mobile apps) .
Hope that helps
You should be using the standalone-ha.xml or standalone-full-ha.xml profile. While you might not need the ha part to manage the state of stateful beans across your cluster, you need it for the ejbclient to discover the other nodes in your cluster automatically
In effect, the load balancing is done by the ejbclient, not a separate dedicated load balancer

Multiple ports for a single application in jboss fuse

Relatively new to jboss fuse. We have a requirement of running a single application on multiple ports. Is it practically possible? specify a range of port in config file.
I tried like cfg.port: 9000, 9001
but doesnt work
The best approach is to have the application's Camel routes that use those ports define them in their routes. The built-in Jetty listener is generally for shared web service endpoints using CXF and the management web console.

WildFly/JBoss server group deployment understanding

According to JBoss documentation:
In managed domain deployments are associated with a server group.
Deployments will be provided to any server that belongs to a
particular group.
...the multiple servers in common server group become the single one virtually.
But how does JBoss choose the target actual server for deployment?
For example, i have two different vps servers with JBoss running, which are combined to the single main-server-group. Then which vps server will actually host the application by following command?
[domain#localhost:9999 /] deploy ~/Desktop/test-application.war --server-group=main-server-group
'test-application.war' deployed successfully
The application will be deployed to both servers.
If you were to go to http://server1:8080/MyApp you should see the same as if you went to http://server2:8080/MyApp
The reason for this is that you would normally have a web server or proxy to load balance between the two servers. If you want to have two separate servers which don't have the apps deployed to each, then put them in different server groups or, a better solution would be to run JBoss in standalone mode, rather than domain mode.

Running embedded Jetty : How to access hosting applications' methods?

We are using an embedded jetty instance that we pass a .war file to host a web application. That works very well.
Now, we want to call methods in the hosting java application (that started the jetty server)
What is the best way to call methods in the hosting java application from e.g. servlets inside the webapp without having to use TCP-IP connections, etc?
Is there an easy way?
Thanks in advance
One possible way is to share interfaces so that your web application is built against the interfaces and to use JNDI to obtain the implementing objects from the server.
On server side you only have to publish the implementing instances via JNDI.

Categories

Resources