Best 48 Jboss Interview Questions And Answers Pdf

1. What Is Jta ? (Jboss Interview Questions And Answers Pdf)

Answer :

Java Transaction API (JTA) specifies standard Java interfaces between a transaction manager and the parties involved in a distributed transaction system: the resource manager, the application server, and the transactional applications. (Jboss Interview Questions And Answers Pdf)

The Javaâ„¢ Transaction API (JTA) allows applications to perform distributed transactions, that is, transactions that access and update data on two or more networked computer resources.

The Java Transaction API consists of three elements: a high-level application transaction demarcation interface, a high-level transaction manager interface intended for an application server, and a standard Java mapping of the X/Open XA protocol intended for a transactional resource manager.

Jboss Interview Questions And Answers Pdf

2. What Are The Differences Between Ejb 3.0 And Ejb 2.0 ?

Answer :

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.
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

3. What Version Of Jboss As Do I Need To Run Seam ?

Answer :

For Seam 1.3: Seam was developed against JBoss 4.2. Seam can still be run against JBoss 4.0. The seam documentation contains instructions for configuring JBoss 4.0.

For Seam 1.2: Since Seam requires the latest edition of EJB3, you need to install JBoss AS from the latest JEMS installer. Make sure that you select the “ejb3” or “ejb3+clustering” profile to include EJB3 support. Also, the jboss-seam.jar library file from the Seam distribution must be included in each Seam application you deploy.

4. Can I Run Seam Outside Of Jboss As ?

Answer :

Yes, you can run Seam applications in plain Tomcat 5.5+ or in the Sun GlassFish application server. To run Seam application in Tomcat, you need a number of additional library files and a few configuration files to bootstrap the JBoss EJB3 inside Tomcat.

5. Can I Run Seam In A J2ee Environment ?

Answer :

Yes, as of Seam 1.1, you can use Seam in any J2EE application server, with one caveat: you will not be able to use EJB 3.0 session beans. However, you can use either Hibernate or JPA for persistence, and you can use Seam JavaBean components instead of session beans.

6. Where Can I Find Seam Examples And Documentation ?

Answer :

The source code and build script of all Seam example applications are included in the examples directory of the Seam distribution.

7. Is It True That Seam Only Works With Jsf ?

Answer :

Seam only supports JSF as a view framework at this time. We plan to support other web frameworks in the future. We like JSF because it is a component-based UI framework, which fits really well with Seam’s component-based approach to business objects and persistence objects. Seam made a major improvement to JSF by eliminating almost all XML configuration for backing beans — you can now define back beans from POJOs or EJB3 components using simple annotations.

We recommend you use Facelets, instead of JSP, with JSF. Facelets provide a powerful templating framework, better appplication performance, and allows us to write much simpler JSF pages. Please see the Seam booking example application for an example on how to use Facelets.

8. Can I Use Ajax With Seam ?

Answer :

Yes, Seam provides excellent support for AJAX. First, Seam supports the ICEfaces and Ajax4JSF Ajax component libraries for JSF. If you prefer a more “old fashioned” approach, Seam provides a complete JavaScript remoting framework which lets you call Seam components and subscribe to JMS topics directly from the client.

Jboss Interview Questions And Answers Pdf

9. What are the different types of log levels that are used in logging services in JBoss ?

Answer :

There are four different types of log levels that are used to show the services that are present inside the logging in JBoss. The log levels are as follows:
1. Debug: In this level the file gets debugged for possible errors. This can either be automatic or manual as it doesn’t affect the file in any way.
2. Info: At this level the complete detail information is provided about the process that is running in the background. It consists of details like name of the process, CPU usage, etc.
3. Warn: At this level the warning that has come in the file that might hinder the performance on some systems are given and it is displayed with some critical signs to aware the user to see the warning and take necessary actions if required.
4. Error: At this level during the compilation of the error there are some errors shown that can be syntactical error or logical errors. These errors have to be fixed before completing the compilation process.

Top 52 Jboss Interview Questions And Answers

10. What is meant by logging threshold in JBoss ?

Answer :

The logging threshold is given as INFO as it is a level on which all the informational messages, warning messages and error messages on the console are produced and shown, but not the debug messages. It is managed through the file as there is no threshold set for the server.log file. The generated logging messages will be stored in that section to provide all the information from one place. The log files are always checked in case of any errors that are produced due to some information on the debug messages that can help in tracking down the problem. The logging threshold allows the debug messages to be displayed with the complete information about the log files. The logging limits are set for individual categories.

11. What are the main directories provided in JBoss ?

Answer :

The main directories that are provided in JBoss directory structure are as follows:
1. bin – It consists of system executable and normal files that are for execution purpose. It consists of binary files for every program that is installed on the system.
2. client – It consists of all the configuration files that are stored and jar files that can be required by the Java client application.
3. docs – It consists of the XML documents with the DTDs for the reference. These documents provide the basic specification related to the installation and deployment of JBoss.
4. lib – This consists of jar files that are required to run the JBoss microkernel. This is directory is not for any user as it consists of the kernel and system libraries.
5. server – This consists of different server configuration files. The files are in the script format.

12. Write a program to show the security domain feature to cover the application in JBoss ?

Answer :

The security domain provides features through which the server can be protected. This is done using the file jboss-web.xml this can be used to deploy in jmx-console.war/WEB-INF/ directory. JBoss uses JAAS services to provide the pluggable authorization modules and the code that is given below explains it as well:

This links to the security domain where the web application can be connected and security policies can be applied to it. URLs are trying to protect the server configuration that is allowed to configure the web.xml file in the same directory and the security constraints are put together to provide the user name and password as well.

13. What Is The Difference Between Jax–ws And Jax-rpc ?

Answer :

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.

14. What’s The Difference Between A Tar File And A War File ?

Answer :

TAR – derived from tape archive is a file format to archive bitstreams and name of a program to handle such files. It is commonly used to collect many files into one large file for distributing or archiving while preserving the filesystem info.
WAR – web application archive is a jar file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, xml files, tag libraries, static web pages (html & others) and others resources that constitute a web application.

15. How Do You Enable/disable A Hot Deployment ?

Answer :

To enable, put file hdscanner-jboss-beans.xml in JBOSS_HOME/server//deploy
To disable hot deployment, remove the hdscanner-jboss-beans. xml from the deploy folder or rename it to hdscanner-jbossbeans. xml.bak (.bak files are ignored).

16. What must be done to access Admin Console ?

Answer: The user must be created under “ManagementRealm” to have console operational. To create the user, you can go to bin folder and execute add-user.sh script.

Jboss Interview Questions And Answers Pdf

17. Write a program to show the security constraints that show the role of the user and the admin in using the server ?

Answer :

The security constraints that are have restrictive access to the HTML JMX console and it allows few users with specified roles to be the JBossAdmin. The modification in the roles can be done and the file can be edited to modify the security domain element to enable the secured feature of the services.

18. How Do You Deploy An Application To Jboss ?

Answer :

Choose the server profile to which you want to deploy the application

Copy your application (for example: .war or .ear or a .jar file) to JBOSS_HOME/server//deploy folder.
Start the server: (./run.sh)
JBoss will deploy your application when it boots up.

19. Explain with an example the implementation of source queue for MDB ?Answer :

The implementation of the source queue for MDB is used to be the container specific file that consists of information regarding the queue like queue name for MDB that resides in jboss.xml and the source file that is used with it remains in the queue till the message is not being transferred by the server. The server executes the file and keeps a log file to maintain all the information. The modification can be done by using the source queue. If any additional information, be required using the source queue then message driven beans allow the use of extra parameters like destination, name, etc. to describe the objects.

20. What is the directory structure in JBoss ?

Answer :

The following directories are available after JBoss is installed.

modules
bundles
domain
standalone
appclient
bin
docs

21. Can you use Environment variables in your configuration ?

Answer :

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:

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 127.0.0.1

22. Which Hibernate object wraps the JDBC Connection ?

Answer :

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.

23. What is an L1 cache and when I am allowed to use it ?

Answer :

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.

24. What’s the difference between JAX-WS and JAX-RPC ?

Answer :

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.

Jboss Interview Questions And Answers Pdf

25. Write a program to show how to set the username and password using the security domain in JBoss.?

Answer :

The username and password is required for the security purpose to produce at the logging time. The user name and passwords gets stored in the JMX console security domain that manages the application. The configuration file can be provided using the login-config.xml. The program that is being written in which the modification can be done is shown below:

This is the configuration file that uses simple file based security policy and found in the config directory. It consists of the server configuration and the properties that is required to assign the user about the files.

26. What’s the difference between Standalone mode and Domain mode ?

Answer :

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

27. What if I remove the ExampleDS default Datasource ?

Answer :

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.

<default-bindings
context-service=”java:jboss/ee/concurrency/context/default”
datasource=”java:jboss/datasources/ExampleDS”

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

Answer :

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.

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

Answer :

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.

30. Ok, is the Session Factory Thread safe ?

Answer :

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.

31. What is the difference between load and get in Hibernate ?

Answer :

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.

32. How can I persist the cache of my Stateful EJBs in a Database ?

Answer :

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.

Jboss Interview Questions And Answers Pdf

33. What happens if there’s a concurrent access to an Entity in a clustered application ?

Answer :

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.

34. Why you should never put just the IP address in a network interface definition ?

Answer :

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

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.

35. What is the diffrence between a JTA datasource and an XA Datasource ?

Answer :

Let’s take this example:

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 {
entityManager.persist(movie);

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] (https-/127.0.0.1:8080-1) 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.

36. Which Jdk Is Needed To Run Seam ?

Answer :

Seam only works on JDK 5.0 and above. It uses annotations and other JDK 5.0 features.

37. What is the purpose of JMS and Message-Driven Beans in JBoss ?

Answer :

JMS is used for messaging system and it also consists of message driven beans that is used in JBoss. This consists of the MDB concepts that are used in the jboss-build.xml file. This JSM (Java message service) provides a middleware orientation to send message between two or more clients. JMS is a part of Java Platform that is used to develop the application that is under the java platform. This also allows the application components to be based on the Java Enterprise Edition (JEE). It handles the creation, sending, receiving, and reading the messages. It also allows the communication between many different components that are distributed in many parts and are loosely coupled, reliable and asynchronous message passing. (Top 52 Jboss Interview Questions And Answers)

38. Can you create a cluster in standalone mode ?

Answer :

Yes, clustering is possible in standalone mode. However, an application must be deployed on each server/JVM in standalone mode.

39. Can I run Seam with JDK 1.4 and earlier ?

Answer :

No, Seam only works on JDK 5.0 and above. It uses annotations and other JDK 5.0 features.

40. What Do You Need To Set-up A Cluster With Jbos ?

Answer :

Basically starting JBoss with the configuration contains everything needed for clustering:

It has all the libraries for clustering:

JGroups.jar, jboss-cache.jar.
Clustered beans (cluster-service.xml).
HA-JNDI.
HTTP session replications (tc5-cluster-service.xml).
Farming.
HA-JMS.

Jboss Interview Questions And Answers Pdf

41. What marker file type is required to instruct JBoss to deploy ?

Answer :

dodeploy file suffix is needed for JBoss to deploy or redeploy an application.

42. What are the file types you can deploy in JBoss ?

Answer :

You can deploy almost any kind of Java/J2EE application, and it supports the following file format.

WAR – Web application archive
SAR – Service archive
JAR – Java Archive
EAR – Enterprise application archive

43. What module needed to integrate Apache with JBoss ?

Answer :

There are two modules you can use to connect JBoss with Apache.

mod_proxy
mod_jk

44. How can you configure the time for the hot deployer ?

Answer :

“scanPeriod” in hdscanner-jboss-beans.xml

45. How do you setup JBoss cluster ?

Answer :

Getting started with JBoss clustering is very simple. If two JBoss server instances using the all configuration are started on the same network, those servers will detect each other and automatically form a cluster.

Two application servers running on the same network detect each other auto and form cluster.

46. What are the logging levels available ?

Answer :

There is five possible level:

FATAL
ERROR
WARN
INFO
DEBUG

47. What’s the difference between Hibernate and EJB 3 ? Don’t you think EJB 3 is just a clone of Hibernate ?

Answer :

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.

48. What is the process of compiling and packaging the MDB files ?

Answer :

To compile the files of MDB (Message driven beans) first there need to be compilation process that will take place invoking the compile-mdb that targets the simplemessage directory. It produce the targets to be made archives for the bean and the client uses the file that is in the JAR directory. The commands that are used to compile the files are as follows:
ant -f jboss-build.xml package-mdb
ant -f jboss-build.xml package-mdb-client
ant -f jboss-build.xml assemble-mdb
These files that are used and made by the command gets combined in the directory and that directory will be called as the package. It consists of the deployment descriptors that are used in the jar directory containing all the archives that are produced by the build of the MDB files.

Check Demo Sesstion

Check More Tutorial Videos