Recently Updated Bea Weblogic Server Interview Questions Part – 2
What Is Bea Weblogic?
BEA WebLogic is a J2EE application server and also an HTTP web server by BEA Systems of San Jose, California, for Unix, Linux, Microsoft Windows, and other platforms. WebLogic supports Oracle, DB2, Microsoft SQL Server, and other JDBC-compliant databases. WebLogic Server supports WS-Security and is compliant with J2EE 1.3.
BEA WebLogic Server is part of the BEA WebLogic Platform. The other parts of WebLogic Platform are:
Portal, which includes Commerce Server and Personalization Server (which is built on a BEA-produced Rete rules engine),
WebLogic Integration,
WebLogic Workshop, an IDE for Java, and
JRockit, a JVM for Intel CPUs.
WebLogic Server includes .NET interoperability and supports the following native integration capabilities:
Native enterprise-grade JMS messaging
J2EE Connector Architecture
WebLogic/Tuxedo Connector
COM+ Connectivity
CORBA connectivity
IBM WebSphere MQ connectivity
BEA WebLogic Server Process Edition also includes Business Process Management and Data Mapping functionality. WebLogic supports security policies managed by Security Administrators.
The BEA WebLogic Server Security Model includes:
Separate application business logic from security code
Complete scope of security coverage for all J2EE and non-J2EE components
Why Is There No Polymorphic-type Response From A Create() Or Find() Method?
The EJB Specification prohibits this behavior, and the weblogic.ejbc compiler checks for this behavior and prohibits any polymorphic type of response from a create() or find() method.
The reason the create() and find() methods are not polymorphic is similar to the reason constructors are not polymorphic in Java. The derived classes generally do not know or cannot initialize the base class properly.
Can I Use A Native Two-tier Driver For A Browser Applet?
No. Within an unsigned applet, you cannot load native libraries over the wire, access the local file system, or connect to any host except the host from which you loaded the applet. The applet security manager enforces these restrictions on applets as protection against applets being able to do unsavory things to unsuspecting users.
If you are trying to use jDriver for Oracle from an applet, then you are violating the first restriction. Your applet will fail when it attempts to load the native (non-Java layer) library that allows jDriver for Oracle to make calls into the non-Java Oracle client libraries.
If you look at the exception that is generated, you will see that your applet fails in java.lang.System.loadLibrary, because the security manager determined that you were attempting to load a local library and halted the applet.
You can, however, use the WebLogic JTS or Pool driver for JDBC connectivity in applets. When you use one of these WebLogic multitier JDBC drivers, you need one copy of WebLogic jDriver for Oracle (or any other two-tier JDBC driver) for the connection between the WebLogic Server and the DBMS.
How Do Stubs Work In A Weblogic Server Cluster?
Clients that connect to a WebLogic Server cluster and look up a clustered object obtain a replica-aware stub for the object. This stub contains the list of available server instances that host implementations of the object. The stub also contains the load balancing logic for distributing the load among its host servers.
Why Did My Jdbc Code Throw A Roll Back Sql Exception?
Your JDBC code may throw the following exception:
“The coordinator has rolled back the transaction.
No further JDBC access is allowed within this transaction.”
The WebLogic JTS JDBC driver throws this exception when the current JDBC connection transaction rolls back prior to or during the JDBC call. This exception indicates that the transaction in which the JDBC connection was participating was rolled back at some point prior to or during the JDBC call.
The rollback may have happened in an earlier EJB invoke that was part of the transaction, or the rollback may have occurred because the transaction timed out. In either case, the transaction will be rolled back, the connection returned to the pool and the database resources released. In order to proceed, the JTS JDBC connection must be closed and reopened in a new transaction.
Can I Enable Requests To A Jdbc Connection Pool For A Database Connection To Wait Until A Connection Is Available?
No, there’s no way to allow a request to wait for a pool connection, and from the system point of view there should not be. Each requests that waits for a connection ties up one of the fixed number of execute threads in the server, which could otherwise be running another server task. Too many waiting requests could tie up all of the execute threads and freeze the server.
How Do I Connect To An Sql Server Instance That Is Running On A Machine With Multiple Instances Of Sql Server 2000?
Each instance of MS SQL Server must be listening on a different port. So, you can use the port number in the properties that you pass to the getConnection() method or, in case of connection pools,
you can specify the port property in the following properties:
server=machineName
port=instancePort
To find the port number where each MS SQL Server instance is running, run the server network utility (in the Microsoft SQL Server program group), select the server instance, select TCP/IP, and click the properties button.
What Type Of Object Is Returned By Resultset.getobject()?
WebLogic jDriver for Oracle always returns a Java object that preserves the precision of the data retrieved.
WebLogic jDriver for Oracle returns the following from the getObject() method:
For columns of types NUMBER(n) and NUMBER(m,n): a Double is returned if the defined precision of the column can be represented by a Double; otherwise BigDecimal is returned.
For columns of type NUMBER: Because there is no explicit precision, the Java type to return is determined based on the actual value in each row, and this may vary from row to row. An Integer is returned if the value has a zero-valued fractional component and the value can be represented by an integer.
For example, 1.0000 will be an integer. A long is returned for a value such as 123456789123.00000. If a value has a non-zero fractional component, a Double is returned if the precision of the value can be represented by a Double; otherwise a BigDecimal is returned.
How Do I Call Oracle Stored Procedures That Take No Parameters?
Here is what we use that works:
CallableStatement cstmt = conn.prepareCall(“Begin procName;
END;”);
cstmt.execute();
where procName is the name of an Oracle stored procedure. This is standard Oracle SQL syntax that works with any Oracle DBMS.
You might also use the following syntax:
CallableStatement cstmt = conn.prepareCall(“{call procName};”);
cstmt.execute();
This code, which conforms to the Java Extended SQL spec, will work with any DBMS, not just Oracle.
Why Do I Get An Error While Trying To Retrieve The Text For Ora-12705?
This error occurs when you have not set the ORACLE_HOME environment variable properly – a common mistake. In order to use WebLogic jDriver for Oracle, the Oracle client software needs to be installed and ORACLE_HOME must be set.
You may also see this error message if you try to use WebLogic jDriver for Oracle’s internationalization capabilities with a language/codeset combination that is not installed on your system. If you get the ORA-12705 error with the correct error text, then either you have set NLS_LANG improperly, or you do not have the right codesets installed on your system.
How Do I Prevent Errors When Running T3dbping?
When you are testing your Oracle database connections under UNIX, you can run SQL*PLUS and can successfully ping the database using utils.dbping. However, when you use the multitier utils.t3dbping utility, you receive an ORA-12154 error message.
First, make sure that your ORACLE_HOME environment variable is correctly set to point to your Oracle installation. This variable must be set in the environment where the WebLogic server is running.
In the C-shell issue the following command:
$ setenv ORACLE_HOME path
where path is the path to your Oracle installation.
In the Bourne shell, issue the following commands:
$ ORACLE_HOME=path
$ export ORACLE_HOME
where path is the path to your Oracle installation. When you ping your database using the two-tier utils.dbping utility, the JDBC driver loads the database client library and establishes the connection to the database. When you use the multitier utils.t3dbping utility, the WebLogic Server loads a two-tier driver and uses it to establish a database connection.
In both cases, the same method is used to connect to the database. SQL*PLUS works because it doesn’t require ORACLE_HOME to find the client libraries.
If you are still experiencing problems, try this:
Open a command shell.
Run the two-tier version of utils.dbping in this shell.
Start WebLogic in this shell from the command line:
$ java -ms32m -mx32m weblogic.server
Open a second command shell.
Run the utils.t3dbping in the second shell against the server running in the first command shell.
Why Am I Getting An Ora-01000: Maximum Open Cursors Exceeded Error, Even Though I Closed All Resultset, Statement, And Connection Objects?
This is an Oracle issue. According to Oracle’s documentation, dynamic cursors can remain open from run to run in a session and are not closeable when a procedure closes. To work around this issue, you can increase the number of open cursors allowed in the database or you can reset the connection pool (close and reopen database connections in the connection pool).
To reset the connection pool, you can untarget and retarget the connection pool using the Administration Console. You can also use the reset() method through the JMX API or the RESET_POOL command on the WebLogic Server command line interface.
Are There C/c++ Interfaces To Wls Jms?
No, this is not supported:
Write your own interfaces using JNI.
Setup a Servlet that your C/C++ client calls to generate a JMS message. You should spawn multiple threads in C++ and use multiple posts to pass messages via http.
How Do I Configure Jms Security?
The correct way to set up security for JMS is to go to the console, select ACLs in the tree view, then create some access control lists.
Set the ACL name which should be weblogic.jms.queue.QUEUENAME or weblogic.jms.topic.TOPICNAME.
elect Create.
Enter the New Permission of send or receive.
Select Create.
Enter a comma separated list of users or groups.
Select Grant Permission.
Select “saved to the realm implementation” to save your changes.
Select Yes.
This will update the fileRealm.properties file with lines that look like the following:
acl.send.weblogic.jms.queue.TestQueue1=user1
acl.receive.weblogic.jms.queue.TestQueue1=user1
If you don’t have an ACL for a queue or topic, security is wide open.There are also ACL’s for accessing the JNDI context; the JNDI context is a requirement for initially accessing JMS.
How Do I Use A Temporary Destination?
You must create a template on every JMSServer where you want to be able to create temporary destinations. You can specify multiple JMSServer entries to support Temporary Template and the system will load balance among those JMS servers to setup the temporary destination.
The JMSServer is defined something like:
After the template name, you can set any queue/topic attribute you want in the template (not including a JNDI name or topic multicast settings). The template is at the outer most level; that is, it should not be nested in your .
Temporary destinations can only be consumed by the creating connection. Using topics, you create your temporary topic and subscribe to that temporary topic. If you want someone to publish to that temporary topic, you need to tell that someone what your topic is.
You can send them a message and include your temporary topic in the JMSReplyTo field. The creator of the TemporaryTopic and the subscriber must be one in the same.
import javax.jms.TopicSession;
TemporaryTopic myTopic = mySession.createTemporaryTopic();
TopicSubscriber = mySession.createSubscriber(myTopic);
Temporary topics do not get names and cannot be subscribed to by other connections. When you create a temporary topic, the JMS provider returns a javax.jms.Topic. You then need to advertise that topic to other parties (those who want to publish to the topic), putting it in your JMSReplyTo field so that they can respond.
In general, no one else can subscribe to the topic. You advertise the topic any way you want. Topics are serializable (or, in our case, externalizable), which allows you to pass them around in RMI calls, through a file, binding it to a name in JNDI, etc.
In short, create the topic at the subscriber side and advertise so that others can publish. You can get multiple subscribers on the same connection and get concurrent processing using multiple sessions.
Which Types Of Jdbc Databases Does Weblogic Jms Support?
The JMS database can be any database that is accessible through a JDBC driver.
WebLogic supports and provides JDBC drivers for the following databases:
Cloudscape
Informix
Microsoft SQL (MSSQL) Server (Versions 6.5 and 7)
Oracle (Version 8.1.6)
Sybase (Version 12)
How Do The Wls Jms 6.1 Server/destination Message Maximum And Threshold Values Work?
The byte and message maximum values are quotas – not flow control. Message quotas prevent a WebLogic JMS server from filling up with messages and possibly running out of memory, causing unexpected results.
When you reach your quota, JMS prevents further sends with a ResourceAllocationException (rather than blocking). You can set quotas on individual destinations or on a server as a whole.
The thresholds are also not flow control – though they would be better suited to that application than the quotas. The thresholds are simply settings that when exceeded cause a message to be logged to the console to let you know that you are falling behind.
Note that the messages maximum setting on a connection factory is not a quota. This specifies the maximum numbers of outstanding messages that can exist after they have been pushed from the server but before an asynchronous consumer has seen them; it defaults to a value of 10.
Does Weblogic Jms Support Clustering?
WebLogic JMS supports cluster-wide, transparent access to destinations from any server in the cluster. A system administrator can establish cluster-wide, transparent access to destinations from any server in the cluster by configuring multiple connection factories and using targets to assign them to WebLogic Servers. Each connection factory can be deployed on multiple WebLogic Servers.
The application uses the Java Naming and Directory Interface (JNDI) to look up a connection factory and create a connection to establish communication with a JMS server. Each JMS server handles requests for a set of destinations. Requests for destinations not handled by a JMS server are forwarded to the appropriate server.
You can configure multiple JMS servers on the various nodes in the cluster as long as you give them different names. You can assign destinations to the various JMS servers.
One problem to be aware of is the propagation delay in replicating entries in JNDI. If you have an MDB deployed on one node but reference a destination on another node, the deployment may fail with a javax.naming.NamingException exception.
The problem occurs because the server is not synced up to the JNDI from the remote server (JMS server) yet, so the JNDI lookup of destination as part of MDB deployment will fail. One workaround is for each MDB to reference a local destination.
Another approach is deploy the MDBs after the server boots (plus a delay for JNDI propagation). To get around losing messages before the MDB is deployed, use durable subscribers. This problem is fixed for MDBs in WLS 6.1, where the MDB will be deployed and reconnection will be retried until the destination is available.
What Happens If Acknowledge() Is Called Within A Transaction?
As per the JMS specification, when you are in a transaction, the acknowledgeMode is ignored. If acknowledge() is called within a transaction, it is ignored.