Tuesday, April 26, 2011

Integrated WebLogic Server (WLS)

To run JDeveloper application in a Java EE container, it must be bound to a Server Instance. Integrated WebLogic Server (Integrated WLS) comes packaged with JDeveloper. Testing JDeveloper applications on Integrated WLS Server is easy because:
  • Deployment is optimized and the requirement to zip and copy files is eliminated.
  • Most files run directly from project directories. This feature enables you to make selected changes and refresh these changes while the application is running. For example, any changes made to a JSPX page can be refreshed immediately, without redeploying the application.
  • There is no requirement to undeploy applications after testing and debugging. Applications are undeployed when the Default Server becomes unavailable.
  • JDeveloper enables you to quickly create test users and passwords to test security in Integrated WLS.

Integrated WLS

You can run your applications directly on Integrated WebLogic Server without the need to deploy. The integrated WLS is sufficient to run your application to make sure it displays correctly in browsers, or for testing and debugging portions of the application. However, real end-to-end testing should be done in a standalone Administration Server because that is what will be used in a production environment.
JDeveloper is bundled with a WLS domain, and "DefaultServer" is defined for it. All JDeveloper applications are bound by default to "DefaultServer." In this document, these default settings are assumed. To view the properties of "DefaultServer" Server Instance, in the Application->Application Properties...->Run panel, select "Application Server Properties".
Alternatively, you can view the properties of IntegratedWebLogicServer from the Application Server Navigator:
  1. If necessary, open the Application Server Navigator by choosing View->Application Server Navigator.
  2. Right-click the IntegratedWebLogicServer connection and choose Properties.

DefaultDomain

"DefaultDomain" is bundled with JDeveloper. If you have not explicitly created Integrated WebLogic Server's default domain, it will automatically be created with default settings when you start the server by running or debugging an application. The default domain and its associated default server is located here:
$JDEV_USER_HOME/system11.1.1.1.32.53.52/DefaultDomain/server/DefaultServer
Every Server Instance requires a unique Application Server Connection. "DefaultServer" Server Instance uses bundled Application Server Connection named "IntegratedWebLogicServer" (see Figure). IntegratedWebLogicServer is used by Integrated WLS for deployment and server management. This connection is visible in the Application Server Navigator and the Resource Palette, and can be used to browse and manage this instance.
With a fresh installation of JDeveloper, the "DefaultServer" Server Instance and the "IntegratedWebLogicServer" Application Server Connection are only created the first time a Integrated WLS related action is taken. The actions are: running/debugging/profiling a Java EE application, editing the Server Instances, or editing the application properties->Run properties. The Server Instance must be started once, after which any application can be run repeatedly. You can also start Integrated WLS without starting application as shown below.

How to Start Integrated WLS

Options for starting Integrated WLS are available in the Run menu in JDeveloper.
  • To start it in debug mode, from the Run menu, select Debug Server Instance.
    It is recommended that the service be run in debug mode as it helps in debugging the service.
  • To start it in the regular mode, from the Run menu, select Start Server Instance.
There are a couple of ways to determine if Integrated WLS is running:
  • From the View menu, select Log, and look for the following entry:
    IntegratedWebLogicServer started
  • Access the Integrated WLS console from a browser using weblogic/weblogic1 credential:
    http://localhost:7101/console
The first time the Integrated WLS starts, it tries to use the first available port in the 7101 - 7105 range. The following message appears as the first line in the Default server log in JDeveloper. You should use the chosen port for all access:
*** Using port 7101 ***
or
HTTP port conflict detected. The HTTP port will be reassigned to port 7102.
When you run your application in JDeveloper using the run or debug commands, the Integrated WLS server starts automatically and your application runs in the target browser. When the Run or Debug action is selected on a Java EE node, Integrated WLS runs the entire application and all its projects as a Java EE Application in a Java EE container ("DefaultServer"). Each node type may optionally trigger additional actions, such as launching a browser.

Adminstration Console

The WebLogic console can be deployed and accessed to manage the Integrated WLS (or "DefaultServer").
To view the DefaultServer details:
  1. Go to your web browser and enter the URL: http://<hostname.domainname>:<port>/console
  2. Login to the WLS console using the username and password: weblogic / weblogic1.
  3. Go to the Domain Structure and select DefaultDomain, Control, DefaultServer(admin).

Launch

When Integrated WSL is started, JDeveloper configure its environment as follows:
D:\Oracle\MIDDLE~1\JDK160~1\bin\java -client
-Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m  -XX:MaxPermSize=512m
-Dweblogic.Name=DefaultServer
-Djava.security.policy=D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.policy
-Djavax.net.ssl.trustStore=D:\Oracle\Middleware\wlserver_10.3\server\lib\DemoTrust.jks
...
For troubleshooting, some of these configuration information can be helpful. For example, it tells you where the domain home directory is; what server instance's name is; where the security policy file is read from, etc. In the following sections, we'll discuss some relevant configuration information and where to find them.

Which Port the Integrated WLS Is Assigned to?

If the port display when the Integratede WLS started was buried deeply in the Default server log in JDeveloper or it's simply scroll out of scope, you can still find out which port number it gets assigned to. Look at <listen-port> element inside config.xml which is located here:
 $JDEV_USER_HOME/system11.1.1.1.32.53.52/DefaultDomain/config

Development Mode or Production Mode

You can check if the server is in development mode or production mode by looking in the config.xml for the domain. If config.xml contains the following xml fragment, then it is in production mode:
<production mode-enabled>true</production-mode-enabled>

For Integrated WLS, its config.xml doesn't contain the above xml fragment. However, you can find if it's in development mode or not by reading the log message in the Log view.

Server Credential Store

There are two ways application credentials can be merged onto the server credential store.
  • MERGE
    • MERGE will not change any credential that already exists on the server. For example, if there is a user 'scott' and a password 'tiger' already in the server credential store, and your app wants to change the password for 'scott' to 'foo', it will not work if the mode is MERGE. In order to be able to overwrite a credential on the server, the mode must be OVERWRITE.
  • OVERWRITE
    • Overwriting the master credential store with application credentials is a security risk.
    • The overwrite operation will only work on servers in development mode and also have the overwrite option enabled.
By default, the Integrated WLS is in development mode with OVERWRITE (i.e., -Djps.app.credential.overwrite.allowed=true) flag enabled.

Troubleshooting Web Services on Integrated WLS

  • Log directory
    • $JDEV_USER_HOME/system11.1.1.1.32.53.52/DefaultDomain/servers/DefaultServer/logs
    • Look for DefaultDomain.log, DefaultServer-diagnostic.log, and DefaultServer.log
  • For more information about logging in Oracle Fusion Middleware, see "Managing Log Files and Diagnostic Data" in Oracle Fusion Middleware Administrator's Guide.
  • There are two categories of log files that you can reference to assist in diagnosing problems with Web services:
    • Diagnostic logs--Enable you to access diagnostic data about specific feature components in Oracle Fusion Middleware. For more information, see "Using Diagnostic Logs for Web Services".
      There is a set of predefined diagnostic loggers. You can configure your own diagnostic logger, as described in "Configuring a Diagnostic Logger for a Web Service".
    • Message logs--Enable you to view elements of the SOAP message request. You control message log creation using policies. For more information, see "Using Message Logs for Web Services".
  • Diagnosing Problems with Oracle WSM Policy Manager

References

  1. Integrated WLS
  2. Running and Deploying Applications on WebLogic Server
  3. How to Test the Web Service Using Integrated WLS
  4. How to Manage the Integrated WLS
  5. How to Start and Stop Integrated WLS
  6. Oracle Fusion Middleware Search Results: integrated WLS