JNDI interview questions for experienced/JNDI Interview Questions and Answers for Freshers & Experienced

How do you check how much memory and CPU your Java process is consuming?

First, you need to find the PID of your process, which you can find by using the "ps" command as shown in the previous question. Once you find the PID you can use the "top" command to find the CPU and memory usage. Alternatively, you can also use the prstat command as shown here.

What is the difference between Apache httpd and Tomcat?

Though both httpd and Tomcat are products of Apache software foundation, the httpd is more popular and used across the web and not just in the Java world. The httpd is a web server that can serve static HTML files and dynamic content using PHP, Perl, or Python, while Tomcat is a Servlet container that provides the runtime environment for Servlet and JSP. You can also use both Apache httpd and Tomcat together in Java world.

Which JMS Provider have you worked with? Like IBM's WMQ, Apache Active MQ, Sonic MQ, etc

This messaging question is normally asked at the start of the interview, to get an idea of whether you have practical experience in JMS or not. If you have used JMS then, it must be via a JMS provider like Websphere MQ from IBM or Tibco EMS. You can answer this question based upon your experience with a particular JMS Provider.

Suppose your application is communicating with another application using JMS and sending and receiving XML messages. What will you do to improve performance?

Well, large XML messages really consume a lot of bandwidth, when they are transferred from client to broker (JMS Provider) and further from broker to recipient. You can reduce this bandwidth by compressing messages before sending it on the client-side.

Since XML messages compress a lot, it's worth doing at the client-side with the expense of some CPU time. Java even provides a compression facility in form of java.util.zip package. But remember that compression and decompression on both the sender and receiver side must use the same algorithm.

Also, If you are using the PERSISTENT delivery mode, then messages are persisted on the server-side, before delivering to consumers, compressed messages take less time and space on the server-side during persistence.

What is JMS Selector? How does it work? Any example of Using JMS Selector?

JMS Selector is a filtering facility provided by JMS Provider or broker. Suppose a client is only interested in listening to some specific messages and not all traffic from Server than it can either filter messages upon receiving, or it can use JMS selector to do the filtering on Broker itself. JMS Selector allows you to specify filtering criteria in the form of String, which is a subset of SQL conditional expression.

For example, if you are interested in messages which are for stocks starts with A, you can specific condition as SYMBOL like "A%", where SYMBOL is a user-defined Message property set by Sender.

Does JMS Session object is thread-safe? Can we share JMS Session among multiple threads?

A Session object in JMS is a single-threaded context for creating message producers and consumers. It's not thread-safe, and not advised to share among multiple threads.

Describe the concept of Message Driven Bean Clustering.

If an EJB component-based application is deployed on any application server cluster, then it can be configured to run on any server inside the cluster to provide availability and scalability for the application.

If an EJB is in the form of Message Driven Bean (MDB), then it can run on any server inside the cluster and can be initiated parallel to a number of application servers in the cluster.

What is the functionality of the Oracle Glassfish server? What added advantage it has on top of Apache Tomcat server?

Glassfish server is actually an application server and can be also used as web servers which means it can handle HTTP requests from the web browsers.

As an application server, it is developed to handle all types of Java Enterprise applications in terms of servlets/JSP and also EJB components.

Whereas, Tomcat server is actually a servlet container that is generally used for handling servlet or JSP components.

For sending messages through JMS, what encryption options are there?

The encryption and decryption of the messages is handled by JMS provider and not JMS specifications. Sonic MQ by Progress Software is a leading JMS provider and they do encryption through encryption mechanisms called Quality of Protection.

How you can deliver a java message to a non-java client?

First of all, after receiving the message from Topic or Queue, the message has to be converted into a non-java client according to their specification. The message once converted to non-java client, it can be delivered.

What is MOM in reference to JMS?

The MOM ( Message Oriented Middleware) is a software that works as an intermediate between two communicating components. It is placed between the client and server, MOM provides the facility of passing message by using the technique queuing. Until the client does not request to read the message, the messages will be stored in queue. By using this technique, the software component can work independently of time.

What happens if a durable subscriber is not running? will JMS Server discard the message?

A durable subscription is created by the subscriber to ensure that it receives all the messages published by the publisher, even during the period when the Receiver is inactive or down. JMS Provider or Broker will retain all messages published by a publisher for a durable subscriber until messages get acknowledge or expired.

What is the functionality of a JMS Queue Browser?

As we have previously discussed the concept of the queue, where the message is stored until the receiver receives it. The functionality of browsing the messages in the queue and displaying the header values is supported by the QueueBrowser object.

One can create a QueueBrowser object via. JMS session.

JMS Queue Browser

What is the JMS Client?

The JMS client is basically a component written in the Java programming language which is responsible for invoking and consuming message bodies.

What is the functionality of a message Listener in the context of JMS?

Message Listener is typically used with message consumer in the case of asynchronous delivery. For asynchronous delivery one can register an object of MessageListener with messageConsumer.

If you have a transacted session what happens if you get an exception while processing a message?

If JMS Session is transacted, in which case it returns SESSION_TRANSACTED from getAcknowledgeMode(), acknowledgment mode is ignored.

In transacted sessions, commit() and rollback() methods are used for committing receipt of a message. A call to commit(), confirms receipt of all messages on that session.

Similarly, if an Exception is thrown from onMessage(), it would be considered as rollback, and the message will remain in Queue for delivery.

Does JMS support Guarantee message delivery?

JMS provides different options to guarantee message delivery like PERSISTENT and NON_PERSISTENT deliver mode to guarantee the message is not lost during transportation. IT also provides JMS provider to specify retention policy for Queue and Topic, which can retain messages until it acknowledged or expired, or till certain delivery attempt. durable subscription is another way to ensure your Receiver, receives a message even if it is inactive when the publisher publishes the message.

What is the difference between the P2P (Peer to Peer) model and subscribe model?

P2P model is highly reliable and it is used in a one-to-one situation, while subscribe model is used in one-to-many situation. It is very fast but less reliable.

Mention different types of messages available in JMS API?

The different types of messages available in JMS API are Message, TextMessage, BytesMessage, ObjectMessage and MapMessage.

What is JNDI? How is it related to JMS?

JNDI is the Java Naming and Directory Interface. If an application is connected to a database, it allows the application developer to give a name to that database instead of worrying about the database connection credentials.

The JNDI API will access the naming directory and will find the mapping between the name and the database object and connect accordingly. We can use this mechanism while we are connecting to any connectionFactory (queue or topic) for sending messages.

Difference between Topic and Queue in JMS?

Topic and Queue are two kinds of destination, where a Sender sends messages. in Point to Pointe messaging, also known as PTP messaging, Sender and Receiver communicates using Queue, while on publish-subscribe messaging, also known as pub/sub messaging, Receiver subscribes on a Topic.

The topic is used, when more than one consumers are interested in receiving the same messages. In JMS, both Queue and Topic are interfaces, which extend Destination and subsequently encapsulate the name of the Topic or Queue.

Since Destination is a JMS administrated object, the creation of Topic and Queue is usually governed by JMS Provider administrator. Usually messaging or middleware team, which administers broker, creates Topic and Queue on request of the application team and allows them to access using JNDI.

A JMS client can specify a Queue or Topic name while creating Message Producer or Consumer e.g. by using Session.createConsumer(Destination queueOrTopic) or Session.createProducer(Destination queueOrTopic).

What is Byte Message?

Byte message is a stream of uninterrupted bytes. It contains an array of primitive bytes in its payload. For the transfer of data between two applications in their native format, byte message is used, which may be not possible with other message types.

What is Byte Message?

Byte message is a stream of uninterrupted bytes. It contains an array of primitive bytes in its payload. For the transfer of data between two applications in their native format, byte message is used, which may be not possible with other message types.

Mention the difference between durable and non-durable subscription?

Durable subscription gives a subscriber the freedom of receiving all messages from a topic, while a non-durable subscription does not make any guarantees about messages sent by others when a client get disconnected by others.

What is the principle difference between the working mechanism of JMS and RPC?

The identifiable difference between the two models lies between the way in which the message is delivered.

In the case of JMS, the sender application sends the message to the destination application and then it again waits/or processes another message as per the programming criteria.

While in the case of RPC, the thread is completed once the message reaches the destination and the control comes back to the method responsible for message transport.

What is the number of messaging models available on JMS?

Specifically, there are two types of model provided by JMS:

Point to Point: As the name itself suggests it is a one to one messaging mechanism, where the sender sends a message to a single receiver. The message is available to the receiver application once it’s ready and until then the message is stored in the queue.

The most important part of it is there are zero dependencies with respect to time between both the sender and the receiver application.

Publish and Subscribe: This messaging mechanism is very uniquely designed by JMS.

For Example, one reader subscribes to one blog where the person is interested. Now there may be several people interested in a particular blog.

And they subscribe/register to that blog. Now once a new post or topic is published on the blog, all the registered readers will get an update. This messaging model is called Publish and Subscribe.

Difference between synchronous and asynchronous messaging? How do you do that in JMS?

As the name suggests synchronous messaging is synchronous, which means Sender waits for a response from the Receiver, instead of doing anything else. On the other hand in Asynchronous processing, Sender just sends the message and starts doing other things, instead of waiting for a response like maybe send another message. JMS supports both synchronous and asynchronous messaging.

What are the types of communication provided by JMS? Explain in detail.

This API provides two types of communication:

Asynchronous: The message will be delivered to the client, it is not required for the client to send requests in order to receive it. The client application will receive it once the sender application transmits.

Reliable: Here the message is sent to the client application once the API protocol ensures the availability of the receiver application.

What is JMS?

Java Messaging Service is a Java API, which enables the systems to create, read, send and receive messages.

The most important part of the algorithm is very well structured and allows one application to send a message to another application and also enables broadcasting features to the subscribers.

What are the components of JMS?

* JMS provider
* JMS client
* Messages
* Administered objects
* Native clients

What is the role of the JMS provider?

The JMS provider handles data conversion, security of the messages and the client triggering. It specifies the level of encryption, security level of the message and the best-data type for the non-JMS client.

Explain the difference between topic and queue?

Queue technique is used for one to one messaging, and it supports point to point messaging. While topic is typically used for one to many messaging and it supports public subscribe model of messaging.

How many types of messaging model do JMS provide for and what are they?

There are two types of messaging models that JMS provides –

<> Point to point queuing
<> Second one is publish and subscribe

How do I make a Wlfullclient jar?

1. Change directories to the server/lib directory. cd WL_HOME/server/lib.
2. Copy wlclient.jar to "weblogic-classes.jar" cp wlclient.jar weblogic-classes.jar.
3. Use the following command to create wlfullclient.jar in the server/lib directory: ...
4. Delete the "weblogic-classes.

What is the use of Wlfullclient jar?

For WebLogic Server 10.0 and higher releases, client applications should use the wlfullclient. jar file to provide the WebLogic Server specific functionary previously provided in the weblogic.

What is Wlclient jar?

jar deployed with the wlclient. jar) , provides Java EE and WebLogic JMS functionality using a much smaller client footprint than the full WebLogic JAR. The smaller footprint is obtained by using: A client-side library that contains only the set of supporting files required by client-side programs.

How do I find JNDI resources on WebLogic?

sql. DataSource) context. lookup("java:comp/env/jdbc/myDataSource"); if the resource reference name is jdbc/myDataSource ). To avoid having to change your legacy code I think if you register the datasource with the name myDataSource (remove the jdbc/ ) you should be fine.

Where is JNDI name in WebLogic console?

1. Click the Servers node to expand it and expose the names of the servers currently being administered through the console.
2. Click the name of the server whose JNDI tree you want to view.
3. Scroll down to the bottom of the Configuration pane, and Click the "View JNDI Tree" link.

How does a two phase commit work?

Unlike a transaction on a local database, a distributed transaction involves altering data on multiple databases. During the commit phase, the initiating node asks all participating nodes to commit the transaction. ... If this outcome is not possible, then all nodes are asked to roll back.

Is @transactional mandatory?

Propagation. REQUIRED is the default propagation mode of Transaction, so you don't need to explicitly set it.

What is transactional example?

Examples of the transactional model include a face-to-face meeting, a telephone call, a Skype call, a chat session, interactive training, or a meeting in which all attendees participate by sharing ideas and comments.

What is JNDI provider URL?

provider. url : The name of the environment property for specifying the location of the JBoss JNDI service provider the client will use. The NamingContextFactory class uses this information to know which JBossNS server to connect to. The value of the property should be a URL string.

Where is JNDI tree in WebLogic?

To View the JNDI Tree Structure

1. Expand Environment from the Domain tree structure on the left panel of the console.
2. Select Servers from the tree structure. ...
3. Click on exampleServer(admin). ...
4. Click on View JNDI Tree to open the JNDI Tree window. ...
5. Click on Examples, select Deployments, and click on EJB.

R4R Team
R4R provides JNDI Freshers questions and answers (JNDI Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers, JNDI interview questions for experienced,JNDI Freshers & Experienced Interview Questions and Answers,JNDI Objetive choice questions and answers,JNDI Multiple choice questions and answers,JNDI objective, JNDI questions , JNDI answers,JNDI MCQs questions and answers Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for JNDI fresher interview questions ,JNDI Experienced interview questions,JNDI fresher interview questions and answers ,JNDI Experienced interview questions and answers,tricky JNDI queries for interview pdf,complex JNDI for practice with answers,JNDI for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .