Sunday 3 July 2016

WildFly Interview Questions and Answers

WildFly Application server (previously know as JBoss) implements JAVAEE specification. For interview purpose, here are some questions along with its answers.


What is WildFly 

WildFly is an open source application server based on JaVA EE technology. Being JAVAEE based, it can run on cross-platform. It was embedded with Apache Tomcat web server. It runs under any JRE version of 1.3 or later . WildFly supports JNDI, Servlet/JSP (Tomcat or Jetty), EJB, JTS/JTA, JCA, JMS, Clustering (JavaGroups), Web Services (Axis), and IIOP integration (JacORB).


Define WildFly cache? 

Caching usuall comes into picture when there are frequent access to some objects. Likewise, multiple and frequently accessed Java objects are cached by using WildFlycache to improve the performance of e-business applications. 


What is WildFly JBPM? 

WildFly JBPM is a workflow and Business Process Manager engine. As a BPM engine, it enables the creation of business processes that coordinates between people, applications and services. The combination of workflow applications development with process design is a feature of WildFly JBPM. The business process has GUI (Graphical User Interface) to facilitate a strong link between the business analyst and technical developer. This feature is provided by the WildFly JBPM process designer.


How do you monitor WildFly and detect the bottleneck of an application? 

At first, you need to measure different components of the application and then observe where the degradation is, and whether it is internal or external and which component is consuming maximum cpu. Using Joss JMX agents and monitoring the deployed components to the application server involves in the first step.

After observing which specific components or libraries spent most of time, one can then use Jprobe to examine that single object or the objects loaded in the memory.


What is JTA? 

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. It allows applications to perform distributed transactions, that is, transactions that access and update data on two or more resources.It 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.


Which Hibernate object wraps the JDBC Connection? 

The Session interface wraps a JDBC Connection which is a single threaded object representing a single unit for application and persistent database. You can get the Session object from SessionFactory's openSession() method


Is the Session Factory Thread safe? 

Yes because many threads can simultaneously access it and request for sessions. It holds cached data that has been read in one unit of work and is likely to be reused in future unit of work. The best practice to create Session Factory object is when the application is initialized.


How can you start a JTA transaction from a Servlet deployed on WildFly

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


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.


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 (POJO), 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

What is the difference between a local-tx-datasource and a xa-datasource? can you use transactions in both? 

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 transaction among multiple application servers.

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


Which component handles cluster communication in WildFly ?

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.


Is it possible to put a WildFly server instance into multiple cluster at the same time? 

It is technically possible to put a WildFly server instance into multiple clusters at the same time, this practice is generally not recommended, as it increases the management complexity.


What do you know about Seam? 

Built on the standards JavaServer Faces and EJB 3.0, WildFly Seam unifies component and programming models and delivers a consistent and powerful framework for 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.


Which JDK is needed to run Seam? 

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


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


What do you think about BPEL and BPM ? How do they compare? 

In my opinion BPEL and BPM are quite different things so they cannot even be compared. The problems boils 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 for service orchestration, that is publishing new services as a function of other services.
while BPM si needed for handling human task management functionalities and subprocess management.


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

Can I run Seam in a JAVAEE environment? 

Yes, as of Seam 1.1, you can use Seam in any JAVAEE 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.


Can I run Seam with JDK 1.4 and earlier? 

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


Where can I find Seam examples and documentation? 

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


Is it true that Seam only works with JSF? 

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


Can I use AJAX with Seam? 

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. 


Can I unit test Seam applications without starting the Application Server?

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.


No comments:

Post a Comment