Multiple Apps on one JBoss Instance - jboss

I am trying to find out if it is possible to configure One instance of JBOSS to run multiple apps. Each application serve on a different port and I hope JBoss has this capability?

I know it's possible on WebLogic. When I create the domain for a new application I can specify the port. I'm sure that JBoss has a similar capability.

Related

How to configure jboss EAP 6.4 differently for different applications running on it?

I have a 4 applications running on my jboss server, i want to disable "X-PoweredBy" header response for particular application.
if i run the shell script and try to change it, it will be applicable for all the instances on the server.
How do i do it for one application alone ?
Try to create a servlet filter for the application you are interested! To be specific, you must call HttpServletResponse#setHeader(name, value) or the HttpServletResponse#addHeader(name, value). Bear in mind that this can not override the header added by the web container but this can add the header if the web container does not add the same header.

Determining version of jboss programmatically between jboss 5 and 7

I'm trying to find the best way to grammatically determine if my program is running on Jboss 5 or Jboss 7 (eap-6.1). The ways I've been finding so far are jboss 5 or jboss 7 specific, which doesn't work because the code has to work in both. Tried both solutions from here: How do I programmatically obtain the version in JBoss AS 5.1? and they didn't work. One complained about org.jboss.Main not existing in jboss 7, the other complained aobut not finidng "jmx/rmi/RMIAdaptor".
The only way I can see is to do Class.forName to look for "org.jboss.Version" (should be found if jboss 5) and if that fails, do Class.forName "org.jboss.util.xml.catalog.Version" (jboss 7). But that seems like a terrible idea.
The reason I need to know if the war is running on jboss 5 or 7 is because there are some custom files that are located in different places in both. So it's like "if jboss 5, execute this piece of code, if jboss 7 execute the other.
Ok i just saw what the problem is.
I would suggest you to think about design issues/refactoring of your software.
If you want to provide your software within different environments, seperate your logic from
technology dependencies.
Build facedes and interfaces to meet environmental requironments.
In my oppionen thats much better as to think we must support all integration platforms and support all there versions. This is completely impossible.
So decouple your business logic and offer specific interfaces. These interfaces (adapters) are much simplier to implement and to maintain.
Hope it helps.
UPDATE DUE TO COMMENT.
I think a solution is for servers 4 to 6 is to use
the MBean Server of JBoss to lookup the registered web application
which is associated to the deployed WarFile.
I suggest first to lookup the registered MBean of the web application manually using the JBoss jmx-console. The name of the WebApplication should be found under the capital "web" or "web-deployment" within the jmx-console.
If you found that name you can implement an own jmx based lookup mechanism
to check for that name.
Here is an Tutorial: pretty old but i think it gives you an idea how to do.
There must be more tutorials for this problem:
http://www.theserverside.com/news/1364648/Using-JMX-to-Manage-Web-Applications
Within JBoss 7 i just can give you the hint that its architecture is based on OSGI. So to lookup for other services you should have a look to this mechanism.
In any case you don't have direct access to the file system and the deployment directory
from an application which is deployed within a JEE container, except of
using the mechanisms provided by the container. JNDI Lookup, JMX ManagedBean mechanism, Java Connector Archicture (JCA) (makes no sense in your case)
It's not an answer just an suggestions since the implementations are completely different
One way could be to use the "interceptors" which are executed during bootstrap and before any ejb invocation and there you have access to the invocation context in other words ejb container.
I can't give you any example but this would be an access point to start.
Another accesspoint is to check for system wide JMX Beans by looking through the
Adminstratore console of the JBoss Server.
You can inject JMX Bean state into your application through the Context Mechansim.
Take a look from Version 4 to 6 at the JMX Managed Bean mechanism. The JMX Achitecture is the main concept of JBoss 3 to 6, so at this point you can influence and maintain the JBoss behaviour.
Aditionally i think you have differences from 4 to 6.x version and 7.0 because since
7 it's a completely new architecture. Since 7.0 the JMX architecture doens't exists anymore.

Deploying .ear file (contains rest services)

I have a few questions about deploying my .ear file (was provided to me, the file itself should not be the problem). I set up jBoss application server jboss-6.0.0.Final and was able to run a simple hello world app to ensure the server was functioning properly.
I was told to place the .ear file in /server/default/deploy so I did. When I ran jboss (through /bin/run.bat) I got no errors related to deploying the ear file.
Question
Is this all the software I need (jBoss)? Do I also need something like Apache or tomcat?
The .ear file contains RESTful service calls that should return xml. Will these be deployed (accessible through a jQuery ajax call after the server (jboss/bin/run.bat) is executed?
Currently when I try to make the calls, the resources do not seem to exist.
Thanks in advance for taking the time to help.
JBoss AS ships with an embedded Tomcat as a servlet container so you really don't need that anymore. Apache Web Server is NOT required for your .EAR to be deployed properly.
To answer your questions
No other software is needed to deploy the EAR. You simply copy your EAR file to deploy directory (which you have rightfully done so).
If your EAR contains RESTFul services, they will be deployed and you can access them using any client including jQuery or even a simple browsers. The trick is to know the access URL to the RESTFul services.
If you have difficulty identifying the URL for accessing your RESTFul services please refer [1] for more information.
Hope this helps.
Good luck!
[1] https://docs.jboss.org/author/display/AS7/JAX-RS+Reference+Guide
I can answer the first question. You need apache if you want to serve static content or you need to isolate the traffic (say keep apache in the dmz and then use apache to proxy traffic to the internal jboss servers). tomcat is bundled along with jboss, so you do not need it.

jboss 5 stop start application without bouncing container

I'm using jboss 5 on solaris and have a simple question.
If a single server is hosting multiple web applications is it possible to stop/start/restart an individual application without bouncing the entire server from the jmx console/command line.
The setup we have at work is that each application is hosted by a different jboss instance, this was done as no-one knows how to stop/start individual apps without affecting the other. This doesn't make sense to me and creates additional load on the server. I know in glassfish you can do it through the admin console but the jmx console is not so user friendly to make this obvious to me
thanks sapatos
Yes. Go in admin-console at http://localhost:8080/admin-console to the respective web-app and then on the operations tab from where you can invoke start/stop/restart.
You can of course also do it in jmx-console.

Monitor JBoss through SNMPv3

I am on a development team that is using JBoss EAP 4.3.0.GA_CP06. I need to be able to monitor JBoss using SNMPv3.
I understand I am able to use SNMP to monitor, but is it possible to monitor using v3 out-of-the box? If it is possible, what configurations need to be made to do this? If it is not possible, what external/other options are there for monitoring JBoss with SNMPv3?
Thanks.
Assuming the snmp-agent.sar is in your deploy directory (which depends on which config you picked), then JBoss will be exposing SNMP information on port 1161 (see inside the .sar for additional configuration).
I don't recall if this is SNMPv3, though, or v2.
This is not possible "out-of-the-box". An external SNMP adapter is required (e.g. WebNMS, iReasoning).