JBoss Interview questions

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

Are you going for a JBoss Job ? well we cannot predict what you'll be asked but some questions are quite popular at interviews......check it here !

JBoss Domain mode interview questions

Q: What's the difference between Standalone mode and Domain mode ?

When configured in Standalone mode each distribution starts a single JVM process with its own configuration, management instruments and deployments. When configured in Domain mode, multiple servers are managed from a centralized point called Domain Controller which maintain the configuration and provisions applications for deployment on the single nodes which are part of the Domain

Q: What happens if the Domain Controller fails ?

If the Domain Controller fails, it is not possible to managed the Domain configuration anymore but applications running on the single nodes are preserved. It is however possible to choose a backup Domain Controller server as in the following configuration snippet:

   <remote host="" port="9999" security-realm="ManagementRealm" username="eap7admin">
         <static-discovery name="backup" protocol="remote" host="" port="19999"/>

Q: Do you need Domain mode in order to run a Cluster of JBoss EAP / WildFly nodes ?

No, a cluster can be both configured in Standalone mode and in Domain mode with no difference in terms of Profile configuration. The advantage of configuring a Cluster in Domain mode is that you don't need to manually synchronize the configuration on all your Servers as you would need in a cluster of Standalone Servers. The same stands for provisioning applications: in a Domain running an ha (or full-ha) profile you can provision your applications on a whole Server group with a single Operation. In standalone mode you have to deploy applications on each Server.

Q: Multiple Domains in the same cluster and Multiple clusters in the same Domain: which one of these configurations is possible ?

Both! Let's see each of them:

  • Multiple Domains in the same clusters can be achieved by starting two Domains in the same network which are sharing the same multicast address and port. This is a quite rare scenario, however it's technically possible.
  • Multiple clusters in the same Domain can be achieved by defining a different multicast address on each Server Group or even at Server Level. This way, your Servers, even if in the same Domain, will communicate through different multicast addresses so they will make up separate clusters.

Q: Porting one application from Standalone mode to Domain mode: is it guaranteed that you won't run in any issue ?

One core difference between Standalone mode and Domain mode is that Standalone mode allows manual deployment of applications by copying archives into the deployment folder. On the other hand, in Domain mode applications are managed and copied through the CLI or the Admin Console into the data folder of the single nodes. That being said, some applications might require to know the physical path where the application has been deployed: one good example is LifeRay portal which requires some workarounds to run in Domain mode. So always check the applications requirement before committing to a change from Standalone mode to Domain mode.

Q: If you have JVM Settings at Server Group Level and your Servers are configured to use the Host JVM Settings, which one prevails?

In a managed domain the JVM settings can be declared at different scopes: For a specific server group, for a host or for a particular server. If not declared, the settings are inherited from the parent scope. In this case you have the following configuration (domain.xml):

       <server-group name="main-server-group" profile="default">
           <jvm name="SGdefault">
               <heap size="64m" max-size="512m"/>
           <socket-binding-group ref="standard-sockets"/>
</server groups>

While at Host level you have (host.xml):

       <server name="server-one" group="main-server-group" auto-start="true">
           <jvm name="default"/>

In this case, the Host configuration (named default) prevails, being more specific to the Server.

Q: I want to be printed all the JVM options when Servers in a Domain start. How can I achieve it ?

A simple an effective way to do it, is adding the following JVM option, which will output all the JVM options at startup:

         <option value="-XshowSettings:all"/>

JBoss Datasource interview questions

Q: Say you have frequent "Connection closed" in your logs. You ping the database but it's reachable. What would you do?

it's very likely that you have some infrastructure policy which closes idle connections before when they are still Active for the application server. In order to cope with it, you have to include a Validation configuration in your Datasource which will prevent your application to use dead Connections. Example for Oracle:

	    <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
	    <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
	    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>

Q: What is the difference between validate-on-match and background-validation? can you use  both of them ?

When the validate-on-match option is set to true, the database connection is validated every time it is checked out from the connection pool using the validation mechanism specified in the next step.
On the other hand, background-validation fires a background validation as dictated by the background-validation-millis.

You cannot apply both of them, they are mutually exclusive.

Q: What if I remove the ExampleDS default Datasource ?

If you remove the default Datasource you will not prevent the server to start, however you might find some errors due to the fact that the ee subsystem contains a reference to the Default Datasource, which is the ExampleDS Datasource.

   . . . . .

Q: Can I have a Driver configured without a Datasource and viceversa ?

You can configure a Driver without having a Datasource using it. But now viceversa!


Q: Why you should never put just the IP address in a network interface definition ?

If you configure your network interfaces as in the following example:

<interface name="public">
    <inet-address value=""/>

Then you won't be able to use startup options to change the IP Address/hostname. In this case, the options -b or -Djboss.bind.address will not be used at startup. So never remove the alias jboss.bind.address from the Beanshell expression

Q: Can you use Environment variables in your configuration ?

Yes, that's actually possible. You can do it in two ways:

1) The Java way, by passing it as argument to the startup script:

./standalone.sh -Dvariable=$variable

And then reference it as System Property in your configuration.

2) Using the env expression in your Bean Shell expression. Example:

<interface name="public">
    <inet-address value="${jboss.bind.address,env.HOST:}"/>

In the above example, if jboss.bind.address is not set, the environment variable HOST will be used. If none is set, it will fallback to


Q: How can I persist the cache of my Stateful EJBs in a Database ?

You can use a JDBC cache store, which persists data in a relational database using a JDBC driver. There are three implementations of the JDBC cache store: JdbcBinaryCacheStore, JbcStringBasedCacheStore, JdbcMixedCacheStore which can be used depending on the type of key to be stored in the cache.

Q: What happens if there's a concurrent access to an Entity in a clustered application ?

It depends on the isolation level defined in the "hibernate" Cache. The default isolation level for the hibernate cache is READ_COMMITTED which means that the non-repeatable reads phenomenon can occur in this isolation level. It is however the default in most databases like Oracle or PostgreSQL. It would make sense to configure REPEATABLE_READ in case the application evicts/clears entities from the Hibernate Session and then expects to repeatably re­read them in the same transaction.

Q: What is an L1 cache and when I am allowed to use it ?

When running in distributed mode it is possible to configure a special kind of cache named “L1” cache which temporarily holds entries of the cache. When an L1 cache is available, that is consulted locally before checking caches on remote servers. L1 entries are invalidated when the entry is changed elsewhere in the cluster so you are sure you don’t have stale entries cached in L1.

Q: Why should I prefer mod_cluster over mod_jk ?

In terms of configuration: The httpd side does not need to know cluster topology in advance, so the configuration is dynamic and not static and as a consequence you need very little configuration on the httpd side
In terms of load balancing: You have an improved load balancing as main calculations are done on the backend servers, where more information is available and thus a fine grained web application lifecycle control

Q: What protocol by default uses mod_cluster ?

By default, the mod_cluster subsystem's balancer uses multicast UDP to advertise its availability to the background workers.

Q: Can I still use mod_cluster even if multicast is not available ?

Yes you can. You habe to modify the HTTPD configuration to disable server advertising and to use a proxy list instead. The proxy list is configured on the worker, and contains all of the mod_cluster-enabled HTTPD servers the worker can talk to.

Maven and build

Q: In your pom.xml file, what is the difference between the <dependencies> and <dependencyManagement> section ?

  • Artifacts specified in the <dependencies> section will always be included as a dependency of the child modules.
  • Artifacts specified in the <dependencyManagement> section, will only be included in the child module if they were also specified in the <dependencies> section of the child module itself.  Here's an example of it:

Q: What is wrong with the following plugin configuration ?


 Although technically correct, not specifying a version for a Maven plugin is a very bad idea. As a matter of fact, plugins can vary completely their behaviour from a version to another, causing your build to break or even cause unwanted results

Hibernate and Transaction Questions

Q:Are EJB 2 still supported in WildFly 10 and EAP 7 ?

WildFly 10 and EAP 7 still support Session Beans and MDBs written using the 2.X specification. What is not supported anymore are CMP Entity Beans 2.X

Q:What's the difference between Hibernate and EJB 3 ? Don't you think EJB 3 is just a clone of Hibernate ?

The perception of EJB3 as being a simple clone of Hibernate is primarily based on developer familiarity with Hibernate and a similarity of naming, as well as common purpose, and that Hibernate is morphing itself into an EJB3 implementation based on the work going into the specification, not the other way around.

EJBs are supposed to be components, in the sense that they're not just one class, but a set of classes, descriptors and usage and management contracts. All of this in order to allow a container (JBoss,
Weblogic, etc.) to provide services to those components, and to be able to reuse and distribute this components. This services are, among others, transactions, concurrent access control, security, instance pooling, etcetera.
Hibernat is "just" an ORM (Object/Relational Mapping) tool. Quick and dirty, this means you can store an object tree belonging to an class hierarchy in a relational DB without writing a single SQL query. Quite cool, IMO. But no transaction control, no instance pooling, no concurrency control, and certainly no security.

Q:Which Hibernate object wraps the JDBC Connection ?

The Session interface wraps a JDBC Connection. This interface is a single threaded object which represents a single unit of work with application and persistent database. It's retrieved by the SessionFactory's openSession() method

Q:Ok, is the Session Factory Thread safe?

Yes: that is many threads can access it cuncurrentely and request for sessions. It holds cached data that has been read in one unit of work and may be reused in a future unit of work. Good practice is to create it when the application is initialized.

Q:What is the difference between load and get in Hibernate ?

The main difference between load() and get() methods is that load() throws an Exception if there is no entry for the given id while get() method returns null. The other difference is that load() method creates a placeholder object-also called proxy"-.In other words hibernate will hit database only when the proxy object is actually used.

Q:How can you start a JTA transaction from a Servlet deployed on JBoss ?

JBoss registers in the JNDI tree a JTA UserTransaction Object which can be user to manage a distributed transaction.

Q:What if you need to span your transaction across multiple Servlet invocations ?

You can't with a Servlet. A JTA transaction must start and finish within a single invocation (of the service() method). You should consider using a Stateful SB. In a SFSB with a JTA transaction, the association between the bean instance and the transaction is retained across multiple client calls.

Q:What is the diffrence between a JTA datasource and an XA Datasource ?
Let's take this example:

 <datasource jta="true"  . . . >

When JTA is true, the JCA connection pool manager knows to enlist the connection into the JTA transaction. This means that, if the Driver and the database support it, you can use JTA transaction for a single resource.

@PersistenceContext(unitName = "unit01")
private EntityManager entityManager;

public void addMovie(Movie movie) throws Exception {

In practice this means that if you try to manage a JDBC transaction by yourself when jta is set to true an exception will be raised:

12:11:17,145 SEVERE [com.sample.Bean] (http-/ null: java.sql.SQLException: You cannot set autocommit during a managed transaction!
	at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnection.java:961)
	at org.jboss.jca.adapters.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:716)

On the other hand, an XA transaction, is usually referred as a "global transaction", that is a set of two or more related transactions that must be managed in a coordinated way. The transactions that constitute a distributed transaction might be in the same database, but more typically are in different databases and often in different locations. Each individual transaction of a distributed transaction is referred to as a transaction branch.

For example, a distributed transaction might consist of money being transferred from an account in one bank to an account in another bank. You would not want either transaction committed without assurance that both will complete successfully.may span multiple resources. A non-XA transaction always involves just one resource.

Various questions

Q:What are the differences between EJB 3.0 and EJB 2.0 ?
EJBs are now plain old Java objects (POJO) that expose regular business interfaces (POJI), and there is no requirement for home interfaces.

  • Use of metadata annotations, an extensible, metadata-driven, attribute-oriented framework that is used to generate Java code or XML deployment descriptors.

  • Removal of the requirement for specific interfaces and deployment descriptors (deployment descriptor information can be replaced by annotations).

  • Interceptor facility to invoke user methods at the invocation of business methods or at life cycle events.

  • Default values are used whenever possible (“configuration by exception” approach).

  • Reduction in the requirements for usage of checked exception.

  • A complete new persistence model (based on the JPA standard), that supersedes EJB 2.x entity beans

Q:What optimization could I use if the EJB container is the only point of write access to the database ?

You could activate the "Commit Option A" that is the container caches entity bean state between transactions. This option assumes that the container has exclusive access to the persistentstore and therefore it doesn’t need to synchronizethe in-memory bean state from the persistent store at the beginning of each transaction.

Q:Which component handles cluster communication in JBoss ?

The JGroups framework provides services to enable peer-to-peer communications between nodes in a cluster. It is built on top a stack of network communication protocols that provide transport, discovery, reliability and failure detection, and cluster membership management services.

Q:How would you convince my IT department to adopt SOA ?

In my opinion one of the biggest obstacle in the movement towards SOA adoption is the organization’s own IT department.Too many people in the IT organization conceive SOA as a technology concept only, and as such think of SOA as just a set of technologies and infrastructure for exposing, securing, running, and managing Services. Put it this way, SOA is nothing more than Web Services and standardized middleware. The critical flaw in thinking is confusing the technology that sits beneath the Services level of abstraction and the mechanism by which Services are accessed with the architectural approach that aims to decouple the implementation from the consumption and focus on sustainable architecture that allows for continuous change.

Successful SOA adoption requires a cultural shift in the way IT is done. The Service-oriented movement to agility and loose coupling demands a shift from traditional, waterfall styles of development (design-build-test-deploy-manage) to iterative approaches to continuous Service modeling

In a Service-oriented environment, governance moves from nice addon to an absolute requirement prior to the developement of the first Service. Security considerations shift from network boundaries to become context-specific, message-driven, and federated. And of course, the modus operandi of IT as a whole moves from focusing on the short-term project management to meeting the long-term sustainable needs of the business as it changes.

Web Services Questions

Q:If you have defined a web service that needs to transfer quite a lot of information, how would you do ?

You might consider using an attachment to transfer the information.Jboss JAX-WS Web services provides Attachment support with MTOM (Message Transmission Optimization Mechanism) SOAP.

Q:What's the difference between JAX-WS and JAX-RPC ?

Java API for XML-Based RPC (JAX-RPC) is a Legacy Web Services Java API, it uses SOAP and HTTP to do RPCs over the network and enables building of Web services and Web applications based on the SOAP 1.1 specification, Java SE 1.4 or lower.JAX-WS 2.0 is the successor to JAX-RPC 1.1. JAX-WS still supports SOAP 1.1 over HTTP 1.1, so interoperability will not be affected. However there are lots of differences:

  • JAX-WS maps to Java 5.0 and relies on many of the features new in Java 5.0 like Web Service annotations.

  • JAX-RPC has its own data mapping model, JAX-WS's data mapping model is JAXB. JAXB promises mappings for all XML schemas.

  • JAX-WS introduces message-oriented functionality, dynamic asynchronous functionality which are missing in JAX-RPC.

  • JAX-WS also add support, via JAXB, for MTOM, the new attachment specification.

Q:Do you know how you could add support for Web Service transactions ?

JBossTS supports Web Services transactions, including extended transaction models designed specifically for loosely-coupled, long running business processes. J2EE transactions can integrate seamlessly with Web Services transactions using our integrated, bi-directional transaction bridge. Interoperability with many other vendors is provided out-of-the-box and JBoss is an active participant in these standards.
Share your experience with us !

Do you want to share your interview experience with other people of this community ?
mail me (This email address is being protected from spambots. You need JavaScript enabled to view it.) your interview experience and I'll publish it inside this article.

Related articles available on mastertheboss.com

JBoss MBeans POJO

JMX MBean services are the core building blocks of the JBoss Appl

How to a dump of JNDI tree with JMX console ?

#2 JBoss Howto. This is the recipe of the day

How to configure JBoss to bind to a different IP ?

  If you want to change the jboss.bind.address property use the 

How to shut down JBoss from remote ?

JBoss recipe of the day

How to create multiple instances of an Mbean?

  Supposing you need two instances of an MBean, let's say one fo

JBoss classloader issues

By default JBoss (prior to version 3.2) uses a flat class loading

Follow us on Twitter