JBoss Interview Questions
1Q) What is JBoss?
Ans: JBoss is a popular open-source application server based on JEE technology. Being JEE based, the JBoss supports cross-platform java applications. It was embedded with the Apache Tomcat web server. It runs under any JVM of 1.3 or later versions. JBoss supports JNDI, Servlet/JSP (Tomcat or Jetty), EJB, JTS/JTA, JCA, JMS, Clustering (JavaGroups), Web Services (Axis), and IIOP integration (JacORB).
2Q) What is JBoss cache in short?
Ans: JBoss cache is a product. Frequently accessed Java objects are cached by utilizing JBoss cache to improve the performance of e-business applications. JBoss decreases the network traffic and increases the scalability of applications by eliminating unnecessary database access. Fully transactional features and a highly configurable set of options which are to deal with concurrent data access are provided by JBoss cache in an efficient manner possible for the applications.
Inclined to build a profession as JBoss? Then here is the blog post on, explore "JBoss Training"
3Q) What is JBoss JBPM?
Ans: JBoss JBPM is a workflow and BPM engine. Enabling the creation of business processes that coordinates between people, applications and services is the functionality of the BPM engine. The combination of workflow application development with process design is a feature of JBoss jBPM. The business process is graphically represented to facilitate a strong link between the business analyst and technical developer. This feature is provided by the JBoss jBPM process designer.
4Q)How do you monitor JBoss and detect the bottleneck of an application?
Ans: Different components of the application are to be measured. This step is to find where the degradation is, whether it is external or internal and where is the application spending all the time. Using Jboss JMX agents and monitoring the deployed components to the application server involves in the first step.
After finding the most of the time spent by specific components or libraries or most of the resources, one can use Jprobe a specialized tool for examining the single object or the objects loaded in the memory.
5Q) What is JTA?
Ans: 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.
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.
6Q) What is the difference between Hibernate and EJB 3? Do not you think EJB 3 is just a clone of Hibernate?
Ans: The perception of EJB3 as being a simple clone of Hibernate is primarily based on developer familiarity with Hibernate and similarity of naming, as well as a 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 component. These services are, among others, transactions, concurrent access control, security, instance pooling, etc.
Hibernate is "just" an ORM (Object/Relational Mapping) tool. Quick and dirty, this means you can store an object tree belonging to a 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.
7Q) Which Hibernate object wraps the JDBC Connection?
Ans: 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
8Q) Is the Session Factory Thread-safe?
Ans: Yes, that is many threads can access it concurrently and request sessions. It holds cached data that has been read in one unit of work and maybe reused in a future unit of work. A good practice is to create it when the application is initialized.
9Q) How can you start a JTA transaction from a Servlet deployed on JBoss?
Ans: JBoss registers in the JNDI tree a JTA UserTransaction object which can be useful to manage a distributed transaction.
10Q) What if you need to span your transaction across multiple Servlet invocations?
Ans: 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 an SFSB with a JTA transaction, the association between the bean instance and the transaction is retained across multiple client calls.
11Q) What are the differences between EJB 3.0 and EJB 2.0?
Ans: 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 exceptions. -A complete new persistence model (based on the JPA standard), that supersedes EJB 2.x entity beans
12Q) What is the difference between a local-tx-datasource and a xa-datasource? can you use transactions in both?
Ans: A local-tx-datasource identifies a data source that uses transactions, even distributed trans actions within the local application server, but doesn't use distributed transactions among multiple application servers. An xa-datasource on the other hand identifies a data source that uses distributed transactions among multiple application servers.
13Q) What do you need to set-up a cluster with JBoss?
Ans: 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
14Q) What optimization could I use if the EJB container is the only point of write access to the database?
Ans: 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 persistent store and therefore it doesn't need to synchronize the in-memory bean state from the persistent store at the beginning of each transaction.
15Q) Which component handles cluster communication in JBoss?
Ans: 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.
16Q) Is it possible to put a JBoss server instance into multiple clusters at the same time?
Ans: It is technically possible to put a JBoss server instance into multiple clusters at the same time, this practice is generally not recommended, as it increases the management complexity.
17Q) What do you know about Seam?
Ans: Built on the standards Java Server Faces and EJB 3.0, JBoss Seam unifies component and programming models and delivers a consistent and powerful framework for the rapid creation of web applications with Java EE 5.0. Seam simplifies web application development and enables new functionality that was difficult to implement by hand before, such as stateful conversations, multi-window operation, and handling concurrent fine-grained AJAX requests. Seam also unifies and integrates popular open source technologies like Facelets, Hibernate, iText, and Lucene.
18Q) Does Seam run on other application servers besides JBoss?
Ans: The seam runs beautifully on other application servers - just like everything else the Hibernate team does, this is not a JBoss-only thing.
19Q) Which JDK is needed to run Seam?
Ans: Seam only works on JDK 5.0 and above. It uses annotations and other JDK 5.0 features.
20Q) How would you convince my IT department to adopt SOA?
Ans: In my opinion, one of the biggest obstacles 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 lose coupling demands a shift from traditional, waterfall styles of development (design-build-test-deploy-manage) to iterative approaches to continuous Service modeling
21Q) What do you think about BPEL and BPM? How do they compare?
Ans: BPEL and BPM are quite different things so they cannot even be compared. The problems boil down to the fact that these years maybe BPEL has been marketed for something which isn't: that is a Business Process Management framework.
BPEL is made up of service orchestration, which is publishing new services as a function of other services. while BPM si needed for handling human task management functionalities and subprocess management.
22Q) What is the difference between JAX--WS and JAX-RPC?
Ans: 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 the 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 is missing in JAX-RPC.
JAX-WS also add support, via JAXB, for MTOM, the new attachment specification.
23Q) Do you know how you could add support for Web Service transactions?
Ans: 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.
24Q) What version of JBoss AS do I need to run Seam?
Ans: For Seam 1.3: Seam was developed against JBoss 4.2. The 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. Refer to examples in Seam distribution (inside the examples directory) to see how to build and package Seam applications.
25Q) Can I run Seam outside of JBoss AS?
Ans: Yes, you can run Seam applications in plain Tomcat 5.5+ or in the Sun GlassFish application server. To run the Seam application in Tomcat, you need a number of additional library files and a few configuration files to bootstrap the JBoss EJB3 inside Tomcat. Please refer to the deployment.tomcat ANT build target for the Seam booking example (in the examples/booking directory of the Seam distribution) for more on how to build a Tomcat WAR for Seam applications. Refer to this blog post on how to run Seam in Sun's Glassfish application server.
26Q) Can I run Seam in a J2EE environment?
Ans: 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.
27Q) Can I run Seam with JDK 1.4 and earlier?
Ans: No, Seam only works on JDK 5.0 and above. It uses annotations and other JDK 5.0 features.
28Q) Where can I find Seam examples and documentation?
Ans: The source code and build script of all Seam example applications are included in the examples directory of the Seam distribution.
29Q) Is it true that Seam only works with JSF?
Ans: 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 application performance, and allows us to write much simpler JSF pages. Please see the Seam booking example application for an example of how to use Facelets.
30Q) Can I use AJAX with Seam?
31Q) Can I unit test Seam applications without starting the Application Server?
Ans: Yes, Seam provides its own integration test framework based on TestNG. You can easily mock all Seam services using those facilities without ever loading an application server or a database. Refer to the test example ANT target in the Seam booking example application for more details
For an in-depth understanding on JBoss click on: