Latest Bea Weblogic Server Interview Questions Part – 3
How Should I Use Sorted Queues?
Destination keys are used to define the sort order for a specific destination. Destination keys can be message header or property fields. For a list of valid message header and property fields, refer to the Programming WebLogic JMS.
Queues can be sorted in ascending or descending order based on the destination key. A destination is considered to be first-in-first-out if a destination key is defined as ascending for the JMSMessageID message header field, and last-in-first-out if defined as descending. The key defined for the JMSMessageID header field, if specified, must be the last key defined in the list of keys.
You can define multiple destination keys to sort a destination.
How Do I Get A Thread Dump To Help Track Down A Problem?
Ways to get a thread dump:
Try running this from the command line (after running the setEnv script in /bea/wlserver6.1/config/mydomain/):
java weblogic.Admin -url t3://localhost:7001 THREAD_DUMP
On Windows, from the console window, enter Ctrl+Break.
On UNIX, signal the server using kill -3.
Why Do I Get An Exception When Trying To Find A Connection Factory?
The exception is usually something like java.io.InvalidClassException or java.lang.NoClassDefFoundError.
Make sure weblogic.jar is in the CLASSPATH of the client. Also make sure you have the correct Java run-time jar files included (i.e., you might need rt.jar).
What Is The No_acknowledge Acknowledge Mode Used For?
The NO_ACKNOWLEDGE acknowledge mode indicates that received messages do not need to be specifically acknowledged which improves performance, but risks that messages are lost.
This mode is supported for applications that do not require the quality of service provided by session acknowledge and that do not want to incur the associated overhead. v Messages sent to a NO_ACKNOWLEDGE session are immediately deleted from the server.
Messages received in this mode are not recovered and, as a result, messages may be lost and/or duplicate message may be delivered if an initial attempt to deliver a message fails.
Note:
You should avoid using this mode if your application cannot handle lost or duplicate messages. Duplicate messages may be sent if an initial attempt to deliver a message fails.
In addition, we do not recommend that this acknowledge mode be used with persistent messaging, as it implies a quality of service that may be too low for persistent messaging to be useful.
When Should I Use Server Session Pools And Connection Consumers?
WebLogic JMS implements an optional JMS facility for defining a server-managed pool of server sessions. This facility enables an application to process messages concurrently. A ConnectionConsumer object uses a server session to process received messages.
If message traffic is heavy, the connection consumer can load each server session with multiple messages to minimize thread context switching. Multiple connection consumers can share server sessions in a server session pool.
How Do I Publish An Xml Message?
Follow these steps:
Generate XML from the DOM document tree.
Serialize the generated DOM document to a StringWriter.
Call toString on the StringWriter and pass it into message.setText.
Publish the message.
What Is The Standard Way To Create Threads, Do Initialization, Etc. Within The Application Server?
Threads should generally not be created by the user directly is because things may not work correctly. User-created threads do not have some of the thread-local variables pre-set by WebLogic when it creates it’s own execute threads, the associated transaction context, or the environment such as the proper class loader.
The WebLogic-specific way of doing this is with a startup class or using the WebLogic Time Services. The portable way to do this is to define a load-on-startup servlet, doing the initialization in the init() method and the cleanup in the destroy() method.
The servlet itself does nothing. This approach also allows for undeploy/redeploy of the application without restarting the server, including proper cleanup/initialization each time. It also providers more dynamic management of the dependent classes without restarting the server.
Is It Better To Have More Or Fewer Sessions For A Given Number Of Subscribers?
Using N sessions for N subscribers gives you concurrency up to N simultaneous threads of execution provided you have as many threads to work with. Each Session gets its own thread as long as there are enough threads available. Otherwise, the sessions serially reuse the available threads.
One session for N subscribers serializes all subscribers through that one session. If the load is heavy they may not be able to keep up without the extra threads.
If you are using CLIENT_ACKNOWLEDGE, N sessions gives you N separate message streams that can be individually recovered. Having one session crosses the streams giving you less control.
What Are Pending Messages In The Console?
Pending means the message could have been:
sent in a transaction but not committed.
received and not acknowledged.
received and not committed.
subject to a redelivery delay (as of WebLogic Server 6.1).
subject to a delivery time (as of WebLogic Server 6.1).
A rolled back message remains pending until the transaction actually rolls back. Rolling it back multiple times does not cause double counting, nor does an exception that set a transaction as rollbackOnly followed by an actual rollback.
Current implies messages that are not pending.
Total implies total since server last started. The byte counts only consider the payload of messages which includes the properties and the body but not the header.
How Do I Put A Message Back On The Queue For Processing?
The following are several approaches:
Use a transacted session, then rollback the session so the message will go back to the queue.
Use Session.CLIENT_ACKNOWLEDGE when creating a session, then recover the session so the message will go back to the queue.
Use a JTA transaction, then rollback the transaction so the message will go back to the queue.
What Can I Do When I Get Java.lang.outofmemoryerror Because Producers Are Faster Than Consumers?
Quotas can be used to help this situation. Your sender will then receive ResourceAllocationExceptions and the server will stay up. WLS 6.X does not support paging of messages out of memory.
As of WLS 6.1 SP02 or later, you can use the Message Paging feature, which can free up valuable virtual memory during peak message load periods by swapping out messages from virtual memory to persistent storage when message loads reach a specified threshold.
How Do I Debug Weblogic Server Using Visual Cafe 4.1?
You can install VisualCafe Enterprise Edition 4.1 and attach it to the server, pretty much as it worked for 3.X.
The following are steps for debugging using VC 4.1. You may change the directory names as necessary:
Install it under D:VisualCafeEE. No special options are needed.
Install the license under C:Program FilesCommon FilesWebGain Shared.
Start ddservices by selecting Start -> Programs -> WebGain Studio Professional ->Visual Cafe Enterprise Edition 4.1 -> Distributed Debugging Services -> Start DD Services (Java2 – 1.3)
Start WebLogic Server using debugvm.exe instead of java.exe.
cd D:beawlserver6.1configmydomain
setEnv
edit startWebLogic.cmd
change “%JAVA_HOME%binjava” -hotspot -ms64m -mx64m to visualcafeEEjdk13bindebugvm.exe
Run startWebLogic. It prints out some debugging information.
Run VisualCafe – Start -> Programs -> WebGain Studio Professional -> Visual Cafe Enterprise Edition 4.1 -> Visual Cafe Enterprise Edition 4.1
From the File menu, select Attach to Process. If everything is working correctly, you should see your machine name.
Click the + sign to expand the tree and select your running WebLogic Server.