Pramati Technologies

Working with WebLogic Server


Developers who are familiar with WebLogic Server 6.1 and WebLogic 7.0, can test deploy applications using BEA WebLogic as the production environment using Studio.

Studio provides tight integration with WebLogic Server 6.1 and WebLogic 7.0. It automatically creates the required deployment descriptors while the application is being developed, and keeps the application in a ready-to-deploy state. Studio provides all the support required for deploying applications on local and remote servers. Some operations supported are:

This chapter discusses how to develop EJB 1.1 and EJB 2.0 applications in Studio and deploy them on WebLogic.

Configuring WebLogic deployer

To develop applications in Studio and test-deploy them on WebLogic server, the WebLogic Deployer should be configured in Studio. Select Tools > Configure from the main menu.

In the Tools Configure dialog, select WebLogic Deployer, and close the dialog. Multiple instances of the WebLogic server can be created in Studio, which is typically one development server on the development machine and a single central production server on the remote machine.

Note: Each configured Server instance has its own tab in the output panel.

Creating WebLogic server instances

To create a WebLogic server instance, select Tools > Server Configuration from the main menu. In the Server Configuration dialog, click New. In the Add New Server dialog, enter the following information:

Pressing OK creates an instance of the server and displays the Server Config panel, where WebLogic properties are to be configured:

c:\Pramati Studio 3.0\server\lib\tp\cloudscape.jar 
All the JARs of the configured drivers are always added to the server classpath.
Notes: The name provided in the field Name, is different from the name provided in the field, Target Server Name. The Server Name is a unique name used to identify a server instance, whereas the Target Server Name is the name of the WebLogic admin server. Example: myserver.
If the server is running in production mode, then the application is deployed as normal archives. For developing applications, which require frequent deployment, undeployment and redeployment, it is recommended that development mode be used.
If you are using the default weblogic JMS server, then Initial Context factory and Provider URL need not be mentioned.

Use the OK button to add the instance of the WebLogic Server. To delete a server instance, select the required server from the field, Server Name and use the Delete button.

Configuring WebLogic embedded JMS Server

Follow the given steps to configure the embedded JMS Server of Console

from Studio:

  1. Use the WebLogic Web Console to create the JMS server OR Add the following tag in the file, config.xml of the configured domain. The file will typically be stored in the configured domain directory. For example:


<JMSServer Name="myJMSServer" Store="myJDBCStore" Targets="myserver">


<JMSJDBCStore ConnectionPool="jmsconpool" Name="myJDBCStore"/>

  1. Give any appropriate name to the JMS server.
  2. JMS server uses a store to persist the messages. The store can be a file store or a database. Typically, the database store is preferred for storing the messages. The tag, JMSJDBCStore in the code above is the storage for JMS server. This store uses a Connection Pool, which should be stored in the Server. If the connection pool does not exist, then the user needs to create one. Consider the following example:

<JDBCConnectionPool CapacityIncrement=5"

DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="5"

MaxCapacity="30" Name="jmsconpool" Password="tiger"

Properties="user=scott" Targets="myserver" URL="jdbc:oracle:thin:@db1:1521:db1"/>

For more details, read the WebLogic Server documentation.

Starting & Stopping Server

After creating the WebLogic server instance in Studio, close the Server Configuration panel, and select the instance from the Server Box in the Status bar. Selecting the WebLogic server instance here makes it the current server, and all server specific operations for the active desk is performed on the current server.

The WebLogic server can be started/stopped in a similar way as any other server in Studio. Use Tools > Start Server to start the Server. To stop a server, use Tools > Stop Server from the main menu. The Server can also be started/stopped using the signal box.

Note: Remote server cannot be started/stopped from Studio. All other operations can be performed.

Controlling Output Messages

The type of output message can be controlled by specifying the property

-Dweblogic.StdoutSeverityLevel in the VM Option field while configuring 
the server instance. The values may be given as one of the following: 64 
(INFO), 32 (WARNING), 16 (ERROR), 8 (NOTICE), 4 (CRITICAL), 2 (ALERT), 1 

The default value used is 16. To get the complete output in Output Panel, provide 64 as the value of the above-mentioned property. For example:


Deploying on WebLogic

Applications can be deployed on WebLogic as normal archived JARs, WARs and EARs, or directly as Modules. Right Clicking on the Desk > Deploy as .ear always deploys the application on the current WebLogic server. Similarly right clicking on the module > Deploy always deploys the module on the current WebLogic server.

The WebLogic server runs in two modes - development and production. When the configured server is local and running in the development mode, the applications are hot-deployed. Hot deploying of applications provides the user the facility of not having to re-deploy the application each time the server is started. In hot-deployment the JAR, WAR, EAR and EJB modules are deployed by storing the archives in the applications directory of the configured server. The server then polls and automatically deploys/redeploys the application, each time it is started.

If the server is remote or is running in the production mode, all modules are deployed as archives.

Deploying the Web module on a local server deploys the Web module directory. Any changes made in the files under this module get reflected automatically, and the module need not be re-deployed.

Starting the server from Tools > Start Server, or from the Signal Box always starts the current WebLogic Server. If the server is local, and has not been started, deploying the application will start the server.

Note: A remote server cannot be started from Studio, and it should be running before the user can connect to it and deploy the application.

JNDI Names

Relations (JOIN condition)

If two beans share a relationship, the corresponding tables should ideally have the PK-FK relationship. During deployment, these dependencies are automatically resolved and the JOIN condition created. Specifying the JOIN condition manually requires the user to follow the given conditions:

Case 1

When join condition involves only participating beans table. Consider this example:

Bean A : Table X

Bean B : Table Y

Here each of the sub clauses must involve both the tables and the following are a few of the

valid JOIN conditions = Y.ay AND X.bx =

The join condition, = is invalid as both LHS and RHS table are same (X).

Case 2

When join condition involves an additional third table, which joins the two participating bean's table. Consider this example:

Bean A : Table X

Bean B : Table Y

Join Table : Z

Here, the JOIN condition can not have any other table. = AND = will be invalid.

A sub-clause cannot use both the tables, X and Y at the same time. = AND X.bx = is invalid.

In the above example, the following are valid join conditions : = AND = =

Though this involves only two tables, it is valid because table Z is the link table.

JMS server resources (Topics, Queues and ConnectionFactories)

If the embedded JMS server is being used then the Resources tool can be used to create topics, queues and ConnectionFactories. If the JMS server being used is an external server, the topics, queues and ConnectionFactories have to be created on the specific server, and use the same name while deploying.

Note: If there are more than one JMS server configured in a domain, then the topic_name/queue_name must be unique across the JMS servers as it's JNDI name is bound on the application server.

Queries for EJB 1.1 Beans

CMP 1.1 beans require finder queries for defining the Finder methods. These queries can be created using the Query wizard while creating the bean or in the Bean Properties panel before deployment.

The query should use only the bean table for which query is being written, and no other table.

Creating WebLogic Archives

Developing applications in Studio creates archives and modules with Pramati XML files. To create archives with WebLogic XMLs

This creates the required WebLogic deployment descriptors and stores them inside the archive. This archive is now a WebLogic deployable archive, and can be commercially deployed on any other WebLogic server.

Note: When using the option Export As Archive, ensure that the current server is WebLogic.

Debugging on WebLogic

Pramati Studio supports debugging applications on local as well as remote server. However, JSP Pages can be debugged only on the in-built server. To start the debugger, use Debug > Start from the main menu. If the server is on the local machine, then check the option, Application for J2EE. This starts the server in the debug mode. The application can now be deployed. The Debugger panel appears only after the break points have been inserted.

If the server is on a remote machine

The VM options needed to start the server in debug mode are

-Xdebug -Xnoagent -Djava.compiler=NONE - Xrunjdwp:trans-
port=dt_socket,address=1234,suspend=n,serve r=y 

After adding the above option, the start server command appears as given below

java -ms64m -mx64m -classpath %CLASSPATH% "-Xdebug -Xnoagent
piler=NONE - Xrunjdwp:transport=dt_socket,address=1234,suspend=n,server=y -
Dweblogic.Domain=mydomain -Dweblogic.Name=myserver "-Dbea.home=E:\WLHome" - -Dweblogic.ProductionModeEn-
Note: This entry can also be entered in startWeblogic.cmd.

WebLogic Usage Restrictions

For example, While writing the query Select Object o from Customer As c where = ? always ensure that there is a space between id and =, and = and ?

Deleting a JMS Queue or Topic from the server does not allow another topic or 
Queue with the same name to be added in the same server session. The error 
that is displayed in this case is:
Error adding destination: destination has the same name as a previ-
ously dynamically deleted destination <queue/topic name> 

Pramati Technologies  © Copyright   TOCPREVNEXTINDEX