<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>WebLogic Server</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/" />
   <link rel="self" type="application/atom+xml" href="http://blogs.oracle.com/WebLogicServer/xml/rss.xml" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380</id>
   <updated>2009-11-19T20:08:55Z</updated>
   
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type Enterprise 4.23-en</generator>


<entry>
   <title>Developing custom MBeans to manage J2EE Applications (Part II)</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/11/developing_custom_mbeans_to_manage_j2ee_applications_part_ii.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.15498</id>
   
   <published>2009-11-11T02:10:18Z</published>
   <updated>2009-11-19T20:08:55Z</updated>
   
   <summary>This is the second part in a series of blogs, that demonstrate how to add management capability to your own application using JMX MBeans. In Part I we did the bulk of the work. We saw: How to implement a...</summary>
   <author>
      <name>philippe Le Mouel</name>
      
   </author>
   
      <category term="Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="jmx" label="JMX" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>This is the second part in a series of blogs, that demonstrate how to add management capability to your own application using <a href="http://java.sun.com/javase/6/docs/technotes/guides/jmx">JMX MBeans</a>.</p> 

<p>In <a href="http://blogs.oracle.com/WebLogicServer/2009/10/developing_custom_mbeans_to_ma.html">Part I</a> we did the bulk of the work. We saw:

<ul>

<li>How to implement a custom MBean to manage configuration associated with an application.</lib>

<li>How to package the resulting code and configuration as part of the application's ear file.</li>

<li>How to register MBeans upon application startup, and unregistered them upon application stop (or undeployment).</li>

<li>How to use generic JMX clients such as <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html">JConsole</a> to browse and edit our application's MBean.</li>

</ul>
</p>

<p>In this second part, we will add descriptions to our:
<ul>
<li>MBean</li>
<li>MBean attributes</li>
<li>MBean operations
<li>MBean operation parameters</li>
</li>
</ul>
<p>
We saw using JConsole, that default descriptions were generated for all of the above. However those default descriptions didn't provide any meaningful information to our MBean users. We will replace those default descriptions with custom descriptions that can be used by us human to understand the functionality provided by our MBean.
</p>

<p>
We will also add localization support to our MBean. Our goal is to ensure that our MBean's meta-data is localized based on the WebLogic Server it is deployed to. So if that server uses a French Locale, then we'd expect our MBeans descriptions to be French and not English.
</p>   
</p>

<p>The complete code sample and associated build files for part II are available as a <a href="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part2.zip">zip file</a>. The code has been tested against WebLogic Server 10.3.1 and JDK6. To build and deploy our sample application, please follow the instruction provided in <a href="http://blogs.oracle.com/mt/mt.cgi?__mode=view&_type=entry&id=15083&blog_id=380">Part I</a>, as they also apply to part II's code and associated <a href="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part2.zip">zip file</a>.</p>

<h2>Providing custom descriptions</h2>

<p>
In order to provide custom description we need to modify our MBean implementation to extend the <a href="http://java.sun.com/javase/6/docs/api/javax/management/StandardMBean.html">StandardMBean</a> class. Despite its name that class is used to implement both Standard and MXBeans. 
</p>

<p>
We override the <a href="http://java.sun.com/javase/6/docs/api/javax/management/StandardMBean.html">StandardMBean</a> class many <code>getDescription</code> methods to provide our own custom descriptions. We use <a href="http://java.sun.com/javase/6/docs/api/java/util/ResourceBundle.html">resources bundles</a> to store our descriptions to ensure that those can be properly localized. The updated code for our MBean implementation is included below:  
</p>

<code><pre>
package blog.wls.jmx.appmbean;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.File;

import java.net.URL;

import java.util.Map;
import java.util.HashMap;
import java.util.Properties;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.MBeanRegistration;
import javax.management.StandardMBean;
import javax.management.MBeanInfo;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;

public class PropertyConfig extends StandardMBean implements
    PropertyConfigMXBean, MBeanRegistration {

    private String relativePath_ = null; 

    private Properties props_ = null;

    private File resource_ = null;

    private ResourceBundle resourceBundle_ = null;

    private static Map<String, String[]> operationsParamNames_ = null;

    static {
        operationsParamNames_ = new HashMap<String, String[]>();
        operationsParamNames_.put("setProperty", new String[] {"key", "value"});
        operationsParamNames_.put("getProperty", new String[] {"key"});
    }

    public PropertyConfig(String relativePath) throws Exception {
        super(PropertyConfigMXBean.class , true);
        props_ = new Properties();
        relativePath_ = relativePath;
    }

    public String setProperty(String key,
                              String value) throws IOException {

        String oldValue = null;

        if (value == null) {
            oldValue = String.class.cast(props_.remove(key));
        } else {
            oldValue = String.class.cast(props_.setProperty(key, value));      
        }

        save();
        return oldValue;
    }

    public String getProperty(String key) {
        return props_.getProperty(key);
    }

    public Map<String, String> getProperties() {
        return (Map) props_;
    }

    private void load() throws IOException {
        
        InputStream is = new FileInputStream(resource_);
        try {
            props_.load(is);
        }
        finally {
            is.close();
        }
    } 

    private void save() throws IOException {
  
        OutputStream os = new FileOutputStream(resource_);

        try {
            props_.store(os, null);
        }
        finally {
            os.close();
        }
    }

    public ObjectName preRegister(MBeanServer server, ObjectName name)
        throws Exception {
       
        // MBean must be registered from an application thread
        // to have access to the application ClassLoader
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL resourceUrl = cl.getResource(relativePath_);
        resource_ = new File(resourceUrl.toURI());

        load();     

        return name;
    }

    public void postRegister(Boolean registrationDone) { }

    public void preDeregister() throws Exception {}

    public void postDeregister() {}

    private synchronized ResourceBundle getResourceBundle() {
   
        if ( resourceBundle_ == null ) {
            resourceBundle_ = 
                PropertyResourceBundle.getBundle(
                    "blog.wls.jmx.appmbean.MBeanDescriptions");
        }
       
        return resourceBundle_;
    } 

    protected String getDescription(MBeanAttributeInfo info) { 
        return getResourceBundle().getString("PropertyConfigMXBean.attribute." + 
            info.getName() ); 
    } 

    protected String getDescription(MBeanOperationInfo info) { 
        return getResourceBundle().getString("PropertyConfigMXBean.operation." + 
            info.getName() ); 
    }   

    protected String getDescription(MBeanInfo info) {
        return getResourceBundle().getString("PropertyConfigMXBean.mbean");
    }

    protected String getDescription(MBeanOperationInfo op,
                                    MBeanParameterInfo param,
                                    int sequence) {
        return getResourceBundle().getString(
            "PropertyConfigMXBean.operation." + 
            op.getName() + "." + 
            operationsParamNames_.get(op.getName())[sequence] ); 
    }

    protected String getParameterName(MBeanOperationInfo op,
                                      MBeanParameterInfo param,
                                      int sequence) {
        return operationsParamNames_.get(op.getName())[sequence];
    } 

}
</pre></code>

<p>
Our default resource bundle class, that contains our English descriptions contains the following code:
</p>

<code><pre>
package blog.wls.jmx.appmbean;

import java.util.ListResourceBundle;

public class MBeanDescriptions extends ListResourceBundle {
     protected Object[][] getContents() {
         return new Object[][] {
             {"PropertyConfigMXBean.mbean", 
              "MBean used to manage persistent application properties"},  
             {"PropertyConfigMXBean.attribute.Properties", 
              "Properties associated with the running application"},
             {"PropertyConfigMXBean.operation.setProperty", 
              "Create a new property, or change the value of an existing property"},
             {"PropertyConfigMXBean.operation.setProperty.key", 
              "Name that identify the property to set."},
             {"PropertyConfigMXBean.operation.setProperty.value", 
              "Value for the property being set"},
             {"PropertyConfigMXBean.operation.getProperty", 
              "Get the value for an existing property"}, 
             {"PropertyConfigMXBean.operation.getProperty.key", 
              "Name that identify the property to be retrieved"} 
        };
     }
 }
</pre></code>

<p>
Our MBean is quite simple, and only exposes one attribute and two operations. This helps keep our resource bundle class quite small. For real world example that file will be much bigger. Note: We didn't override the getDescription method associated with our MBean constructor, to keep our sample small as this doesn't add much value to our discussion.  
</p>

<p>
To add support for other languages, we only need to implement the corresponding resource bundle class. <code>MBeanDescriptions_fr</code> for French, and translate the description appropriately.
</p>

<p>
One interesting thing to note, is the name we used for our resource bundle keys. We didn't use arbitrary values, but we made sure we followed the following convention:

<ul>
<li>MBean description: <strong>&lt;MBeanInterfaceClass&gt;.mbean</strong>
</li>
<li>MBean attribute description: <strong>&lt;MBeanInterfaceClass&gt;.attribute.&lt;AttributeName&gt;</strong>
</li>
<li>MBean operation description: <strong>&lt;MBeanInterfaceClass&gt;.operation.&lt;OperationName&gt;</strong>
<li>
MBean operation parameter description: <strong>&lt;MBeanInterfaceClass&gt;.operation.&lt;OperationName&gt;.&lt;ParameterName&gt;</strong>
</li>
</li>
<li>MBean constructor description: <strong>&lt;MBeanInterfaceClass&gt;.constructor.&lt;ConstructorName&gt;</strong>
<li>
MBean constructor parameter description: <strong>&lt;MBeanInterfaceClass&gt;.constructor.&lt;ConstructorName&gt;.&lt;ParameterName&gt;</strong>
</li>
</li>
 </ul>
We also purposely named our resource bundle class <code>MBeanDescriptions</code> and included it as part of the same package as our MBean. The above convention is used by the JDK 7 to localize MBean descriptions without requiring us to extend the <a href="http://java.sun.com/javase/6/docs/api/javax/management/StandardMBean.html">StandardMBean</a> class and override its many <code>getDescription</code> methods. Unfortunately JDK 6 doesn't support built-in JMX localization, so we have to write the above code. However we can anticipate the JDK 7 functionality (and possible early support by WebLogic) by using the above convention when specifying our MBean resource bundle and associated resource keys.   
<p/>

<p>
You might have noticed the following code in our updated MBean implementatrion:

<code><pre>
    protected String getParameterName(MBeanOperationInfo op,
                                      MBeanParameterInfo param,
                                      int sequence) {
        return operationsParamNames_.get(op.getName())[sequence];
    } 
</pre></code>
This is used to provide customized name to our operation parameters in place of the default generated 'po', 'p1', ... , 'pn' values. 
</p>

<p>
The result of our hard work can be seen in the following JConsole screen shot:
</p>

<img alt="app_mbean_part2_jconsole1.JPG" src="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part2_jconsole1.JPG" width="609" height="357" class="mt-image-none" style="" />

<p>
Consult <a href="http://blogs.oracle.com/WebLogicServer/2009/10/developing_custom_mbeans_to_ma.html">Part I</a> for information on how to use JConsole to browse/edit our MBean.
</p>

<h2>What's next?</h2>

<p>
What if our application is deployed to a WebLogic server running with an English Locale, and our management client wants to use a French Locale. Currently as things stand the Localization is performed based on the server Locale, and not based on the client's Locale. In the last part of this blog series, we will see how to associate a Locale with our JMX client connection, and we will update our MBean code to support client based localization.    
</p>
]]>
      
   </content>
</entry>

<entry>
   <title>Stateful JAX-WS with Coherence*Web  </title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/11/support_jax-ws_sessions_with_c.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.15475</id>
   
   <published>2009-11-10T05:11:39Z</published>
   <updated>2009-11-11T18:06:51Z</updated>
   
   <summary>We describe a stateful JAX-WS web service with high availability provided by Coherence*Web [1]. Deployed to two separate WebLogic managed servers, the web service stores its state in http session cookies. Coherence*Web distributes and synchronizes http session data between both...</summary>
   <author>
      <name>quan.wang@oracle.com</name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<div class="macro"><br /></div><p>We describe a stateful JAX-WS web
service with high availability provided by Coherence*Web [1]. Deployed
to two separate WebLogic managed servers, the web service stores its
state in http session cookies. Coherence*Web distributes and
synchronizes http session data between both managed servers. As a
result, two endpoints with synchronized web service state provide high
availability. With one endpoint down, another could continue to serve
the service request with current web service state.</p>

<p>Note that WebLogic clustering can also provide highly available http
sessions. However, we want to demonstrate Coherence*Web as an
alternative to clustering for high availability. Therefore, we do not
use clustering here. Instead, we use Coherence*Web.</p>


<p>Setting up the stateful web service with Coherence*Web involves the following steps.</p>
<ul><li>start Coherence*Web cache server&nbsp;</li><li>create and configure managed servers
	<ul><li>deploy Coherence*Web as a shared library to the managed servers</li></ul>
	</li><li>create and deploy the web service
	<ul><li>stores state in http session</li><li>instrument the web service using Coherence*Web</li><li>deploy the web service to both managed servers</li></ul>
	</li></ul>


<h5><a href="editor-content.html?cs=utf-8" class="" name="StatefulJAX-WSwithCoherence*Web-StartCoherenceWebCacheServer"></a>Start Coherence*Web Cache Server</h5>

<p>Start Coherence*Web cache server using the command below [2].</p>

<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">java -server -Xms512m -Xmx512m <br />-cp coherence/lib/coherence.jar:coherence/lib/coherence-web-spi.war <br />-Dtangosol.coherence.management.remote=<span class="code-keyword">true</span> <br />-Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml <br />-Dtangosol.coherence.session.localstorage=<span class="code-keyword">true</span> <br />com.tangosol.net.DefaultCacheServer</pre>
</div></div></div><p class="atl_conf_pad"> </p>

<h5><a href="editor-content.html?cs=utf-8" class="" name="StatefulJAX-WSwithCoherence*Web-CreateandConfigureManagedServers"></a>Create and Configure Managed Servers</h5>

<p>Copy <i>coherence/lib/coherence.jar</i> [2] to <i>$DOMAIN_HOME/lib</i>.</p>

<p>Start WebLogic AdminServer using</p>
<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">$DOMAIN_HOME/bin/startWebLogic.sh</pre>
</div></div></div><p>Create two managed servers <i>Server-2</i> at port <i>7012</i> and <i>Server-3</i> at port <i>7013</i> using the admin console.  Start both servers using the commands below.</p>
<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">$DOMAIN_HOME/bin/startManagedWebLogic.sh Server-2<br />$DOMAIN_HOME/bin/startManagedWebLogic.sh Server-3</pre>
</div></div></div><p>Deploy <i>coherence\lib\coherence-web-api.war</i> [2] to the servers as a shared library.&nbsp;</p>

<h5><a href="editor-content.html?cs=utf-8" class="" name="StatefulJAX-WSwithCoherence*Web-CreateandDeploytheWebService"></a>Create and Deploy the Web Service</h5>

<p>Install Oracle Enterprise Pack for Eclipse (OEPE) on Eclipse Galileo
[4]. In Eclipse, create a web service using the following WSDL and
implementation.</p>
<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">&lt;definitions<br />&nbsp;xmlns:soap=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/soap/"</span><br />&nbsp;xmlns:tns=<span class="code-quote">"http://oracle.ws.demo/"</span><br />&nbsp;xmlns:xsd=<span class="code-quote">"http://www.w3.org/2001/XMLSchema"</span><br />&nbsp;xmlns=<span class="code-quote">"http://schemas.xmlsoap.org/wsdl/"</span><br />&nbsp;targetNamespace=<span class="code-quote">"http://oracle.ws.demo/"</span><br />&nbsp;name=<span class="code-quote">"StatefulWSService"</span>&gt;<br /></span>&lt;types&gt;<br />&lt;xsd:schema&gt;<br />&lt;xsd:<span class="code-keyword">import</span> namespace=<span class="code-quote">"http:<span class="code-comment">//oracle.ws.demo/"</span><br />&nbsp;schemaLocation=<span class="code-quote">"http://localhost:7001/Stateful_WS_Coherence/StatefulWSService?xsd=1"</span> /&gt;<br /></span>&lt;/xsd:schema&gt;<br />&lt;/types&gt;<br />&lt;message name=<span class="code-quote">"addItem"</span>&gt;<br />&lt;part name=<span class="code-quote">"parameters"</span> element=<span class="code-quote">"tns:addItem"</span> /&gt;<br />&lt;/message&gt;<br />&lt;message name=<span class="code-quote">"addItemResponse"</span>&gt;<br />&lt;part name=<span class="code-quote">"parameters"</span> element=<span class="code-quote">"tns:addItemResponse"</span> /&gt;<br />&lt;/message&gt;<br />&lt;portType name=<span class="code-quote">"StatefulWS"</span>&gt;<br />&lt;operation name=<span class="code-quote">"addItem"</span>&gt;<br />&lt;input message=<span class="code-quote">"tns:addItem"</span> /&gt;<br />&lt;output message=<span class="code-quote">"tns:addItemResponse"</span> /&gt;<br />&lt;/operation&gt;<br />&lt;/portType&gt;<br />&lt;binding name=<span class="code-quote">"StatefulWSPortBinding"</span> type=<span class="code-quote">"tns:StatefulWS"</span>&gt;<br />&lt;soap:binding transport=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/soap/http"</span> <br />style=<span class="code-quote">"document"</span> /&gt;<br /></span>&lt;operation name=<span class="code-quote">"addItem"</span>&gt;<br />&lt;soap:operation soapAction="" /&gt;<br />&lt;input&gt;<br />&lt;soap:body use=<span class="code-quote">"literal"</span> /&gt;<br />&lt;/input&gt;<br />&lt;output&gt;<br />&lt;soap:body use=<span class="code-quote">"literal"</span> /&gt;<br />&lt;/output&gt;<br />&lt;/operation&gt;<br />&lt;/binding&gt;<br />&lt;service name=<span class="code-quote">"StatefulWSService"</span>&gt;<br />&lt;port name=<span class="code-quote">"StatefulWSPort"</span> binding=<span class="code-quote">"tns:StatefulWSPortBinding"</span>&gt;<br />&lt;soap:address<br />&nbsp;location=<span class="code-quote">"http:<span class="code-comment">//localhost:7001/Stateful_WS_Coherence/StatefulWSService"</span> /&gt;<br /></span>&lt;/port&gt;<br />&lt;/service&gt;<br />&lt;/definitions&gt;</pre>
</div></div></div><p><i>StatefulWS.java</i> and <i>Item.java</i></p>
<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"><span class="code-keyword">package</span> demo.ws.oracle;<br /><span class="code-keyword">import</span> javax.jws.WebMethod;<br /><span class="code-keyword">import</span> javax.jws.WebService;<br /><span class="code-keyword">import</span> javax.xml.ws.WebServiceContext;<br /><span class="code-keyword">import</span> javax.xml.ws.*;<br /><span class="code-keyword">import</span> javax.xml.ws.handler.MessageContext;<br /><span class="code-keyword">import</span> javax.jws.*;<br /><span class="code-keyword">import</span> javax.annotation.Resource;<br /><span class="code-keyword">import</span> java.util.*;<br /><span class="code-keyword">import</span> javax.servlet.*;<br /><span class="code-keyword">import</span> javax.servlet.http.*<br />@WebService<br /><span class="code-keyword">public</span> class StatefulWS {<br />  @Resource<br />  WebServiceContext ctx;<br />  @WebMethod()<br />  <span class="code-keyword">public</span> <span class="code-object">int</span> addItem(<span class="code-object">String</span> name) {<br />    HttpServletRequest req = (HttpServletRequest) <br />      ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);<br />    HttpSession session = req.getSession(<span class="code-keyword">true</span>);<br />    <span class="code-keyword">if</span> (session == <span class="code-keyword">null</span>)<br />      <span class="code-keyword">throw</span> <span class="code-keyword">new</span> WebServiceException(<span class="code-quote">"No HTTP Session found"</span>);<br />    <span class="code-object">System</span>.out.println(<span class="code-quote">"httpsession: id="</span>+session.getId());<br /><br />    <span class="code-comment">//Get the cart object from the HttpSession<br /></span>    List&lt;Item&gt; cart = (List&lt;Item&gt;)session.getAttribute(<span class="code-quote">"myCart"</span>);<br />    <span class="code-keyword">if</span> (cart == <span class="code-keyword">null</span>)<br />    {       cart = <span class="code-keyword">new</span> ArrayList();     }<br />    <span class="code-comment">// Add the item to the cart<br /></span>    cart.add(<span class="code-keyword">new</span> Item(name));<br />    <span class="code-comment">// Save the updated cart in the HTTPSession<br /></span>    session.setAttribute(<span class="code-quote">"myCart"</span>, cart);<br />    <span class="code-comment">// <span class="code-keyword">return</span> the number of items in the stateful cart<br /></span>    <span class="code-keyword">return</span> cart.size();<br />  }<br />}<br /><span class="code-keyword">package</span> demo.ws.oracle;<br /><span class="code-keyword">public</span> class Item <span class="code-keyword">implements</span> java.io.Serializable {<br />  <span class="code-keyword">public</span> <span class="code-object">String</span> name;<span class="code-keyword">public</span> Item(<span class="code-object">String</span> name){<br />      <span class="code-keyword">this</span>.name = name;<br />  }<br />}</pre>
</div></div></div><p>Add <i>coherence-web-api</i> library into <i>weblogic.xml</i> [2].</p>

<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">&lt;weblogic-web-app<br />&nbsp;xmlns=<span class="code-quote">"http:<span class="code-comment">//xmlns.oracle.com/weblogic/weblogic-web-app"</span><br />&nbsp;xmlns:xsi=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span><br />&nbsp;xsi:schemaLocation=<span class="code-quote">"http://xmlns.oracle.com/weblogic/weblogic-web-app<br />&nbsp;http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"</span>&gt;<br /></span>  &lt;weblogic-version&gt;10.3.1&lt;/weblogic-version&gt;<br />  &lt;context-root&gt;Stateful_WS_Coherence&lt;/context-root&gt;<br />  &lt;library-ref&gt;<br />    &lt;library-name&gt;coherence-web-spi&lt;/library-name&gt;<br />    &lt;specification-version&gt;1.0.0.0&lt;/specification-version&gt;<br />    &lt;implementation-version&gt;1.0.0.0&lt;/implementation-version&gt;<br />    &lt;exact-match&gt;<span class="code-keyword">false</span>&lt;/exact-match&gt;<br />  &lt;/library-ref&gt;<br />&lt;/weblogic-web-app&gt;</pre>
</div></div></div><p>Deploy the web service to both managed servers.</p>

<h5><a href="editor-content.html?cs=utf-8" class="" name="StatefulJAX-WSwithCoherence*Web-Test&amp;nbsp;"></a>Test&nbsp;</h5>

<p>Run the test.
<br clear="all" /></p>
<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"><span class="code-keyword">package</span> demo.ws;<br /><span class="code-keyword">import</span> demo.ws.oracle.*;<br /><span class="code-keyword">import</span> java.io.IOException;<br /><span class="code-keyword">import</span> java.net.URL;<br /><span class="code-keyword">import</span> java.util.ArrayList;<br /><span class="code-keyword">import</span> java.util.List;<br /><span class="code-keyword">import</span> java.util.Map;<br /><span class="code-keyword">import</span> javax.xml.namespace.QName;<br /><span class="code-keyword">import</span> javax.xml.ws.BindingProvider;<br /><br /><span class="code-keyword">public</span> class StatefulWSClient {<br />  <span class="code-keyword">public</span> <span class="code-keyword">static</span> void main(<span class="code-object">String</span>[] args) <span class="code-keyword">throws</span> Exception {<br />    StatefulWSService service = <span class="code-keyword"><br />      new</span> StatefulWSService(<span class="code-object">Thread</span>.currentThread().getContextClassLoader()<br />        .getResource(<span class="code-quote">"META-INF/wsdls/StatefulWSService.wsdl"</span>)<br />       &nbsp;<span class="code-keyword">, new</span> QName(<span class="code-quote">"http:<span class="code-comment">//oracle.ws.demo/"</span>, <span class="code-quote">"StatefulWSService"</span>));<br /></span>    StatefulWS port = service.getStatefulWSPort();<br /><br />    ((BindingProvider)port).getRequestContext()<br />      .put(BindingProvider.SESSION_MAINTAIN_PROPERTY, <span class="code-keyword">true</span>);<br /><br />    ((BindingProvider)port).getRequestContext()<br />      .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, <br />      <span class="code-quote">"http:<span class="code-comment">//stacd15.us.oracle.com:7012/Stateful_WS_Coherence/StatefulWSService"</span>);<br /></span><br />    <span class="code-object">System</span>.out.println(<span class="code-quote">"calling "</span> + <br />      ((BindingProvider)port).getRequestContext()<br />        .get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));<br />    <span class="code-keyword">for</span> (<span class="code-object">int</span> j=0; j&lt;5; j++) {<br />      <span class="code-keyword">try</span> {<br />        <span class="code-object">int</span> response = port.addItem(<span class="code-quote">"abc"</span>);<br />        <span class="code-object">System</span>.out.println(<span class="code-quote">"Got "</span> + response);<br />        <span class="code-object">Thread</span>.currentThread().sleep(3000);<br />      } <span class="code-keyword">catch</span> (Exception ex)  {}<br />    }<br /><br />    ((BindingProvider)port).getRequestContext()<br />      .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, <br />      <span class="code-quote">"http:<span class="code-comment">//stacd15</span></span><span class="code-quote"><span class="code-comment">.us.oracle.com</span></span><span class="code-quote"><span class="code-comment">:7013/Stateful_WS_Coherence/StatefulWSService"</span>);<br /></span>    <span class="code-object">System</span>.out.println(<span class="code-quote">"calling "</span> + <br />      ((BindingProvider)port).getRequestContext()<br />        .get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));<br />    <span class="code-keyword">for</span> (<span class="code-object">int</span> j=0; j&lt;5; j++) {<br />      <span class="code-keyword">try</span> {<br />        <span class="code-object">int</span> response = port.addItem(<span class="code-quote">"abc"</span>);<br />        <span class="code-object">System</span>.out.println(<span class="code-quote">"Got "</span> + response);<br />        <span class="code-object">Thread</span>.currentThread().sleep(3000);<br />      } <span class="code-keyword">catch</span> (Exception ex)  {}<br />    }<br />  }<br />}</pre>
</div></div></div><p>The test invokes the web service five times for
each endpoint.&nbsp; The output shows that the returned count increases,
indicating synchronized web service state across both endpoints.
<br clear="all" /></p>
<div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">calling http:<span class="code-comment">//stacd15.us.oracle.com:7012/Stateful_WS_Coherence/StatefulWSService<br /></span>Got 1<br />Got 2<br />Got 3<br />Got 4<br />Got 5<br />calling http:<span class="code-comment">//stacd15.us.oracle.com:7013/Stateful_WS_Coherence/StatefulWSService<br /></span>Got 6<br />Got 7<br />Got 8<br />Got 9<br />Got 10</pre>
</div></div></div><p>Both managed servers output the same http session id's.
<br clear="all" />
</p><div class="macro" macrotext="{code}" command="code"><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">httpsession: id=tS1DNs2XTJZuQNhNfsl4fvpuj0Qd2ZnmTmHFKtKlUX4EytukR9V0!-280396885!1257829391923<br />httpsession: id=tS1DNs2XTJZuQNhNfsl4fvpuj0Qd2ZnmTmHFKtKlUX4EytukR9V0!-280396885!1257829391923<br />httpsession: id=tS1DNs2XTJZuQNhNfs14fvpuj0Qd2ZnmTmHFKtKlUX4EytukR9V0!-280396885!1257829391923<br />httpsession: id=tS1DNs2XTJZuQNhNfsl4fvpuj0Qd2ZnmTmHFKtKlUX4EytukR9V0!-280396885!1257829391923</pre>
</div></div></div><p class="atl_conf_pad"> </p>

<h5><a href="editor-content.html?cs=utf-8" class="" name="StatefulJAX-WSwithCoherence*Web-Reference"></a>Reference</h5>

<ol><li><span class="nobr"><a href="http://coherence.oracle.com/display/COH34UG/Coherence*Web+and+WebLogic+Server" mce_href="http://coherence.oracle.com/display/COH34UG/Coherence*Web+and+WebLogic+Server" rel="nofollow" linktype="raw" linktext="Coherence*Web and WebLogic Server|http://coherence.oracle.com/display/COH34UG/Coherence*Web+and+WebLogic+Server">Coherence*Web and WebLogic Server<sup><img class="rendericon" src="http://aseng-wiki.us.oracle.com/asengwiki/images/icons/linkext7.gif" mce_src="/asengwiki/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /></sup></a></span> </li><li><span class="nobr"><a href="http://download.oracle.com/docs/cd/E13924_01/coh.340/e14408/wslinstall.htm#BABFHGDG" mce_href="http://download.oracle.com/docs/cd/E13924_01/coh.340/e14408/wslinstall.htm#BABFHGDG" rel="nofollow" linktype="raw" linktext="Installing Coherence*Web on the WebLogic Server 10.3|http://download.oracle.com/docs/cd/E13924_01/coh.340/e14408/wslinstall.htm#BABFHGDG">Installing Coherence*Web on the WebLogic Server 10.3<sup><img class="rendericon" src="http://aseng-wiki.us.oracle.com/asengwiki/images/icons/linkext7.gif" mce_src="/asengwiki/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /></sup></a></span> </li><li><span class="nobr"><a href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13734/stateful.htm#BABBBEBH" mce_href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13734/stateful.htm#BABBBEBH" rel="nofollow" linktype="raw" linktext="Stateful JAX-WS|http://download.oracle.com/docs/cd/E12839_01/web.1111/e13734/stateful.htm#BABBBEBH">Stateful JAX-WS<sup><img class="rendericon" src="http://aseng-wiki.us.oracle.com/asengwiki/images/icons/linkext7.gif" mce_src="/asengwiki/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /></sup></a></span> </li><li><span class="nobr"><a href="http://www.oracle.com/technology/software/products/oepe/index.html" mce_href="http://www.oracle.com/technology/software/products/oepe/index.html" rel="nofollow" linktype="raw" linktext="Oracle Enterprise Pack for Eclipse|http://www.oracle.com/technology/software/products/oepe/index.html">Oracle Enterprise Pack for Eclipse<sup><img class="rendericon" src="http://aseng-wiki.us.oracle.com/asengwiki/images/icons/linkext7.gif" mce_src="/asengwiki/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /></sup></a></span> </li></ol>
 ]]>
      

   </content>
</entry>

<entry>
   <title>Understanding Custom Context propagation </title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/11/understanding_custom_context_p.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.15319</id>
   
   <published>2009-11-03T01:59:05Z</published>
   <updated>2009-11-03T02:18:29Z</updated>
   
   <summary>What is a Custom Work Context ? The idea behind out-of-band context propagation in Weblogic server was to allow application developers to send information from a client to an application as an extra payload on the underlying transport protocol. Typical...</summary>
   <author>
      <name>krish.chakraborty@oracle.com</name>
      
   </author>
   
      <category term="Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p><strong>What is a Custom Work Context ?</strong></p>

<p>The idea behind out-of-band context propagation in Weblogic server was to allow application developers to send information from a client to an application as an extra payload on the underlying transport protocol. Typical transport protocols that are supported for context propagation include Threads, JMS queues, SOAP, RMI etc. The use cases of context propagation are applications that need to carry information outside the application rather than inside the application itself. Diagnostics seems like a classic example that can ride on workcontext to propagate monitoring information from client to server and vice versa. For a quick refresher to work context propagation, please refer to latest <a href="http://download.oracle.com/docs/cd/E13222_01/wls/docs100/programming/context.html">Weblogic documentation</a>. A few important APIs in the workcontext framework are -</p>

<p>1. weblogic.workarea.WorkContextMap - The main context propagation interface to tie applications with data and propagate that information via application requests. WorkContextMap is part of the client/application's JNDI environment. The map can be accessed through JNDI lookup by the name <em>"java:comp/WorkContextMap"</em>.</p>

<p>2. weblogic.workarea.WorkContext - Developers could use this interface to marshal and unmarshal the user data that is passed along with the application. With the interface came a set of four implementing classes that could marshall 8 bit Ascii, Long, String and Serializable contexts.</p>

<p>Applications that started replying on this framework created custom contexts either by extending WorkContext or Serializable interface. We found some interesting use cases as these custom contexts were developed and put in use. The following sections document some of these use cases.</p>

<p><strong>Using the correct classloader to load a custom WorkContext</strong></p>

<p>Initially, the custom contexts were bundled as a part of the server through the Weblogic <a href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/classloading.html#wp1096756">System classpath</a>. As a result, the Context classloader (Weblogic System ClassLoader) for the Weblogic server could resolve these custom classes while unmarshalling the Work Context object. This scheme fell short of the fact that an application may not choose to bundle its custom context as a part of the System Loader in Weblogic. A specific application may choose to bundle the custom context as a part of the application (EAR or WAR) rather than the System classpath approach. Hence, instead of using <em>SystemLoader.loadClass(classname)</em> to resolve the custom context, the Server started relying on the Thread Context classloader to load the custom context. The Thread Context classloader is set correctly to the application loader if the unmarshalling of the context had to happen in an application loader scope.</p>

<p><strong>Inter-operating custom work contexts across different Weblogic server versions</strong></p>

<p>As Weblogic server got integrated into the Oracle Fusion Middleware Framework (11g), the context propagation framework faced a challenging problem with inter-operating custom work contexts created in 11g release with older versions of the Weblogic server.  Once a newly created custom context passed from a newer version of Weblogic server to an older version, the Weblogic server had to convert the byte array into a work context object while de-serializing the context in the older server. An older version of the server would not know about newer work context object types. This resulted in ClassNotFoundExceptions.</p>

<p>The solution to this problem was easy. The application provider had to wrap their custom objects in a SerializableWorkContext. In effect, the SerializableWorkContext wraps a Java Serializable object (for example a custom Work Context) such that on de-serializing the work context, the server does not hit the ClassNotFoundExceptions. When the work context provider is present in the newer version of the server, it would firstly get the SerializableWorkContext from the map and then get the wrapped serializable custom object.  The custom context provider knows if it can handle the new context. Hence, the serialization of the custom object gets controlled by the application provider rather than the work context framework. </p>

<p>Here is a snippet of code that creates a Serializable work context and puts it in the work context map for the client .</p>

<p>1. <em>WorkContext serializedCustomContext = PrimitiveContextFactory.create(Serializable customContext)</em></p>

<p>2. Put the serialized custom context inside the workcontext map -</p>

<p><em>WorkContextMap map =<br />
                    WorkContextHelper.getWorkContextHelper().getWorkContextMap();</p>

<p> map.put(MYAPP.CUSTOM_CONTEXT,serializedCustomContext);</em></p>

<p>On the receiving end, the custom context would be retrieved as -</p>

<p>1.  <em>WorkContextMap map =<br />
                    WorkContextHelper.getWorkContextHelper().getWorkContextMap();</em></p>

<p>2. <em>(SerializableWorkContext)WorkContext customContext = (SerializableWorkContext)map.get(MYAPP.CUSTOM_CONTEXT);</em></p>

<p>3. <em>MyContext myCtx = (MyContext)((SerializableWorkContext)customContext).get();</em></p>

<p>Unless the application provider turned around and calls step (3) or <em>customContext.getSerializable(), </em>the custom object would not be converted from a byte array to an object instance. Hence, the workcontext framework would simply unmarshal the wrapped serialized object containing the payload instead of de-serializing the custom object itself. This mechanism shifts the control of de-serializing to the application provider who now has more control on when to convert the byte array into the custom work context.</p>

<p>If the application provider on a specific Weblogic server version cannot de-serialize the custom context, it would pass the wrapped object to a different server who may be able to read it fully.  The mechanism is limited to Serializable work context types. Serialized work contexts come with a performance overhead. Hence an application provider should carefully evaluate the pros and cons of using a Serialized work context type.</p>

<p>So far so good. Now came the side effect of when to serialize while sending a custom context from a client.</p>

<p><strong>When to serialize the custom work context before sending it from the client</strong></p>

<p>There is a hidden side-effect to SerializedWorkContexts other than performance. A serialized work context is serialized the moment it is created. For example, if the client wraps its custom context in a Serializable context -</p>

<p><em>WorkContext customContext = PrimitiveContextFactory.create(Serializable context)</em>;</p>

<p>The custom work context is serialized at the point of creation (the <em>create </em>call). This is often a drawback to the application provider who may not have all the information it needs at the creation time to stuff in the custom context. Once the context is created, its too late to change it. Hence we needed a better mechanism to delay the serialization of the custom context. This allows the Serializable context data to be updated even after it is put in the WorkContextMap. From 11g release, the framework provided a new API to create a mutable Serializable object that in effect delayed the serialization of the work context -</p>

<p><em>WorkContext customContext = PrimitiveContextFactory.createMutable(Serializable context);</em></p>

<p>The mutable work context vastly improved the time window when clients could change the contents of the work context. Diagnostic frameworks often use this feature since they do not have all the information they need in the work context when creating it in the first place. However, they do have all the required information just before the request is send over the wire from the client to the server. This feature gave developers the opportunity to change the workcontext repeatedly before it was put on the wire.</p>

<p>We haven't talked about the inter-operability case with mutable work contexts. The Weblogic server itself needs to distinguish from a mutable (or delayed serialized work context) from the plain serialized work context. Hence the mutable flag or property had to be carried with the new type of work context so that the Server could take an appropriate action when it came across a mutable or non mutable Serializable work context.</p>

<p><strong>When is a Work Context is really available to the application ?</strong></p>

<p>It would be desirable for a work context send from a client to a server to be available to the application the moment the request is intercepted. However, the availability of the workcontext in the application is dependent on the client server communication protocol. For example, when a Web Services request is send over HTTP, the SOAP request is not unmarshalled by the server unless the protocol specific interceptors (or handlers who know what to do with the payload) have read the whole SOAP message. The interceptors don't fire at the first point of request interception. If applications have J2EE filters or security related policy checks that are done before the SOAP request is unmarshalled, the goodies in the workcontext payload are hidden to these consumers unless the SOAP envelope is fully unmarshalled later. This is a known limitation with how work contexts interact with the different protocols.</p>

<p>Unless the request is completely unmarshalled, a call to the WorkContextMap to fetch an already known work context will return null -</p>

<p><em>WorkContext context =<br />
                    WorkContextHelper.getWorkContextHelper().getWorkContextMap().get(MYAPP.MY_CONTEXT);</em></p>

<p>It is therefore incumbent on frameworks who ride on Weblogic work contexts not to access the map during this window (intercept request --> unmarshall request). Though this window is small, its possible some piece of application code would like get hold of the incoming work context at the very first request interception point. Without that, they may face the dilemma of having to reconcile a work context created during this window and the real work context that reveals itself later. Such reconciliations are tough and come with even more serious inter-operability side effects. Hence, its recommended that the workcontext is only accessed from the map after the request is fully unmarshalled.</p>

<p><strong>In Conclusion</strong> </p>

<p>Custom work contexts (mutable or un-mutable) is a handy feature for applications who intend to send extra data outside the application scope. The Weblogic server tries to hide all the underlying gory details of marshalling and unmarshalling the context associated with various protocols from the end user. The consumer simply needs to remember the "key" or "id" to the stuffed work context in the incoming request and pull the work context out of the map. Used wisely, this feature can save man hours with applications providers who intend to drive data outside their scope. The workcontext framework has also evolved over time to learn and adapt with changing needs of the application provider. Once used primarily as an internal Weblogic server feature, workcontext is now full integrated and deployed in applications running on Oracle Fusion Middleware 11g framework.</p>]]>
      
   </content>
</entry>

<entry>
   <title>SSL Troubleshooting and Debugging</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/10/ssl_troubleshooting_and_debugg.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.15296</id>
   
   <published>2009-10-30T20:45:46Z</published>
   <updated>2009-11-06T02:29:21Z</updated>
   
   <summary>SSL Troubleshooting and Debugging Due to the very nature of secure channel establishment, it is often difficult to even approach troubleshooting and debugging SSL related issues. This brief article intends to illustrate the challenges, approaches and tools available for debugging...</summary>
   <author>
      <name>larry.mccay@oracle.com</name>
      
   </author>
   
   <category term="ssldebugging" label="SSL debugging" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p><big><strong>SSL Troubleshooting and Debugging</strong><br />
</big><br />
Due to the very nature of secure channel establishment, it is often difficult to even approach troubleshooting and debugging SSL related issues.</p>

<p>This brief article intends to illustrate the challenges, approaches and tools available for debugging these difficult scenarios.</p>

<p><strong>SSL Description<br />
</strong></p>

<p>Secure Socket Layer (SSL) is a protocol for providing a secure channel of communication between two computers. It makes provisions for data integrity, confidentiality and authentication. Authentication of the server - by the client - provides an assurance of the fact that the traffic has not been diverted to an attacking server. Mutual authentication requires the client to provide credentials to the server over the secure channel.</p>

<p><strong>SSL Handshake Overview</strong></p>

<p>In order to really be able to troubleshoot and debug SSL related issues, we need an understanding of what the protocol actually does on both the client and server sides. This understanding will enable us to quickly categorize the type of problem being encountered and hopefully a category of approaches for tracking down the root cause.</p><div align="center"><img alt="SSL Diagrams.jpg" src="http://blogs.oracle.com/WebLogicServer/2009/10/30/ssl/SSL%20Diagrams.jpg" class="mt-image-none" height="623" width="482" /></div><p>We will touch on issues and troubleshooting approaches in the following categories:</p>

<p>1. Certificate Validation<br />
2. Trust<br />
3. Configuration</p>

<p>So let's briefly describe the protocol with a bit of focus on these three categories.</p>

<p>The client initiates the SSL connection by requesting a channel through the use of a ClientHello handshake message. This message contains the Cipher Suites that are configured to be supported by the client side and are available for the server to choose in creating the most secure channel configuration possible between the two machines. It also contains a random number to be used by the server in the generation of keys - this random number is a result of the configured or default RNG on a given platform.</p>

<p>The server side, in turn, responds with a ServerHello that includes the Cipher Suite selected by the server as the most appropriately secure suite for the channel. If a suitable cipher suite could not be selected from the list of supported suites provided by the client - the request for an SSL connection is denied by the server. It also includes a random number and the certificate that is to be used for authenticating the server to the client. This certificate must be validated by the client in order for it to be trusted as representing the identity asserted by it.</p>

<p><br />
This validation is based on a number of possible factors (driven by configuration):</p>

<p>1.Whether it is expired<br />
2.Whether it has been revoked<br />
3.Whether it was issued by a trusted Certificate Authority<br />
4.Whether the server name within the certificate matches the host name for the current connection</p>

<p><strong>Where Things Can Go Wrong<br />
</strong></p>

<p>There are a number of common scenarios that occur as a result of improperly configured environments, clients, servers and certificates that can be categorized into one or more of the afore mentioned categories.</p>

<p>The following are a few descriptions of these scenarios and what the approach to identifying the root cause might be.</p>

<p><b>Keystores and Truststores </b><br />
- Categories: Configuration, Trust, Certificate Validation</p>

<p>The client (for mutual authentication) and server each present the other a certificate that represents the identity of the machine its running on. In order for either to present this certificate - it must be available within the appropriate Keystore.</p>

<p><b>Tip 1</b>: Determine the default certificate for a machine as appropriate for your server and ensure that it exists within the configured Keystore and is available to the process that needs to present it to the corresponding partner process.</p>

<p><b>Tip 2</b>: Ensure that the issuer of the presented certificate exists within the appropriate Truststore of the recipient process.<br />
</p><p><b>Supported Cipher Suites</b><br />
 - Categories: Configuration</p>

<p>As described earlier, the handshake involves the selection of the most secure Cipher Suite by the server from the list of supported suites presented by the client.</p>

<p>If there isn't a common Cipher Suite between the client and server, then there is no way for the two machines to establish a secure channel - as there is no common language that will be understood buy each party that provides the necessary protection offered by SSL.</p>

<p><b>Tip 3</b>: Ensure that the appropriate Cipher Suites are enabled on the client and server sides in order to establish this common language for secure message exchange.</p>

<p><b>Tip 4</b>: Utilize SSL debug information to determine which cipher suites has been selected<br />
...<aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ssltrustvalidator returns:="" 0=""><br /></ssltrustvalidator></bea-000000></securityssl></debug></aug></p><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;SSLTrustValidator returns: 0&gt;</font></samp>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Trust status (0): NONE&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Performing hostname validation checks:
stabd58&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;isMuxerActivated: false&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;17849795 SSL3/TLS MAC&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;17849795 received HANDSHAKE&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;HANDSHAKEMESSAGE: ServerHelloDone&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version
1.6 for algorithm HmacMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm HmacMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version
1.6 for algorithm HmacSHA1&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm HmacSHA1&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm MD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Using JCE Cipher: SunJCE version 1.6 for
algorithm RC4&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version
1.6 for algorithm HmacMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm HmacMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version
1.6 for algorithm HmacSHA1&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm HmacSHA1&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Using JCE Cipher: SunJCE version 1.6 for
algorithm RSA&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;write HANDSHAKE, offset = 0, length = 70&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;write CHANGE_CIPHER_SPEC, offset = 0, length =
1&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Using JCE Cipher: SunJCE version 1.6 for
algorithm RC4&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version
1.6 for algorithm HMACMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm HMACMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version
1.6 for algorithm HmacMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm HmacMD5&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Ignoring not supported JCE Mac: SunJCE version
1.6 for algorithm HmacSHA1&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;Will use default Mac for algorithm HmacSHA1&gt;</font></samp></p>
<p style="margin-bottom: 0in;"><samp><font style="font-size: 8pt;" size="1">&lt;Aug
19, 2009 2:34:57 PM PDT&gt; &lt;Debug&gt; &lt;SecuritySSL&gt;
&lt;BEA-000000&gt; &lt;write HANDSHAKE, offset = 0, length = 16&gt;</font></samp></p>

<aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ssltrustvalidator returns:="" 0=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><trust status="" (0):="" none=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><performing hostname="" validation="" checks:="" stabd58=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ismuxeractivated: false=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><handshakemessage: serverhellodone=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" md5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><using jce="" cipher:="" sunjce="" version="" 1.6="" for="" algorithm="" rc4=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><using jce="" cipher:="" sunjce="" version="" 1.6="" for="" algorithm="" rsa=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><write handshake,="" offset="0," length="70"><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><write change_cipher_spec,="" offset="0," length="1"><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><using jce="" cipher:="" sunjce="" version="" 1.6="" for="" algorithm="" rc4=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></using></bea-000000></securityssl></debug></aug></write></bea-000000></securityssl></debug></aug></write></bea-000000></securityssl></debug></aug></using></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></using></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></handshakemessage:></bea-000000></securityssl></debug></aug></bea-000000></securityssl></debug></aug></bea-000000></securityssl></debug></aug></ismuxeractivated:></bea-000000></securityssl></debug></aug></performing></bea-000000></securityssl></debug></aug></trust></bea-000000></securityssl></debug></aug></ssltrustvalidator></bea-000000></securityssl></debug></aug><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ssltrustvalidator returns:="" 0=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><trust status="" (0):="" none=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><performing hostname="" validation="" checks:="" stabd58=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ismuxeractivated: false=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><handshakemessage: serverhellodone=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" md5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><using jce="" cipher:="" sunjce="" version="" 1.6="" for="" algorithm="" rc4=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><using jce="" cipher:="" sunjce="" version="" 1.6="" for="" algorithm="" rsa=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><write handshake,="" offset="0," length="70"><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><write change_cipher_spec,="" offset="0," length="1"><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><using jce="" cipher:="" sunjce="" version="" 1.6="" for="" algorithm="" rc4=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacmd5=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><ignoring not="" supported="" jce="" mac:="" sunjce="" version="" 1.6="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><will use="" default="" mac="" for="" algorithm="" hmacsha1=""><aug 19,="" 2009="" 2:34:57="" pm="" pdt=""><debug><securityssl><bea-000000><write handshake,="" offset="0," length="16">...</write></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></using></bea-000000></securityssl></debug></aug></write></bea-000000></securityssl></debug></aug></write></bea-000000></securityssl></debug></aug></using></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></using></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></will></bea-000000></securityssl></debug></aug></ignoring></bea-000000></securityssl></debug></aug></handshakemessage:></bea-000000></securityssl></debug></aug></bea-000000></securityssl></debug></aug></bea-000000></securityssl></debug></aug></ismuxeractivated:></bea-000000></securityssl></debug></aug></performing></bea-000000></securityssl></debug></aug></trust></bea-000000></securityssl></debug></aug></ssltrustvalidator></bea-000000></securityssl></debug></aug>

<p><br /></p><p><b>Tip 5</b>: Utilize a tool such as SSLDump as necessary to see details of the handshake and application data message exchanges<br />
...</p><p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
1  0.0035 (0.0035)  C&gt;S SSLv2 compatible client hello</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Version
3.1</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">cipher
suites</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_RSA_WITH_RC4_128_MD5</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">SSL2_CK_RC4</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_RSA_WITH_RC4_128_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_DHE_DSS_WITH_RC4_128_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_ECDH_ECDSA_WITH_RC4_128_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Unknown
value 0x4e</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Unknown
value 0x2f</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Unknown
value 0x35</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Unknown
value 0x4b</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Unknown
value 0x4c</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_RSA_WITH_3DES_EDE_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Unknown
value 0x50</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_RSA_WITH_DES_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_DHE_DSS_WITH_DES_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_DHE_RSA_WITH_DES_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_ECDH_ECDSA_WITH_DES_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">Unknown
value 0x4f</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_RSA_EXPORT1024_WITH_RC4_56_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_DHE_DSS_WITH_RC2_56_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_RSA_EXPORT_WITH_RC4_40_MD5</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">SSL2_CK_RC4_EXPORT40</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_RSA_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DH_anon_WITH_3DES_EDE_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_DH_anon_WITH_RC4_128_MD5</font></code></p>
<p style="margin-bottom: 0in;"><code>  <font style="font-size: 8pt;" size="1">TLS_DH_anon_WITH_DES_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DH_anon_EXPORT_WITH_RC4_40_MD5</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_RSA_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code> 
<font style="font-size: 8pt;" size="1">TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
2  0.0053 (0.0017)  S&gt;C  Handshake</font></code></p>
<p style="margin-bottom: 0in;"><code>      <font style="font-size: 8pt;" size="1">ServerHello</font></code></p>
<p style="margin-bottom: 0in;"><code>        <font style="font-size: 8pt;" size="1">Version
3.1</font></code></p>
<p style="margin-bottom: 0in;"><code>        <font style="font-size: 8pt;" size="1">session_id[0]=</font></code></p>
<p style="margin-bottom: 0in;"><br />
</p>
<p style="margin-bottom: 0in;"><code>        <font style="font-size: 8pt;" size="1">cipherSuite
        TLS_DH_anon_WITH_3DES_EDE_CBC_SHA</font></code></p>
<p style="margin-bottom: 0in;"><code>        <font style="font-size: 8pt;" size="1">compressionMethod
                  NULL</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
3  0.0053 (0.0000)  S&gt;C  Handshake</font></code></p>
<p style="margin-bottom: 0in;"><code>      <font style="font-size: 8pt;" size="1">ServerKeyExchange</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">Short
read: 0 bytes available (expecting 2)</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
4  0.0065 (0.0012)  S&gt;C  Handshake</font></code></p>
<p style="margin-bottom: 0in;"><code>      <font style="font-size: 8pt;" size="1">ServerHelloDone</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
5  0.0976 (0.0910)  C&gt;S  Handshake</font></code></p>
<p style="margin-bottom: 0in;"><code>      <font style="font-size: 8pt;" size="1">ClientKeyExchange</font></code></p>
<p style="margin-bottom: 0in;"><code>       
<font style="font-size: 8pt;" size="1">DiffieHellmanClientPublicValue[128]=</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">8a
23 78 02 8a a5 fc 03 f4 9b 7c 33 05 22 36 91</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">85
9d 17 e4 bf bf 0a 3e be 45 25 47 07 e0 9c a2</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">e5
d6 bf 78 95 f1 84 ca cb cc e4 3e f3 d8 d4 9a</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">3a
01 71 5c 29 0c 0b f9 69 8d 3e a6 f4 08 f0 36</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">18
fd a7 b9 3e 30 4e a4 a6 19 d9 d3 64 1c 3c 78</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">d3
c3 fa 83 07 58 f2 be d2 32 80 c0 32 4e 49 4c</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">bf
73 1a f2 d8 fd f2 16 c7 31 da 48 58 50 bb 99</font></code></p>
<p style="margin-bottom: 0in;"><code>          <font style="font-size: 8pt;" size="1">3f
a4 8c 31 6e 5f ed e8 0d d8 91 cf 8f eb fa d8</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
6  0.0976 (0.0000)  C&gt;S  ChangeCipherSpec</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
7  0.0976 (0.0000)  C&gt;S  Handshake</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
8  0.0997 (0.0021)  S&gt;C  ChangeCipherSpec</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
9  0.1000 (0.0002)  S&gt;C  Handshake</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
10 0.3580 (0.2580)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
11 0.3580 (0.0000)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
12 0.3586 (0.0005)  S&gt;C  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
13 2.5039 (2.1453)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
14 2.5039 (0.0000)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">11
15 2.5053 (0.0013)  S&gt;C  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
20 31.4483 (3.3621)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
21 31.4483 (0.0000)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
22 31.4507 (0.0024)  S&gt;C  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
23 31.4508 (0.0000)  S&gt;C  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
24 32.0824 (0.6316)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
25 32.0824 (0.0000)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
26 32.2550 (0.1726)  S&gt;C  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
27 32.2550 (0.0000)  S&gt;C  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
28 33.1710 (0.9159)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
29 33.1710 (0.0000)  C&gt;S  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
30 33.1745 (0.0035)  S&gt;C  application_data</font></code></p>
<p style="margin-bottom: 0in;"><code><font style="font-size: 8pt;" size="1">8
31 33.1754 (0.0009)  C&gt;S  application_data</font></code></p>

...<br />
<br /><b>Anonymous Cipher Suite</b><br />
 - Categories: Configuration

<p>The failure of a client or server to reject a certificate that is not trusted may present as potential SSL problem. Recall earlier that I describe the process of selecting the most secure Cipher Suite common between both parties.</p>

<p>In a scenario where one of the parties has only the anonymous Cipher Suite enabled and the other party  also has it enabled - even if it is one of many - the anonymous cipher suite will be selected and the connection will not be rejected.</p>

<p><b>Tip 6</b>: see Tip 5 above - in fact, the example ssldump output above is from troubleshooting just such a scenario</p>

<p><b>Trusted CA's</b></p>

<p>
 - Categories: Trust, Configuration <br /></p><p>Unless the issuer of a certificate is found in the Truststore of a client or server involved in the establishment of an SSL connection, the certificate validation will fail.</p>

<p><b>Tip 7</b>: Determine the Truststore/s in use and whether or not the issuer of the presented certificate exists within the configured Truststore</p>

<p><b>Tip 8</b>: Utilize keytool in order to dump the contents of the Truststores (or keystores for the presented certificates)</p>

<p>Alias name: ttelesecglobalrootclass3ca<br />
Creation date: Feb 10, 2009<br />
Entry type: trustedCertEntry</p>

<p>Owner: CN=T-TeleSec GlobalRoot Class 3, OU=T-Systems Trust Center, O=T-Systems Enterprise Services GmbH, C=DE<br />
Issuer: CN=T-TeleSec GlobalRoot Class 3, OU=T-Systems Trust Center, O=T-Systems Enterprise Services GmbH, C=DE<br />
Serial number: 1<br />
Valid from: Wed Oct 01 03:29:56 PDT 2008 until: Sat Oct 01 16:59:59 PDT 2033<br />
Certificate fingerprints:<br />
         MD5:  CA:FB:40:A8:4E:39:92:8A:1D:FE:8E:2F:C4:27:EA:EF<br />
         SHA1: 55:A6:72:3E:CB:F2:EC:CD:C3:23:74:70:19:9D:2A:BE:11:E3:81:D1<br />
         Signature algorithm name: SHA256withRSA<br />
         Version: 3</p>

<p>Extensions:</p>

<p>#1: ObjectId: 2.5.29.15 Criticality=true<br />
KeyUsage [<br />
  Key_CertSign<br />
  Crl_Sign<br />
]</p>

<p>#2: ObjectId: 2.5.29.19 Criticality=true<br />
BasicConstraints:[<br />
  CA:true<br />
  PathLen:2147483647<br />
]</p>

<p>#3: ObjectId: 2.5.29.14 Criticality=false<br />
SubjectKeyIdentifier [<br />
KeyIdentifier [<br />
0000: B5 03 F7 76 3B 61 82 6A   12 AA 18 53 EB 03 21 94  ...v;a.j...S..!.<br />
0010: BF FE CE CA                                        ....<br />
]<br />
]</p><p><br />
<b>Certificate Expiration</b><br />
 - Categories: Certificate Validation, Configuration</p>

<p><b>Tip 9</b>: see Tip 8 above - In the example keytool output above you can see the dates for which the particular certificate is valid.</p>

<p>Valid from: Wed Oct 01 03:29:56 PDT 2008 until: Sat Oct 01 16:59:59 PDT 2033</p>

<p><b>Random Number Generation (RNG) Issue</b><br />
- Categories: Configuration</p>

<p>Performance issues may be encountered due to low or zero entropy on a server. This entropy results in longer than expected blocking in acquiring the random number seeding from /dev/random. There are a  couple potential workarounds.</p>

<p>1.use /dev/urandom - NOTE: this may result in degenerated encryption strength and must be investigated by your system/security administrators<br />
2.patches may be available for your particular Linux flavor or Solaris</p>

<p><b>Tip 10</b>: Observe through SSL debug output whether or not the handshake is timing out as this is an indicator that perhaps we are blocking on the RNG</p>

<p><b>Tip 11</b>: Ensure that all related patches have been installed on your machine.</p>

<p><strong>Available Tools and Facts</strong></p>

<p>Like any other specialization, troubleshooting and debugging security - and SSL in particular - presents unique challenges and to address these unique challenges we need to be prepared by having appropriate tools and facts at our disposal.</p>

<p>In order to be productive in this area, we need to know certain things about the environment, management consoles, etc.</p><p><br />
<b>Debug output</b><br />
Each middleware platform provides the ability to configure the server to run with SSL debug logging turned on. This configuration enables the viewer of the logs to see pertinent information regarding the configuration and runtime behavior of the handshaking and application data message exchanges in real time.</p>

<p><b>Tip 12</b>: Determine what the configuration mechanism is for turning on SSL debug information on your platform. On WebLogic Server the following System Properties are used to configure SSL debug information and can be used on the command line or within start up scripts:</p>

<p>-Dssl.debug=true -Dweblogic.StdoutDebugEnabled=true -Dweblogic.security.SSL.verbose=true</p>

<p><b>Tip 13</b>: When you have access to starting the server with these System properties do so immediately - the information that it creates will be valuable - if not to you then to someone else that is pulled in to help debug - at which time you will be request to do so anyway and go through the whole thing again.</p>

<p><strong>SSLDump</strong></p>

<p>In cases where we don't have access to the server to restart with SSL debug logging or when we would like to supplement that output with additional information SSLDump is hugely valuable.</p>

<p>ssldump is an SSLv3/TLS network protocol analyzer.  It identifies TCP connections on the chosen network interface and attempts to interpret them as SSLv3/TLS traffic.  When it identifies SSLv3/TLS traffic, it decodes the records and displays them in a textual form to stdout.  If provided with the appropriate keying material, it will also decrypt the connections and display the application data traffic.</p>

<p><b>Tip 14</b>: Download a copy of ssldump from http://www.rtfm.com/ssldump/. You will need to build it on your platform and you may actually need to resolve a couple compilation errors - but it is well worth it.</p>

<p>Examples:</p>

<p>To listen to traffic on port 443:<br />
	ssldump -i eth0 port 443</p>

<p>To listen to traffic to the server target on port 443:<br />
	ssldump -i eth0 port 443 and host target</p>

<p>To decrypt traffic to the host target server.pem and the password foobar:<br />
	ssldump -i eth0 -Ad -k ~/server.pem -p foobar host target</p>

<p><strong>Generic SSL Client</strong></p>

<p>Once you have ssldump built and running on your machine, you can use any SSL client to target the server that you are trying to troubleshoot. Often a browser will suffice - however you may need to build a client more appropriate for your usecase.</p>

<p><b>Tip 15</b>: Utilize ssldump, SSL debug logging and your SSL client to observe the messages exchanged and the runtime behavior that manifests as a result of your current configuration.</p>

<p><strong>Platform Specific Knowledge</strong></p>

<p>Become intimately familiar with where the appropriate keystores, truststores, configuration files and management consoles are located.</p>

<p><b>Tip 16</b>: Maintain a checklist of this information and keep it handy so that you don't have to rediscover it every time you encounter SSL issues.</p>

<p><strong>Books</strong></p>

<p>SSL and TLS: Designing and Building Secure Systems, Addison-Wesley, 2001 ISBN 0-201-61598-3 </p>

<p>http://www.rtfm.com/sslbook/</p>]]>
      
   </content>
</entry>

<entry>
   <title>Use WLST to configure AQ JMS in Weblogic</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/10/use_wlst_to_configure_aq_jms_i.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.15291</id>
   
   <published>2009-10-30T18:14:21Z</published>
   <updated>2009-10-30T20:12:52Z</updated>
   
   <summary>For AQ JMS Weblogic integration, our documents were based on Weblogic admin console. While the admin console is more user friendly because of its intuitive and easy GUI interface, it is less desirable for some situations such as following comparing...</summary>
   <author>
      <name>qiang.liu</name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>For AQ JMS Weblogic integration, our documents were based on Weblogic admin console. While the admin console is more user friendly because of its intuitive and easy GUI interface, it is less desirable for some situations such as following comparing with WLST.</p>

<p>1) The configuration is huge with hundreds of connection factories and destinations<br />
2) The same configuration need to be done repeatedly many times<br />
3) The User wants to keep an easy to read record of what have been configured</p>

<p>The difficulty of directly using the WLST is to understand and navigate the complex structure of WebLogic management. In this blog, we demonstrate a jython script to help to overcome this difficulty.</p>

<p>The script is structured into several jython functions so it can be easily customized by other people. Here is the list of functions</p>

<p><strong>    def createDataSource(host, port, sid, username='', password='', \<br />
        dsName=DEFAULT_DATASOURCE_NAME, \<br />
        dsJndiName=DEFAULT_DATASOURCE_JNDI, xa=DEFAULT_DATASOURCE_XA, \<br />
        serverTargets=DEFAULT_DATASOURCE_SERVER_TARGETS, \<br />
        clusterTargets=DEFAULT_DATASOURCE_CLUSTER_TARGETS):</strong></p>

<p>    This function creates a Weblogic datasource for AQJMS usage</p>

<p>    host: the host name of the Oracle database<br />
    port: the port number of the Oracle database<br />
    sid: the SID of the Oracle database<br />
    username: the Oracle database username<br />
    password: the Oracle database password<br />
    dsName: the name of the datasource, the default is 'aqds'<br />
    dsJndiName: the JNDI name of the datasource, the default is 'jdbc/aqds'<br />
    xa: whether to use the XA driver or non-XA driver<br />
    serverTargets: the server targets of this datasource in a comma separated string<br />
                   the default is 'AdminServer'<br />
    clusterTargets: the cluster targets of this datasource in a comma separated string<br />
                    the default is empty string</p>

<p>    This function will ask for Oracle database username and password dynamically<br />
    if they are not passed by parameters</p>

<p><strong>    def createAQModule(aqcfs, aqdests, \<br />
        moduleName=DEFAULT_AQ_MODULE_NAME, \<br />
        fsName=DEFAULT_AQ_FS_NAME, \<br />
        dsJndiName=DEFAULT_DATASOURCE_JNDI, \<br />
        serverTargets=DEFAULT_AQ_MODULE_SERVER_TARGETS,\<br />
        clusterTargets=DEFAULT_AQ_MODULE_CLUSTER_TARGETS):</strong></p>

<p>    This function creates an AQ module in Weblogic Server<br />
    aqcfs: A sequence of connection factories data of this AQ foreign server<br />
    aqdests: A sequence of destinations data of this AQ foreign server<br />
    moduleName: the name of this AQ module, the default is 'aq_module'<br />
    fsName: the name of the AQ foreign server, the default is 'aq_fs'<br />
    dsJndiName: the JNDI name of the Weblogic datasource of this AQ foreign server,<br />
                the default is 'jdbc/aqds'<br />
    serverTargets: the server targets of this AQ module in a comma separated string<br />
                   the default is ''AdminServer'<br />
    clusterTargets: the cluster targets of this AQ module in a comma separated string<br />
                    the default is empty string</p>

<p>    <strong>def setupAQJMSFromFile(filepath):</strong></p>

<p>    This function parses the configuration file and setup AQ module and datasource in <br />
    Weblogic with the data in the configuration file. The configuration file is in key=value <br />
    format. </p>

<p>    The list of mandatory keys are listed below<br />
    HOST: the host of AQ server<br />
    PORT: the port of AQ server<br />
    SID: the database sid of AQ server<br />
    USERNAME: the database username of AQ server<br />
    PASSWORD: the database password of AQ server</p>

<p>    The list of optional keys are listed below     <br />
    CONN_FACT: the data to create a Weblogic foreign server connection factory <br />
               pointing to an AQ JMS connection factory. The value of this property is as <br />
               following:<br />
               {WLS_CF_NAME:<name>,CF_JNDI:<jndi>,CF_TYPE:<type>}<br />
               where the CF_TYPE has to be one of 'ConnectionFactory', <br />
               'QueueConnectionFactory', 'TopicConnectionFactory', 'XAConnectionFactory'<br />
               'XAQueueConnectionFactory' and 'XATopicConnectionFactory'<br />
    DESTINATION: the data to create a Webloic foreign server destination pointing to an<br />
               AQ destination. The value of this property is as following:<br />
               {WLS_DEST_NAME:<wls_name>,AQ_DEST_NAME:<aq_name>,DEST_JNDI:<br />
                <jndi>,DEST_TYPE:<type>}<br />
               where the DEST_TYPE has to be either 'QUEUE' or 'TOPIC'<br />
    DATASOURCE_NAME: the name of the datasource, default to 'aqds'<br />
    DATASOURCE_JNDI: the JNDI name of the datasource, default to 'jdbc/aqds'<br />
    DATASOURCE_XA: whether the datasource uses XA driver, default to 1<br />
    DATASOURCE_SERVER_TARGETS: the server targets of this datasource in a <br />
                               comma separated string. default to 'AdminServer'<br />
    DATASOURCE_CLUSTER_TARGETS: the cluster targets of this datasource in a <br />
                               comma separated string. default to empty string<br />
    AQ_MODULE_NAME: the Weblogic module for AQJMS, default to 'aq_module'<br />
    AQ_FS_NAME: the Weblogic foreign server name for AQJMS, default to 'aq_fs'<br />
    AQ_MODULE_SERVER_TARGETS: the server targets of this aq module in a comma <br />
                              separated string. default to 'AdminServer'<br />
    AQ_MODULE_CLUSTER_TARGETS: the cluster targets of this aq module in a <br />
                              comma separated string. default to empty string</p>

<p><br />
When the script is run, it will ask the user for a configuration file and call 'setupAQJMSFromFile' with this file. Most configuration parameters in this script have default value except the most essential ones such as database host, port, sid, connection factory info and destination info. The script also does a best effort validation of these data.</p>

<p><strong><br />
Here are some examples of using this script.</strong></p>

<p>1) Running the script standalone</p>

<p>java weblogic.WLST aq_wlst.py</p>

<p>with the AQ configuration file as following:<br />
HOST=localhost<br />
PORT=5521<br />
SID=db11<br />
USERNAME=jmsuser<br />
PASSWORD=jmsuser<br />
CONN_FACT=WLS_CF_NAME:aqcf,CF_JNDI:aqcf,CF_TYPE:XAQueueConnectionFactory}<br />
DESTINATION=WLS_DEST_NAME:aq_queue,AQ_DEST_NAME:MY_QUEUE,DEST_JNDI:aq_queue,DEST_TYPE:QUEUE}<br />
DATASOURCE_SERVER_TARGETS=ms1,ms2<br />
DATASOURCE_CLUSTER_TARGETS=Cluster-0<br />
AQ_MODULE_SERVER_TARGETS=ms1,ms2<br />
AQ_MODULE_CLUSTER_TARGETS=Cluster-0</p>

<p>After it runs, the datasource, AQ module, AQ foreign server, connection factories and destinations will be configured and targeted. The datasource name, datasource JNDI name, AQ module name, AQ foreign server name are not provided in the configuration file, so the script uses the default value as above.</p>

<p>2) Running the script to execute multiple AQ configuration files in one transaction</p>

<p>The script is structured into several functions so it is easy to customize or extend. For example, here is an example extension. We can modify the main function of the script to get all the files with the extension conf in the current directory and execute them in one transaction instead of asking for configuration file from the user.<br />
<pre><br />
    import glob<br />
    connect()<br />
    failed=1<br />
    try:<br />
        edit()<br />
        startEdit()<br />
        for cf in glob.glob("*.conf"):<br />
            setupAQJMSFromFile(cf)<br />
        activate(200000, block='true')<br />
        failed=0<br />
    finally:<br />
        if failed:<br />
            undo('false','y')<br />
        disconnect('true')<br />
</pre><br />
The script and a sample configuration file are attached with this blog.</p>

<p><span class="mt-enclosure mt-enclosure-file" style="display: inline;"><a href="http://blogs.oracle.com/WebLogicServer/aq_wlst.py">aq_wlst.py</a></span></p>

<p><span class="mt-enclosure mt-enclosure-file" style="display: inline;"><a href="http://blogs.oracle.com/WebLogicServer/myconfig">myconfig</a></span></p>]]>
      
   </content>
</entry>

<entry>
   <title>Developing custom MBeans to manage J2EE Applications (Part I)</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/10/developing_custom_mbeans_to_ma.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.15083</id>
   
   <published>2009-10-18T19:20:11Z</published>
   <updated>2009-10-18T19:43:12Z</updated>
   
   <summary>This is the first part in a series of blogs, that demonstrate how to add management capability to your own application using JMX MBeans. In this first blog entry, we will learn: How to implement a custom MBean to manage...</summary>
   <author>
      <name>philippe Le Mouel</name>
      
   </author>
   
      <category term="Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="jmx" label="JMX" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>This is the first part in a series of blogs, that demonstrate how to add management capability to your own application using <a href="http://java.sun.com/javase/6/docs/technotes/guides/jmx">JMX MBeans</a>.</p>

<p> In this first blog entry, we will learn:

<ul>

<li>How to implement a custom MBean to manage configuration associated with an application.</lib>

<li>How to package the resulting code and configuration as part of the application's ear file.</li>

<li>How to register our MBean upon application startup, and unregistered them upon application stop (or undeployment).</li>

<li>How to use generic JMX clients such as <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html">JConsole</a> to browse and edit our application's MBean.</li>

</ul>

<p/>

<p>The complete code sample and associated build files are available as a <a href="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part1.zip">zip file</a>. The code has been tested against WebLogic Server 10.3.1 and JDK6.</p>

<h2>Implementing the MBean</h2>

<p>We chose to implement an MBean that can be used to manage properties associated with an application. To keep things interesting those properties will be persisted, and originally packaged with the deployed application's ear file.</p>

<p>Among the different types of MBeans, we choose to implement an <a href=http://java.sun.com/javase/6/docs/api/javax/management/MXBean.html">MXBean</a>. MXBeans have the main advantage to expose model specific types as Open Types. This means that clients interacting with MXBeans do not need to include any jar files containing application custom classes. For our simple example, this doesn't really come into play, but this also doesn't complicate our task either. So MXBean it is.</p>

<p>If you want to know more about MXBean, a tutorial is available <a href="http://java.sun.com/docs/books/tutorial/jmx/mbeans/mxbeans.html">here</a></p>

<h3><u>MBean interface</u></h3>

<p>The MBean interface declares the JMX management interface exposed by the MBean. Java methods translate to JMX attributes ( Java bean getter/setter pattern ) or to JMX operations ( the remaining methods ). More info on the mapping from Java methods to JMX attributes and operations is available in the <a href="http://java.sun.com/javase/6/docs/technotes/guides/jmx/JMX_1_4_specification.pdf">JMX specification</a> or in this <a href="http://docs.sun.com/app/docs/doc/816-7609/6mdjrf837?a=view">tutorial</a>. The same mapping rules apply to both Standard MBeans and MXBeans.</p>        

<code><pre>

package blog.wls.jmx.appmbean;

import java.util.Map;
import java.io.IOException;

public interface PropertyConfigMXBean {

    public String setProperty(String key, String value) throws IOException;\
    public String getProperty(String key);
    public Map<String, String> getProperties();
}

</pre></code>

<p>The above interface declares one attribute: <code><b>Properties</b></code>, and two operations: <code><b>setProperty</b></code> and <code><b>getProperty</b></code>. Those are the attribute and operations exposed by our MBean to JMX clients.</p>

<h3><u>MBean implemetation</u></h3>

<p>Our MBean implementation relies on the JDK's <a href="http://java.sun.com/javase/6/docs/api/java/util/Properties.html">Properties</a> class to manage and persist the underlying properties. The complete code for the MBean implementation is included below, and specific sections are discussed thereafter.</p>

<code><pre>

package blog.wls.jmx.appmbean;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.File;

import java.net.URL;

import java.util.Map;
import java.util.Properties;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.MBeanRegistration;

public class PropertyConfig implements PropertyConfigMXBean, MBeanRegistration {

    private String relativePath_ = null; 
    private Properties props_ = null;
    private File resource_ = null;

    public PropertyConfig(String relativePath) throws Exception {
        props_ = new Properties();
        relativePath_ = relativePath;
    }

    public String setProperty(String key,String value) throws IOException {
        String oldValue = null;

        if (value == null) {
            oldValue = String.class.cast(props_.remove(key));
        } else {
            oldValue = String.class.cast(props_.setProperty(key, value));      
        }

        save();
        return oldValue;
    }

    public String getProperty(String key) {
        return props_.getProperty(key);
    }

    public Map<String, String> getProperties() {
        return (Map) props_;
    }

    private void load() throws IOException {        
        InputStream is = new FileInputStream(resource_);

        try {
            props_.load(is);
        }
        finally {
            is.close();
        }
    } 

    private void save() throws IOException {  
        OutputStream os = new FileOutputStream(resource_);

        try {
            props_.store(os, null);
        }
        finally {
            os.close();
        }
    }

    public ObjectName preRegister(MBeanServer server, ObjectName name)
        throws Exception {
        // MBean must be registered from an application thread
        // to have access to the application ClassLoader
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL resourceUrl = cl.getResource(relativePath_);
        resource_ = new File(resourceUrl.toURI());
        load();     
        return name;
    }

    public void postRegister(Boolean registrationDone) { }
    public void preDeregister() throws Exception {}
    public void postDeregister() {}     
}
</pre></code>

<p>

Our MBean implements the <code>PropertyConfigMXBean</code> interface, as well as the <a href="http://java.sun.com/javase/6/docs/api/javax/management/MBeanRegistration.html"><code>MBeanRegistration</code></a> interface.
</p>

<p> We use the <code>MBeanRegistration.preRegister</code> method to load the persisted properties upon MBean registration. The original properties are included as part of the deployed ear, and accessed using the application's Context ClassLoader:  

</p>

<code><pre>
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL resourceUrl = cl.getResource(relativePath_);
        resource_ = new File(resourceUrl.toURI());
        load();     
</code></pre>

<p>

The interesting part in the above code is the use of the application's Context ClassLoader to extract the path under which the deployed ear's property file is located. For this to work we must ensure that the <code>preRegister</code> method is triggered by an application Thread, so that we can access the proper ClassLoader. More on this later.  
</p>

<p>The <code>load</code> and <code>save</code> methods are quite straight forward. The <code>load</code> method use the <a href="http://java.sun.com/javase/6/docs/api/java/util/Properties.html">Properties</a> class to read the properties from the application's property file into the MBean state. The <code>save</code> method use the <a href="http://java.sun.com/javase/6/docs/api/java/util/Properties.html">Properties</a> class to persist the properties from the MBean state back into the application's property file. 
</p>  

<p>Any new property added using the <code>setProperty</code> method is immediately persisted by calling the <code>save</code> method within the <code>setProperty</code> method. On a more complex project, one could expose <code>save</code> as a JMX operation, and build an associated Configuration Session MBean. This is beyond this blog's topic thought.</p>   

<h2>MBean life-cycle implementation</h2>

<p>To register our MBean upon application start, and unregister it upon application stop (or undeploy), we use WebLogic's <a href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/javadocs/weblogic/application/ApplicationLifecycleListener.html"><code>ApplicationLifecycleListener</code></a> class. Note: We could have used the J2EE <a href="http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContextListener.html">ServletContextListener</a> class in place, but we chose the <a href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/javadocs/weblogic/application/ApplicationLifecycleListener.html"><code>ApplicationLifecycleListener</code></a> as it also works for applications that do not include web modules. The complete code is included below:</p>

<code><pre>
package blog.wls.jmx.appmbean;

import weblogic.application.ApplicationLifecycleListener; 
import weblogic.application.ApplicationLifecycleEvent; 
import weblogic.application.ApplicationException; 

import javax.management.ObjectName; 
import javax.management.MBeanServer; 

import javax.naming.InitialContext; 

public class ApplicationMBeanLifeCycleListener extends ApplicationLifecycleListener {

    public void postStart(ApplicationLifecycleEvent evt) throws ApplicationException { 
        try { 
            InitialContext ctx = new InitialContext(); 
            MBeanServer mbs  = 
                MBeanServer.class.cast( ctx.lookup("java:comp/jmx/runtime") ); 
            PropertyConfig mbean = new PropertyConfig("config/properties.data");
            ObjectName oname = new ObjectName(
                "blog.wls.jmx.appmbean:type=PropertyConfig,name=myAppProperties"); 
            mbs.registerMBean(mbean, oname); 
        } 
        catch (Exception e) {
            // Deal with exception
            e.printStackTrace();
        } 
    } 

    public void preStop(ApplicationLifecycleEvent evt) throws ApplicationException { 
        try { 
            InitialContext ctx = new InitialContext(); 
            MBeanServer mbs  = 
                MBeanServer.class.cast( ctx.lookup("java:comp/jmx/runtime") ); 
            ObjectName oname = new ObjectName(
                "blog.wls.jmx.appmbean:type=PropertyConfig,name=myAppProperties");
            if ( mbs.isRegistered(oname) ) { 
                 mbs.unregisterMBean(oname); 
            }
        } 
        catch (Exception e) {
            // Deal with exception
            e.printStackTrace();
        } 
    }        
}
</code></pre>

<p>
In the above code we register our MBean in WebLogic's <a href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jmx/understandWLS.html#wp1127769">Runtime MBeanServer</a>: <code>ctx.lookup("java:comp/jmx/runtime")</code>. This MBeanServer is present on all WebLogic's processes, and can be used to register application's custom MBeans.     
</p>

<p>
We construct an instance of our MBean: <code>new PropertyConfig("config/properties.data")</code> passing the relative path to the application's property file. The path is relative to the root of the ear file, as we will see in the next section. Remember from the previous section we used the application Context ClassLoader to load the application property file using the relative path provided above: <code>cl.getResource(relativePath_);</code>. This is made possible by the <a href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/javadocs/weblogic/application/ApplicationLifecycleListener.html#postStart(weblogic.application.ApplicationLifecycleEvent)"><code>postStart</code></a> method that is executed by an application Thread.    
</p>

<p>We register our MBean under the <code>"blog.wls.jmx.appmbean:type=PropertyConfig,name=myAppProperties"</code> <a href="http://java.sun.com/javase/6/docs/api/javax/management/ObjectName.html">ObjectName</a>. We followed the <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/best-practices.jsp">JMX best practices</a> when picking that name. We recommend you do the same as this greatly helps:
<ul>
<li>
Avoid naming collisions.
</li>
<li>
Organize MBeans in MBean browsers. For instance JConsole's MBean tree.
</li>
<li>
Provide a consistent MBean naming structure when MBeans from many different sources are registered in a single MBeanServer. 
</li>
</ul></p> 

<p>Another point worth mentioning is the importance of unregistering the MBean when the application is stopped. If the MBean is left registered, the application ClassLoader(s) will be pinned and resource will be leaked.</p>

<h2>Packaging the ear file</h2>

<p>
Now we need to package our code and property file so that both can be loaded by the application Context ClassLoader.  
</p>

<p>The MBean and life cycle code is packaged in a jar as follow:</p>

<code><pre>
$ jar tvf sample-mbean-app-mbeans.jar
     0 Tue Oct 07 16:35:28 PDT 2009 META-INF/
   121 Tue Oct 07 16:35:26 PDT 2009 META-INF/MANIFEST.MF
     0 Tue Oct 07 16:35:26 PDT 2009 blog/
     0 Tue Oct 07 16:35:26 PDT 2009 blog/wls/
     0 Tue Oct 07 16:35:26 PDT 2009 blog/wls/jmx/
     0 Tue Oct 07 16:35:26 PDT 2009 blog/wls/jmx/appmbean/
  1337 Tue Oct 07 16:35:26 PDT 2009 
            blog/wls/jmx/appmbean/ApplicationMBeanLifeCycleListener.class
  2417 Tue Oct 07 16:35:26 PDT 2009 blog/wls/jmx/appmbean/PropertyConfig.class
   408 Tue Oct 07 16:35:26 PDT 2009 
           blog/wls/jmx/appmbean/PropertyConfigMXBean.class
$ 
</pre></code>

<p>The jar's manifest includes the following entry: <code>Class-Path: ../..</code>. This will ensure that the application's property file can be accessed from the application's ClassLoader. More on this later.</p>

<p>The ear file is packaged as follow:</p>

<code><pre>
$ jar tvf sample-mbean-app.ear
     0 Tue Oct 07 16:35:28 PDT 2009 META-INF/
   102 Tue Oct 07 16:35:26 PDT 2009 META-INF/MANIFEST.MF
   602 Tue Oct 0714:50:34 PDT 2009 META-INF/application.xml
   719 Tue Oct 07 16:35:26 PDT 2009 app.war
     0 Tue Oct 07 16:35:28 PDT 2009 APP-INF/
     0 Tue Oct 07 16:35:28 PDT 2009 APP-INF/lib/
  3328 Tue Oct 07 16:35:26 PDT 2009 APP-INF/lib/sample-mbean-app-mbeans.jar
     0 Tue Oct 07 16:35:28 PDT 2009 config/
   105 Tue Oct 07 30 12:46:28 PDT 2009 config/properties.data
   422 Tue Oct 07 13:10:52 PDT 2009 META-INF/weblogic-application.xml
$
</pre></code>

<p>The MBean jar file <code>sample-mbean-app-mbeans.jar</code> is added under the <code>APP-INF/lib</code> directory. Any jars located under that directory will be added to the application's ClassLoader. </p>

<p>The application's property file is added under <code>config/properties.data</code>, and can be accessed by the application's Context ClassLoader using that path. This works because we added the <code>Class-Path: ../..</code> entry in <code>sample-mbean-app-mbeans.jar</code>'s manifest, and we placed that jar under the <code>APP-INF/lib</code> directory. 
</p>

<p>
<code>META-INF/application.xml</code> declares a single war module <code>app.war</code>, that is empty, and whose only purpose is to make our application valid by including at least one J2EE module.  
</p>

<p>
<code>META-INF/weblogic-application.xml</code> declares our <a href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/javadocs/weblogic/application/ApplicationLifecycleListener.html"><code>ApplicationLifecycleListener</code></a>:   
</p>
<code><pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;weblogic-application xmlns="http://www.bea.com/ns/weblogic/90"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 
  http://www.bea.com/ns/weblogic/90/weblogic-application.xsd"&gt;
  &lt;listener&gt;
    &lt;listener-class&gt; 
        blog.wls.jmx.appmbean.ApplicationMBeanLifeCycleListener
    &lt;/listener-class&gt;
  &lt;/listener&gt;
&lt;/weblogic-application&gt;
</pre></code>

<h2>Download the code and build file</h2>

<p>The above code and associated build files are available as a <a href="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part1.zip">zip file</a>. Once you have downloaded the zip file, extract its content, and cd to the <code>app_mbean_part1</code> directory.</p>

<p>In order to build the code and create the application's ear file, you first need to define the <code>WL_HOME</code> environment property to point to your WebLogic binary install. Make sure <code>$WL_HOME/lib/weblogic.jar</code> is valid. Then just execute: 

</p>
<code>ant</code>

<p>If everything goes well the <code>sample-mbean-app.ear</code> file should now be located under the build directory.</p>

<h2>Deploying the ear</h2>

<p>The <code>sample-mbean-app.ear</code> file can be deployed as follow:</p>

<code>
java -classpath $WL_HOME/lib/weblogic.jar weblogic.Deployer -noexit -name sample-mbean-app -source build/sample-mbean-app.ear -targets jrfServer_admin -adminurl t3://140.87.10.42:7086 -user weblogic -password  gumby1234 -deploy
</code>

<p>
Make sure to substitute:
<ul>
<li>
Your WebLogic server host and port in place of <code>140.87.10.42:7086</code>. 
The port value for your WebLogic server is available from the &lt;WLS_INSTANCE_HOME&gt;/config/config.xml file: 

<code><pre>
 &lt;server&gt;
    &lt;name&gt;jrfServer_admin&lt;/name&gt;
    &lt;listen-port&gt;7086&lt;/listen-port&gt;
    &lt;listen-address&gt;140.87.10.42&lt;/listen-address&gt;
  &lt;/server&gt;
</code></pre>

Make sure you look under the correct server if several servers are defined as part of your config.xml. For instance in the above case we are connecting to the server identified as "jrfServer_admin ".</p>
</li>
<li>
Your WebLogic server name in place of <code>jrfServer_admin </code>
</li>
<li>
Your WebLogic server administrator's login and password in place of <code>weblogic</code> and <code>gumby1234</code>
</li>
</ul>
</p>

<p>The following command can be used to undeploy the <code>sample-mbean-app </code> application:</p>

<code>
java -classpath $WL_HOME/lib/weblogic.jar weblogic.Deployer -noexit -name sample-mbean-app -targets jrfServer_admin -adminurl t3://140.87.10.42:7086 -user weblogic -password  gumby1234 -undeploy
</code>

<h2>Using JConsole to browse and edit our application MBean</h2>

<p>Using JConsole to connect to WebLogic's MBeanServers was the subject of an <a href="http://blogs.oracle.com/WebLogicServer/2009/10/managing_weblogic_servers_with.html">earlier blog entry</a>. I recommand reading through <a href="http://blogs.oracle.com/WebLogicServer/2009/10/managing_weblogic_servers_with.html">that blog</a> if you want to know more. Here I will just fast forward to the command line used:</p>

<code>
jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:$WL_HOME/lib/wljmxclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -debug
</code>

<p>Once JConsole is started select the Remote process connection, and fill out the target MBeanServer URI, Username and Password fields:</p>

<code>service:jmx:iiop://140.87.10.42:7086/jndi/weblogic.management.mbeanservers.runtime</code>

<p>Make sure you replace the host and port values with the ones you used in your deployment command line. The <code>username</code> and <code>password</code> values are also the ones you used as part of your deployment command line.</p>

<p>You should now be connected and able to see our application MBean under the <code>blog.wls.jmx.appmbean</code> tree entry:</p>

<img alt="app_mbean_part1_jconsole1.JPG" src="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part1_jconsole1.JPG" width="613" height="454" class="mt-image-none" style="" />

<p>You can experience with creating new properties using the <code>setProperty</code> operation, and browsing them with either the  <code>getProperty</code> operation or <code>Properties</code> attribute. Notice that the <code>Properties</code> attribute is exposed to JMX clients as a <a href="http://java.sun.com/javase/6/docs/api/javax/management/openmbean/TabularData.html"><code>TabularData</code></a>:
</p>

<img alt="app_mbean_part1_jconsole2.JPG" src="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part1_jconsole2.JPG" width="610" height="451" class="mt-image-none" style="" />

<p>The conversion between the <code>Map</code> instance returned by our <code>public Map<String, String> getProperties()</code> method and the <a href="http://java.sun.com/javase/6/docs/api/javax/management/openmbean/TabularData.html"><code>TabularData</code></a> exposed to JMX clients is performed by the MXBean implementation that is part of the JDK. More info on MXBeans and how they convert native types to Open Types is available <a href="http://java.sun.com/javase/6/docs/api/javax/management/MXBean.html">here</a>. 
</p>
<p>
You might wonder where is the property file persisted. The answer is it depends on the deployment staging mode, and whether the application is deployed as an ear file or an exploded directory. In most cases the file will be located in a temporary directory under the target server. For instance:  
</p>

<code>servers/jrfServer_admin/tmp/_WL_user/sample-mbean-app/dgiyyk/config/properties.data</code>

<p>In this case, re-deploying the ear (provided the ear was modified) will overwrite the existing property file with the one contained in the ear file. Any new property added since the application was last deployed will be lost. It is also not possible to share the application's properties among several WebLogic servers, as each server gets its own local copy of the property file. 
</p>

<p>We can work around this by either:
<ul>
<li>Removing the property file from the ear file, and access it from a well known external location using regular file I/O.
</li>
<li>Deploying the application as an exploded ear accessible from all targeted WebLogic servers.
<p>
<code>java -classpath $WL_HOME/lib/weblogic.jar weblogic.Deployer -noexit -name sample-mbean-app -source build/exploded-ear -targets jrfServer_admin -adminurl t3://140.87.10.42:7086 -user weblogic -password  gumby1234 -deploy</code></p>

<p>Where the <code>exploded-ear</code> directory contains: <code>jar xvf sample-mbean-app.ear</code>.</p>

<p>In this case the property file will be modified under its original location: <code>build/exploded-ear/config/properties.data</code>.</p>
</li>
</ul>
</p>

<p>Note: If the property file is shared among several MBeans, then some form of synchronization will need to be provided across those MBeans when reading/writing the property file. We won't get into this in this blog.</p>

<p>
Aside from JConsole we can also use a Java client to browse and edit our MBean. This is demonstrated in an <a href="http://blogs.oracle.com/WebLogicServer/2009/09/sample_weblogic_jmx_client.html">earlier blog entry</a>. Another possibility is to use Oracle's Enterprise's Manager.</p>

</p>

<h2>What's next?</h2>

<p>
Even thought our MBean is functional, it cannot be considered production ready. It is lacking descriptions for the MBean itself, its attributes, operations and operation parameters. The operation parameters are also lacking meaningful names as demonstrated below:  
</p>

<img alt="app_mbean_part1_jconsole3.JPG" src="http://blogs.oracle.com/WebLogicServer/philippe.le.mouel/app_mbean_part1_jconsole3.JPG" width="587" height="435" class="mt-image-none" style="" />
<p>

Our goal next time around will be to fix the above issues. 
</p>
]]>
      
   </content>
</entry>

<entry>
   <title>Are My Servers Running?</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/10/are_my_servers_running.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14940</id>
   
   <published>2009-10-12T17:56:40Z</published>
   <updated>2009-10-14T21:22:00Z</updated>
   
   <summary>Sometimes, it is necessary to know whether one or more servers within a WebLogic Server domain are not running, and perform appropriate actions. For example, one may want to execute custom scripts if one or more servers within the domain...</summary>
   <author>
      <name>rajendra.inamdar</name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>Sometimes, it is necessary to know whether one or more servers within a WebLogic Server domain are not running, and perform appropriate actions. For example, one may want to execute custom scripts if one or more servers within the domain are not in the RUNNING state. The WebLogic Diagnostic Framework (WLDF), which is part of the WebLogic Server makes it easy to send notifications when such conditions are detected. When configured rules match runtime conditions, notifications associated with the rules are sent. WLDF can send notifications in various forms, such as emails, JMX notifications, JMS message, SNMP traps and also cause a Diagnostic Image to be created, which consists of important state of the entire server.</p>

<p>In this blog, I will describe how a watch-notification can be configured to send a JMX notification when one of the servers in the domain is not running. I will also show a simple JMX notification listener program which can process WLDF JMX notifications. In this case, it will simply print the contents of the notification. However, it can be easily adapted to do other things such as running a WLST script.</p>

<p>For simplicity, we will have only two servers in the domain, myserver (admin-server) and MS1 (managed-server). We will configure WLDF on the admin-server to send a JMX notification when the state of the managed-server MS1 (actually, any server within the domain) is not RUNNING.</p>

<p><big><strong>Configuring WLDF watch/notifications</strong></big></p>

<p>We will use WebLogic Server Administration Console to configure WLDF. It can also be done with WLST. Console provides a nice feature to <a href="http://blogs.oracle.com/WebLogicServer/2009/08/using_the_console_to_create_re.html">Create Repeatable Configuration Scripts</a>, which can be handy for building such scripts. Configuration steps for this case consist of:</p>

<ol>
  <li>Create a Diagnostic Module.</li>
  <li>Enable periodic metrics collection in the Diagnostic module.</li>
  <li>Create a JMX notification type.</li>
  <li>Create a watch to detect inactive servers</li>
  <li>Associate the created JMX notification with the configured watch</li>
  <li>Target the Diagnostic module to the admin server</li>
</ol>

<p>We will go over these steps and see how to configure WLDF using Console for this task. Log into Console and acquire Edit Lock so we can add new configuration to WebLogic Server.</p>

<p><strong>Create a Diagnostic Module. </strong></p>

<p>From the left navigation tree, open the Diagnostics node and click on Diagnostic Modules. Console will show a table of existing Diagnostic modules within the domain. Click the <strong>New </strong>button to create a new diagnostic module. Call it myWLDF. Click <strong>Save </strong>to create the module. At this point, we have an empty myWLDF diagnostic module. We will proceed to configure it.</p>

<p><strong>Enable periodic metrics collection in the Diagnostic module.</strong></p>

<p>Click on the myWLDF module link in the table of Diagnostics modules. Click on Collected Metrics sub-tab under Configuration tab. Check the <strong>Enabled </strong>checkbox and set the <strong>Sampling Period</strong> to 10000 (10 seconds). Click <strong>Save</strong>.</p>

<p><strong>Create a JMX notification type.</strong></p>

<p>Configuring a watch/notification has two aspects. The first aspect is a watch rule which specifies the condition that WLDF will check. The second aspect is the set of notifications that will be sent when the rule condition is met. Console provides configuration assistants to make the configuration task easier. To create a notification type:</p>

<ul>
  <li>Click Watches and Notifications sub-tab under Configuration tab.</li>
  <li>On the Notifications sub-tab, click <strong>New </strong>in the Notifications table.</li>
  <li>Select "JMX Notification" for the notification type from the dropdown and click <strong>Next</strong>. </li>
  <li>Give a name to the notification type (myJMX)</li>
  <li>check the <strong>Enable Notification</strong> checkbox and click <strong>OK </strong>to create the notification type.</li>
</ul>

<p><strong>Create a watch to detect inactive servers</strong></p>

<p>Now, we will create the watch rule. We will create a watch rule based on runtime mbean data. Specifically, we will use the <strong>State </strong>attribute on the <strong>ServerLifeCycleRuntimeMBean </strong>mbeans. For each server within the domain, there is a ServerLifeCycleRuntimeMBean mbean in the domain runtime mbean server. The State attribute reflects the current state of the server. We will configure a rule which will fire when at least one server in the domain is not in the RUNNING state.</p>

<ul>
  <li>Click on the Watches sub-tab. Click <strong>New </strong>in the Watches table. </li>
  <li>Set <strong>Watch Name</strong> to WatchServerStatus. Select <strong>Collected Metric</strong>s for Watch Type, check <strong>Enabled </strong>checkbox and click Next. </li>
</ul>

<p>Now we come to the interesting part, which is configuration of the watch rule expression itself. You can hand-edit the watch expression by clicking the Edit button and entering the watch expression yourself. However, that will require some familiarity with the watch <br />
expression syntax. For now, we will use the rule-expression builder.</p>

<ul>
  <li>Click on <strong>Add Expression</strong> button.</li>
  <li>Select DomainRuntime for the <strong>MBean Server Location</strong> and click Next.</li>
  <li>From the drop-down list for MBean Type, select weblogic.management.runtime.ServerLifeCycleRuntimeMBean and click Next.</li>
  <li>Leave the Instance list empty and click <strong>Next</strong>.</li>
  <li>Select State attribute from the list of available attributes.</li>
  <li>Select "<strong>!=</strong>" (Not Equals) as comparison operator.</li>
  <li>Set <strong>RUNNING </strong>as the value for the comparison and click <strong>Finish</strong>.</li>
  <li>Click <strong>Finish </strong>to complete the rule-expression.</li>
</ul>

<p>Note that the ServerLifeCycleRuntimeMBean is only registered in the Domain runtime mbean server. So, we selected DomainRuntime for the MBean Server Location. Also, since we want to receive notification for <strong>any </strong>server which is not running, we left the instance list empty and not restrict it to specific instances.</p>

<p>The rule-expression builder would create a rule expression:</p>

<p>(${DomainRuntime//[weblogic.management.runtime.ServerLifeCycleRuntimeMBean]//State} != 'RUNNING')</p>

<p><strong>Associate notification and configure alarm type</strong></p>

<ul>
  <li>Click on the WatchServerStatus watch from the Watches table.</li>
  <li>Click on the Notifications tab</li>
  <li>Choose the myJMX notification from the chooser and click Save</li>
  <li>Click on the Alarms tab and select "Don't use an alarm". Click Save.</li>
</ul>

<p>With this, we associated the created JMX notification with the watch. With "Don't use an alarm", we disabled the watch-alarms for now, which will cause a notification to be sent in every cycle when the rule evaluates to true. Later, you may want to use other options such as "Automatic Alarm Reset" so notifications will be suppressed for a configured interval to avoid a flood of notifications.</p>

<p><strong>Finishing the configuration</strong></p>

<p>Do not forget to target the created Diagnostic module to the admin-server (myserver). It will take effect only when the module is targeted to the server. Another thing to note is that, WLDF allows at most one module to be targeted to a server. So, if you have another diagnostic module targeted to the server, you will need to un-target it first. Ofcourse, in that case, you may add the above configuration to the pre-existing module instead of creating a new one.</p>

<p>Lastly, activate the changes so it will take effect.</p>

<p>Ok, so we have configured WLDF watch/notifications. What does it mean? Once above configuration is activated, WLDF will periodically evaluate configured watch rules The period is specified by the Sampling Period. If a watch rule evaluates to true, its associated notifications<br />
are sent. As per the configuration above, WLDF will periodically (every 10 seconds) check if the State attribute of any of the ServerLifeCycleRuntimeMBean mbeans is anything other than RUNNING. If so, it will send a JMX notification.</p>

<p><big><strong>Receiving Notifications</strong></big></p>

<p>WLDF sends a JMX notification on a specific WLDF runtime mbean, whose ObjectName is of the form:</p>

<p>com.bea:Name=DiagnosticsJMXNotificationSource,ServerRuntime=$SERVER,<br />
Type=WLDFWatchJMXNotificationRuntime,WLDFRuntime=WLDFRuntime,<br />
WLDFWatchNotificationRuntime=WatchNotification</p>

<p>where $SERVER is the name of the WebLogic Server instance. For our case (myserver), it is:</p>

<p>com.bea:Name=DiagnosticsJMXNotificationSource,ServerRuntime=myserver,<br />
Type=WLDFWatchJMXNotificationRuntime,WLDFRuntime=WLDFRuntime,<br />
WLDFWatchNotificationRuntime=WatchNotification</p>

<p>By registering for JMX notifications on this mbean, a client program can listen to generated notifications.</p>

<p><span class="mt-enclosure mt-enclosure-file" style="display: inline;"><a href="http://blogs.oracle.com/WebLogicServer/2009/10/12/JMXWatchNotificationListener/JMXWatchNotificationListener.java">JMXWatchNotificationListener.java</a></span> is a simple notification listener for WLDF JMX notifications. It simply prints the contents of received notification, but can be easily adapted to perform other actions.</p>

<p>Run the program and kill the managed server MS1. The client program displays notifications as shown below, when the managed server MS1 exits the RUNNING state.</p>

<p>$ java  JMXWatchNotificationListener -server myserver -host localhost -port 7001 -user weblogic -password welcome1</p>

<p>URL=service:jmx:t3://localhost:7001/jndi/weblogic.management.mbeanservers.runtime<br />
Adding notification handler for: com.bea:Name=DiagnosticsJMXNotificationSource,ServerRuntime=myserver,<br />
Type=WLDFWatchJMXNotificationRuntime,WLDFRuntime=WLDFRuntime,<br />
WLDFWatchNotificationRuntime=WatchNotification<br />
===============================================<br />
Notification name:    myjmx called. Count= 1.<br />
Watch severity:         Notice<br />
Watch time:             Oct 12, 2009 4:45:48 PM EDT<br />
Watch ServerName:       myserver<br />
Watch RuleType:         Harvester<br />
Watch Rule:             (${DomainRuntime//[weblogic.management.runtime.ServerLifeCycleRuntimeMBean]//State} != 'RUNNING'<br />
)<br />
Watch Name:             WatchServerStatus<br />
Watch DomainName:       mydomain<br />
Watch AlarmType:        None<br />
Watch AlarmResetPeriod: 60000<br />
Watch Message: WatchName: WatchServerStatus WatchSeverityLevel: Notice<br />
Watch Data: com.bea:Name=MS1,Type=ServerLifeCycleRuntime//State = SHUTDOWN com.bea:Name=myserver,Type=ServerLifeCycleRun<br />
time//State = RUNNING<br />
===============================================</p>

<p>As mentioned above, other forms of notifications can be configured as well. For example, the article "<a href="http://www.oracle.com/technology/pub/articles/cico-wldf.html">Monitoring Performance Using the WebLogic Diagnostics Framework</a>" shows how to configure SNMP traps with the watch rules.</p>

<p><br />
</p>]]>
      
   </content>
</entry>

<entry>
   <title>Managing WebLogic servers with JConsole</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/10/managing_weblogic_servers_with.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14766</id>
   
   <published>2009-10-06T05:00:02Z</published>
   <updated>2009-10-06T04:04:29Z</updated>
   
   <summary>In my previous blog I described how to implement a custom WebLogic JMX client. Another way to interact with WebLogic&apos;s MBeans, is to use a generic JMX client such as JConsole. JConsole is shipped as part of the JDK, and...</summary>
   <author>
      <name>philippe Le Mouel</name>
      
   </author>
   
      <category term="Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="jmx" label="JMX" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>In my <a href="http://blogs.oracle.com/WebLogicServer/2009/09/sample_weblogic_jmx_client.html">previous blog</a> I described how to implement a custom WebLogic JMX client. Another way to interact with WebLogic's MBeans, is to use a generic JMX client such as <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html">JConsole</a>. JConsole is shipped as part of the JDK, and doesn't require any specific download or installation. This blog demonstrates how simple it is to browse WebLogic MBeans using JConsole. </p>
 
<p>
In order to connect to a WebLogic MBeanServer, JConsole needs to be started as follow:
</p>  
 
<code>
jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:
$WL_HOME/server/lib/wljmxclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -debug
</code>
 
<p>WL_HOME points to the WebLogic binary install.</p>
<p>The above uses WebLogic's thin client classes. In some cases when you access server side classes, or you want to take full advantage of the t3 protocol, you are required to use WebLogic's thick client classes. To do so, you first need to build <code>wlfullclient.jar</code> as follow:</p>
 
<code>
cd $WL_HOME/server/lib
<br>
java -jar wljarbuilder.jar
</code>
 
<p>You can then start JConsole as follow:</p>
 
<code>
jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:
$WL_HOME/server/lib/wlfulclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -debug
</code>
 
<p><code>wlfulclient.jar</code> is not dependent on external jars, and can be copied to client machines. When using the thin client ( <code>wljmxclient.jar</code> ) you cannot just copy <code>wljmxclient.jar</code> to a client's machine as this jar references other jars as part of its manifest Class-Path entry. At the time of this writing, you also need to copy <code>wlclient.jar</code></p>
 
<p><code>-J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote</code> identifies the package implementing WebLogic's client side connectors code. For instance the 't3' or 'iiop' client connectors. </p>
 
<p>Finally the <code>-debug</code> flag is extremely handy when a connection failure occurs. In this case the corresponding stack trace is dumped on the console.</p> 
 
<p>
Once JConsole is started select the <code>Remote process</code> connection, and fill out the target WebLogic's MBeanServer JMX URI, <code>Username</code>  and <code>Password</code> fields. See figure below:
</p>
 
<img src="http://blogs.oracle.com/WebLogicServer/jconsole/jconsole2.jpg" alt="JConsole not yet connected to WebLogic's Runtime MBeanServer" />
 
<p>The JMX service URI:</p>
<p><code>service:jmx:iiop://140.87.10.42:12565/jndi/weblogic.management.mbeanservers.runtime</code></p> 
<p>identifies the following:</p>
<ul>
    <li>The protocol used to communicate with the remote WebLogic process. "iiop" in the above example. WebLogic supports "t3", "iiop" and "rmi". We won't touch further on this topic here. </li>
    <li><p>The WebLogic process to connect to (host & port ). <code>140.87.10.42:12565</code> in the above example.</p> 
<p>The port value is available from the &lt;WLS_INSTANCE_HOME&gt;/config/config.xml file: 
<code><pre>
 &lt;server&gt;
    &lt;name&gt;myServer&lt;/name&gt;
    &lt;listen-port&gt;12565&lt;/listen-port&gt;
    &lt;listen-address&gt;140.87.10.42&lt;/listen-address&gt;
  &lt;/server&gt;
</code></pre>
Make sure you look under the correct server if several servers are defined as part of your config.xml. For instance in the above case we are connecting to the server identified as "myServer".</p>
</li>
    <li>The MBeanServer to connect to: <code>weblogic.management.mbeanservers.runtime</code>. This identifies WebLogic's "Runtime" MBeanServer. This is the MBeanServer available from any WebLogic process, and that contains both WebLogic and user MBeans. WebLogic also offers two other MBeanServers that are only available from the Domain "AdminServer" process:
<ul>
    <li><p>The "Domain Runtime" MBeanServer. It aggregates the MBeans registered on the domain's "Runtime" MBeanServers. So as long as a managed server is up, its MBeans can be accessed through the "Domain Runtime" MBeanServer. To connect to that MBeanServer, just use the following JMX URI:</p>
<code>
service:jmx:iiop://140.87.10.42:7002/jndi/weblogic.management.mbeanservers.domainruntime
</code>
<p>"7002" is the iiop port for my "AdminServer" install. Replace with your AdminServer's port as previously explained. Remember; only the AdminServer process runs the "Domain Runtime" MBeanServer. 
</p>
</li>
<li><p>The "Edit" MBeanServer. It contains the WebLogic Config MBeans that are used to configure the Domain. To connect to that MBeanServer, just use the following JMX URI:</p>
<code>
service:jmx:iiop://140.87.10.42:12565:7002/jndi/weblogic.management.mbeanservers.edit 
</code>
<p>"7002" is the iiop port for my "AdminServer" install. Replace with your AdminServer's port as previously explained. Remember; only the AdminServer process runs the "Domain Runtime" MBeanServer.  
</p>
</li>
</ul>
 
<p>Note: One can also use "t3" or "rmi" as protocol in place of "iiop"</p>
</li>
</ul>
 
<p>Finally provide the login and password values for the user associated with the connection. The WebLogic admin user is often used, but other users can be used as well. Depending on the authenticated user and his/her associated roles, operations on MBeans will be granted or denied. We won't dive further in this topic here. Click connect and voila!</p>
 
<img src="http://blogs.oracle.com/WebLogicServer/jconsole/jconsole1.jpg" alt="JConsole connected to WebLogic's Runtime MBeanServer" />
 
<p>
If JConsole fails to connect, look at the stack trace dumped on the console.  Make sure you specified the <code>-debug</code> flag when starting JConsole, or you will not see any meaningful information on the console. Common cause of connection failures include: wrong host/port; wrong login/password; <code>jmx.remote.protocol.provider.pkgs</code> not properly specified and incorrect ClassPath. Also note that the above instructions apply to WebLogic server 10.3.1 and above.    
</p>
 
<p>
JConsole's MBean tree preserves the key order used when building MBeans ObjectNames. The only exception is for the 'type' property which will be included first if present and the 'j2eeType' property which will be included second if present. In general I also use the 'name' property to identify different MBean instances while WebLogic MBeans use 'Type' and 'Name' properties for the same purpose. To ensure that JConsole's MBean tree is build with 'type' or 'Type' as first node and 'name' or 'Name' as its child I use the following command line:  
</p>
<p> 
<code>
jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:
$WL_HOME/server/lib/wljmxclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -J-Dcom.sun.tools.jconsole.mbeans.keyPropertyList=type,Type,j2eeType,name,Name -debug
</code>
</p>
<p>
When connecting to WebLogic's "Domain Runtime" MBeanServer, one can also order by MBean 'Location' as follow:  
</p>
<p> 
<code>
jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:
$WL_HOME/server/lib/wljmxclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -J-Dcom.sun.tools.jconsole.mbeans.keyPropertyList=Location,type,Type,j2eeType,name,Name -debug
</code>
</p>
 
<p>
Aside from browsing and editing MBeans, <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html">JConsole</a> can be used to monitor WebLogic processes resource usage: Memory, Threads, Class loading. Consult JConsole's <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html">documentation</a> for more information.  
</p>
 
 
]]>
      
   </content>
</entry>

<entry>
   <title>Using FastSwap to speed up development</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/10/using_fastswap_to_speed_up_dev.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14734</id>
   
   <published>2009-10-03T19:55:22Z</published>
   <updated>2009-10-03T20:23:32Z</updated>
   
   <summary>A fast turnaround time is something that most developers appreciate and since JDK 5 it is possible to redefine a class without dropping the class loader. However, the support provided by the JDK is limited and does not allow the...</summary>
   <author>
      <name>jonas.borjesson@oracle.com</name>
      
   </author>
   
   <category term="fastswapfastswapdevelopmentspeedupredeploymentclassloaderbouncing" label="fastswap fast swap development speed up redeployment classloader bouncing" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>A fast turnaround time is something that most developers appreciate and since JDK 5 it is possible to redefine a class without dropping the class loader. However, the support provided by the JDK is limited and does not allow the developer to reshape the class, i.e., fields and methods cannot be changed/altered. FastSwap is a feature within WLS that, when enabled, is designed to overcome these limitations. For example, it will allow the developer to add new methods to an already loaded class and see those changes take effect immediately. </p>

<p><big><strong>Enabling FastSwap</strong></big></p>

<p>In order to take advantage of FastSwap, WLS must be running in development mode and FastSwap must have been turned on for that particular deployment. For applications deployed as an EAR, adding the <fast-swap> element to the weblogic-application.xml file enables FastSwap and for applications deployed as a WAR, the element should be inserted into the weblogic.xml file instead.</p>

<pre>
  &lt;fast-swap&gt;
    &lt;enabled&gt;true&lt;/enabled&gt;
  &lt;/fast-swap&gt;
</pre>

<p>FastSwap will only monitor changes of classes in exploded directories so if an exploded EAR contains an archived WAR, any changes to that WAR will not be detected. Therefore, the WAR also needs to be unpacked and then FastSwap will monitor all the classes found under the web application's WEB-INF/classes directory. Note that any jars residing in WEB-INF/lib will not be monitored.<br />
 <br />
<strong><big>Developing with FastSwap</big></strong></p>

<p>Once FastSwap has been enabled for a particular deployment, it will pick up any change made to a monitored class at runtime, allowing the change to take place immediately. </p>

<p>Using a web application as an example, the typical development flow would be:<ul><br />
	<li>Deploy the exploded web application</li><br />
	<li>Access the application through a web browser</li><br />
	<li>Modify the code, compile the changes and have the corresponding class files saved to the correct location under the exploded application.</li><br />
	<li>Access the application through a web browser once again, and your changes will now have been applied and should be visible.</li><br />
</ul></p>

<p>Note that FastSwap will not redefine any classes as soon as they have changed on the file system. The reason is because a change to one class file can affect other classes (e.g. when a method signature is changed) so all classes must be redefined at the same time. Therefore, the developer will need to tell FastSwap when it should start its operation. For web applications, this is accomplished by going through a servlet but for other applications the developer has to use the JMX interface for FastSwap. However, there is an Ant task accessing this JMX interface that can used to trigger FastSwap, as shown in the below example.</p>

<pre>
&lt;project name='MyProject' default='all'&gt;
  &lt;taskdef name='fast-swap' classname='com.bea.wls.redef.ant.FastSwapTask'/&gt;
  &lt;target name='all'&gt;
    &lt;fast-swap
      adminUrl='t3://localhost:7001'
      user='weblogic'
      password='weblogic'
      server='myserver'
      application='SimpleApp'
    /&gt;
  &lt;/target&gt;
&lt;/project&gt;
</pre>

<p>Where the parameters are:<ul><br />
                <li>adminUrl: connection url</li><br />
	<li>user: user name</li><br />
	<li>password: user password</li><br />
	<li>server: managed server name</li><br />
	<li>application: deployed application name</li><br />
</ul></p>

<p><big><strong>Limitations & Further Reading</strong></big></p>

<p>Even though FastSwap is an improvement over the default support found in the JDK there are still some limitations to what it can accomplish. For a list of these limitations as well as more information regarding FastSwap, please visit the following link: </p>

<p><a href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/deployment/deployunits.html#wp1053872">http://download.oracle.com/docs/cd/E12840_01/wls/docs103/deployment/deployunits.html#wp1053872</a></p>]]>
      
   </content>
</entry>

<entry>
   <title>Sample WebLogic JMX Client</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/09/sample_weblogic_jmx_client.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14532</id>
   
   <published>2009-09-22T18:33:33Z</published>
   <updated>2009-09-24T21:18:54Z</updated>
   
   <summary>Our goal is to implement a simple WebLogic JMX client that can be used as a starting point to write any WebLogic JMX client. We will look at the client&apos;s code. The classpath used to compile and run the code....</summary>
   <author>
      <name>philippe Le Mouel</name>
      
   </author>
   
      <category term="Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="jmx" label="JMX" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>Our goal is to implement a simple WebLogic JMX client that can be used as a starting point to write any WebLogic JMX client. We will look at the client's code. The classpath used to compile and run the code. The different WebLogic MBeanServers and associated JMX URI's the JMX Client can connect to. </p>

<p>Let's directly dive in the client's code below:</p>

<code><pre>package blog.wls.jmx.client;

import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXServiceURL;
import javax.management.remote.JMXConnectorFactory;
import java.util.Hashtable;
import java.util.Set;

public class JMXClient {

public static void main(String[] args) throws Exception {

        JMXConnector jmxCon = null;
 
        try {
            JMXServiceURL serviceUrl = 
                new JMXServiceURL(
         "service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.runtime");

            System.out.println("Connecting to: " + serviceUrl);
 
            Hashtable env = new Hashtable();
            env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, 
                         "weblogic.management.remote");
            env.put(javax.naming.Context.SECURITY_PRINCIPAL, "weblogic");
            env.put(javax.naming.Context.SECURITY_CREDENTIALS, "welcome1");

            jmxCon = JMXConnectorFactory.newJMXConnector(serviceUrl, env);
            jmxCon.connect();
            MBeanServerConnection con = jmxCon.getMBeanServerConnection();
 
            Set&lt;ObjectName&gt; mbeans = con.queryNames(null, null);
            for (ObjectName mbeanName : mbeans) {
                System.out.println(mbeanName);
            }
        }
        finally {
            if (jmxCon != null)
                jmxCon.close();
        }
    }
}</pre></code>

<p>Let's take a quick look at the above code.</p>

 <code><pre>JMXServiceURL serviceUrl = 
                new JMXServiceURL(
      "service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.runtime");
</pre></code>

<p>The JMX service URI identifies the following:
<ul>
    <li>The protocol used to communicate with the remote WebLogic process. "iiop" in the above example. WebLogic supports "t3", "iiop" and "rmi". We won't touch further on this topic here. </li>
    <li><p>The WebLogic process to connect to (host & port ). "127.0.0.1:7001" in the above example.</p> <p>The port value is available from the &lt;WLS_INSTANCE_HOME&gt;/config/config.xml file: 
<code><pre>
 &lt;server&gt;
    &lt;name&gt;myServer&lt;/name&gt;
    &lt;listen-port&gt;7001&lt;/listen-port&gt;
    &lt;listen-address&gt;myhost&lt;/listen-address&gt;
  &lt;/server&gt;
</code></pre>
Make sure you look under the correct server if several servers are defined as part of your config.xml. For instance in the above case we are connecting to the server identified as "myServer".</p>
<p>The same information is also available from the server log at &lt;WLS_INSTANCE_HOME&gt;/servers/myServer/logs/myServer.log:
<code><pre>
&lt;Sep 22, 2009 12:05:23 PM PDT&gt; &lt;Notice&gt; &lt;Server&gt; &lt;localhost&gt;&lt;myServer&gt;
&lt;[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'&gt; 
&lt;&lt;WLS Kernel&gt;&gt; &lt;&gt; &lt;&gt; &lt;1253585123268&gt; &lt;BEA-002613&gt; &lt;Channel "Default" is now
listening on myhost:7001 for protocols iiop, t3, ldap, snmp, http.&gt; 
</code></pre>
 </li>
    <li>The MBeanServer to connect to: " weblogic.management.mbeanservers.runtime". This identifies WebLogic's "Runtime" MBeanServer. This is the MBeanServer available from any WebLogic process, and that contains both WebLogic and user MBeans.</li>
</ul>

<code><pre>
            Hashtable env = new Hashtable();
            env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
                    "weblogic.management.remote");
            env.put(javax.naming.Context.SECURITY_PRINCIPAL, "weblogic");
            env.put(javax.naming.Context.SECURITY_CREDENTIALS, "welcome1");
</pre></code>

<p>The above code specifies properties associated with the connection. "weblogic.management.remote" identifies the package implementing WebLogic's client side connector code. For instance the 't3' or 'iiop' client connector. </p>
<p>
"weblogic" and "welcome1" are the login/password associated with the user originating the JMX connection.   
</p>
<p>
In the rest of the code we establish the JMX connection, and then retrieve the ObjectNames for all the MBeans registered in the "Runtime" MBeanServer. The ObjectNames are then displayed on the console. We also make sure we release the connection in a finally block to avoid leaking any resource. 
</p>

<p>The code doesn't contain any WebLogic specific classes, and can be compiled as follow:</p>

<code><pre>
javac -d . blog/wls/jmx/client/JMXClient.java
</pre></code>

 <p>Executing the code requires to add WebLogic client side classes to the execution ClassPath. We need to include the WebLogic JMX connector client side classes. Remember we specified those in the environment properties passed to the JMXConnectorFactory. Below is the command I used:</p>

<code><pre>
java -classpath .:$WL_HOME/server/lib/wljmxclient.jar blog/wls/jmx/client/JMXClient
</pre></code>

<p>WL_HOME points to the WebLogic binary install.</p>
<p>The above uses WebLogic's thin client classes. In some cases when you access server side classes, or you want to take full advantage of the t3 protocol, you are required to use WebLogic's thick client classes. To do so, you first need to build wlfullclient.jar as follow:</p>

<code><pre>
cd $WL_HOME/server/lib
java -jar wljarbuilder.jar
</pre></code>

<p>You can then execute the JMX Client as follow:</p>

<code><pre>
java -classpath .:$WL_HOME/server/lib/wlfullclient.jar  blog/wls/jmx/client/JMXClient
</pre></code>

<p>You can also bundle wlfulclient.jar with your client code. When using the thin client you cannot just bundle wljmxclient.jar with you client code, as this jar references other jars as part of its manifest Class-Path entry. At the time of this writing, you also need to bundle wlclient.jar</p>

<p>At this point we are now able to connect to WebLogic's "Runtime" MBeanServer. Each WebLogic process contains a "Runtime" MBeanServer in which local WebLogic MBeans and user-defined application MBeans are registered. WebLogic also offers two other MBeanServers that are only available from the Domain "AdminServer" process:
<ul>
    <li><p>The "Domain Runtime" MBeanServer. It aggregates the MBeans registered on the domain's "Runtime" MBeanServers. So as long as a managed server is up, its MBeans can be accessed through the "Domain Runtime" MBeanServer. To connect to that MBeanServer, just use the following JMX URI:</p>
<code><pre>
service:jmx:iiop://127.0.0.1:7002/jndi/
weblogic.management.mbeanservers.domainruntime
</pre></code>
<p>"7002" is the iiop port for my "AdminServer" install. Replace with your AdminServer's port as previously explained. Remember; only the AdminServer process runs the "Domain Runtime" MBeanServer. 
</p>
</li>
<li><p>The "Edit" MBeanServer. It contains the WebLogic Config MBeans that are used to configure the Domain. To connect to that MBeanServer, just use the following JMX URI:</p>
<code><pre>
service:jmx:iiop://127.0.0.1:7002/jndi/weblogic.management.mbeanservers.edit 
</pre></code>
<p>"7002" is the iiop port for my "AdminServer" install. Replace with your AdminServer's port as previously explained. Remember; only the AdminServer process runs the "Domain Runtime" MBeanServer.  
</p>
</li>
</ul>

<p>Note: One can also use "t3" or "rmi" as protocol in place of "iiop"</p>

<p>The rest of the client's code remains unchanged. Only the JMX URI needs to be changed to connect to different MBeanServers.</p>
]]>
      
   </content>
</entry>

<entry>
   <title>Migrating OC4J 10.1.3 Stateful Web Services to WebLogic</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/09/migrating_oc4j_1013_stateful_w.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14405</id>
   
   <published>2009-09-14T20:36:13Z</published>
   <updated>2009-09-15T18:42:53Z</updated>
   
   <summary>Consider migrating an OC4J 10.1.3 web service to WebLogic. If the migration preserves the service WSDL description, the original client for that OC4J 10.1.3 web service will work with the migrated service. However, if the service is stateful, the original...</summary>
   <author>
      <name>quan.wang@oracle.com</name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[Consider migrating an OC4J 10.1.3 web service to WebLogic. If the migration preserves the service WSDL description, the original client for that OC4J 10.1.3 web service will work with the migrated service. However, if the service is stateful, the original client will no longer work. OC4J 10.1.3 stateful web service uses HTTP session to track the web service session. WebLogic, on the other hand, does not support such http session-based stateful web service. One way to allow the original client to work with the migrated service is to modify the migrated service implementation to map http session into the web service session. Below is a modified service implementation.<br /><code><br />package cyclecounter.test.oracle; <br />import java.net.URI; <br />import java.util.HashMap;<br />import java.util.Hashtable; <br />import java.util.Map; <br />import java.util.Vector; <br />import javax.jws.WebService; <br />import javax.xml.rpc.server.ServiceLifecycle; <br />import javax.xml.rpc.server.ServletEndpointContext; <br />import weblogic.jws.WLHttpTransport;<br /><br />@WebService(serviceName = "testsfWS-serssion", portName = "HttpSoap11", endpointInterface = "cyclecounter.test.oracle.CycleCounterInterface") @WLHttpTransport(serviceUri = "/HttpSoap11", portName = "HttpSoap11")<br />public class CycleCounterInterfaceImpl implements ServiceLifecycle {<br />&nbsp; private ServletEndpointContext context; <br />&nbsp; public void init(Object context){<br />&nbsp;&nbsp;&nbsp; this.context = ((ServletEndpointContext)context);<br />&nbsp; }<br />&nbsp; public void destroy() {<br />&nbsp; }<br /><br />&nbsp; public int getCurrentCounter() { <br />&nbsp;&nbsp;&nbsp; CycleCounterImpl impl = SessionManager.getImpl(context);<br />&nbsp;&nbsp;&nbsp; return impl.getCurrentCounter();<br />&nbsp; }<br />}<br /><br />

The </code><code>CycleCounterInterfaceImpl class </code>serves as a wrapper around the actual service implementation. The SessionManager class maps JSESSIONID cookie to its corresponding service implementation instance.<br /><br />
<code>
</code><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"><span class="code-keyword">package cyclecounter.test.oracle;<br />import java.util.HashMap;<br />import javax.servlet.http.HttpSession;<br />import javax.xml.rpc.handler.MessageContext;<br />import javax.xml.rpc.server.ServletEndpointContext;<br />import weblogic.wsee.connection.transport.servlet.HttpTransportUtils;<br /><br />public class SessionManager {<br />  // timeout in 15 seconds<br />  private final static long timeout = 15 * 1000l;<br />  private final static HashMap&lt;HttpSession, Long&gt; timeoutMap = new HashMap&lt;HttpSession, Long&gt;();<br />  private final static HashMap&lt;HttpSession, CycleCounterImpl&gt; implMap = new HashMap&lt;HttpSession, CycleCounterImpl&gt;();<br />  public static synchronized CycleCounterImpl getImpl(ServletEndpointContext context) {<br /></span><span class="code-keyword">    MessageContext mc = context.getMessageContext();<br />    HttpSession session = HttpTransportUtils.getHttpServletRequest(mc).getSession(true);<br /></span><span class="code-keyword">    CycleCounterImpl impl=</span><span class="code-keyword">implMap.get(session)</span><span class="code-keyword">;<br /></span><span class="code-keyword">    if (</span><span class="code-keyword">impl</span><span class="code-keyword">!=null) {<br />      long time = timeoutMap.get(session);<br />      if (System.currentTimeMillis()&gt;time+timeout) {<br />        // session timed out<br />        implMap.remove(session);<br />      }<br />    }<br />    if (impl==null) {<br />      // new session<br />      impl = new CycleCounterImpl();<br />      implMap.put(session, impl);<br />      timeoutMap.put(session, System.currentTimeMillis());<br />    }<br />    return impl;<br />  }<br />}</span></pre>
</div></div>

<h6><a href="editor-content.html?cs=utf-8" name="sesmigrationissues-samplerequests"></a></h6><code></code>The SessionManager class could be enhanced for better session management, particularly configuring timeout, and pooling service implementation instances.<br />]]>
      
   </content>
</entry>

<entry>
   <title>Application Client Upgrades from OC4J to WLS</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/09/application_client_upgrades_fr.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14324</id>
   
   <published>2009-09-10T20:43:14Z</published>
   <updated>2009-09-10T20:52:36Z</updated>
   
   <summary><![CDATA[Summary Upgrading an OC4J Java EE application in order to deploy to Weblogic server may require one of several upgrade paths, depending upon the component being upgraded.&nbsp; Remote clients that rely on the Application Client Container will require deployment changes...]]></summary>
   <author>
      <name>bob.nettleton</name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<h2 style="MARGIN: 12pt 0in 3pt"><strong><em><font size="5"><font color="#000000">Summary<o:p></o:p></font></font></em></strong></h2>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Upgrading an OC4J Java EE application in order to deploy to Weblogic server may require one of several upgrade paths, depending upon the component being upgraded.<span style="mso-spacerun: yes">&nbsp; </span>Remote clients that rely on the Application Client Container will require deployment changes in order to access resources on Weblogic Server.<span style="mso-spacerun: yes">&nbsp; </span>One use case for remote clients will require some extra steps in order to upgrade successfully.<span style="mso-spacerun: yes">&nbsp; </span>That case is the subject of this blog posting.<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">OC4J's JNDI implementation allows a standalone client to take advantage of some features of the application client in Java EE without running in a Java EE Application Client Container.<span style="mso-spacerun: yes">&nbsp; </span>A client can use the <o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font face="Times New Roman" color="#000000">"</font><code><span style="FONT-FAMILY: 'Courier New'"><font color="#336699">oracle.j2ee.naming.ApplicationClientInitialContextFactory</font></span></code><code><span lang="EN" style="FONT-FAMILY: 'Courier New'; mso-ansi-language: EN"><font color="#336699">"<o:p></o:p></font></span></code></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">InitialContextFactory implementation in order to access this functionality.<span style="mso-spacerun: yes">&nbsp; </span>As long as the client includes a "META-INF/application-client.xml" deployment descriptor in the client jar, this initial context factory will create a JNDI context that can support Java EE resources that are typically used in an application client (EJB references, Resource References, Environment entries, etc).<span style="mso-spacerun: yes">&nbsp; </span>This context factory will use the application-client.xml and the proprietary orion-application-client.xml in order to map JNDI bindings to logical Java EE reference names.<span style="mso-spacerun: yes">&nbsp; </span>This level of application client support does not include Java EE 1.5-style annotations/dependency injection.<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Please refer to the following for more information on OC4J's Application Client support:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><a href="http://download.oracle.com/docs/cd/E14101_01/doc.1013/e13975/jndi.htm#CIHJCGID"><font face="Times New Roman" size="3">Looking Up Objects from J2EE Application Clients</font></a><o:p></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">While not required by the Java EE specification, this type of remote client can be very useful when a customer wishes to use the Java EE standard resource mapping types in order to use logical names for resources such as EJBs, Datasources, and JMS destinations.<span style="mso-spacerun: yes">&nbsp; </span>Using an application client deployment descriptor has the advantage of allowing resources to change without having to change the client code itself, and can be considered useful even if not running in the Application Client Container.<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Customers using this feature of the ApplicationClientInitialContextFactory in OC4J will need to port their application client to run in the Weblogic Server Application Client Container.<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></font></font></p>
<h2 style="MARGIN: 12pt 0in 3pt"><span style="FONT-WEIGHT: normal; FONT-SIZE: 12pt; FONT-STYLE: normal; FONT-FAMILY: 'Times New Roman'"><font color="#000000">&nbsp;<o:p></o:p></font></span></h2>
<h2 style="MARGIN: 12pt 0in 3pt"><strong><em><font size="5"><font color="#000000">Upgrade Steps<o:p></o:p></font></font></em></strong></h2>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">The steps required to upgrade an OC4J application client to run in the Weblogic Application Client Container are as follows:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<ol style="MARGIN-TOP: 0in" type="1">
<li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><font size="3"><font color="#000000"><font face="Times New Roman">Add a "Main-Class" entry to the client jar's manifest.<span style="mso-spacerun: yes">&nbsp; </span>This entry should specify the entry point class for the application client.<span style="mso-spacerun: yes">&nbsp; </span>This class, according to the Java EE standard, must include a "public static void main(String[] args)" method, and also include a no-arguments constructor.<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></font></font></li></ol>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">An example of the proper manifest entry would look as follows:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span><span style="FONT-FAMILY: 'Courier New'">Manifest-Version: 1.0<o:p></o:p></span></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><span style="FONT-FAMILY: 'Courier New'"><font size="3"><font color="#000000"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </span>Ant-Version: Apache Ant 1.6.5<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><span style="FONT-FAMILY: 'Courier New'"><font size="3"><font color="#000000"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </span>Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><span style="FONT-FAMILY: 'Courier New'"><font size="3"><font color="#000000"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </span><b>Main-Class: oracle.ejb30.HelloWorldClient<o:p></o:p></b></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><b><span style="FONT-FAMILY: 'Courier New'"><font size="3"><font color="#000000">&nbsp;<o:p></o:p></font></font></span></b></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: 'Courier New'"><font size="3"><font color="#000000"><span style="mso-spacerun: yes">&nbsp; </span><span style="mso-tab-count: 1">&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;</span><o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<ol style="MARGIN-TOP: 0in" type="1" start="2">
<li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><font size="3"><font color="#000000"><font face="Times New Roman">Modify the jndi.properties file in this client (or the source code that sets the JNDI properties directly) to refer to the Oracle WebLogic Server JNDI Provider. <o:p></o:p></font></font></font></li></ol>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">An example of the jndi.properties file would look as follows:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span><span style="FONT-FAMILY: 'Courier New'">java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory</span></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><span style="FONT-FAMILY: 'Courier New'"></span></font></font><span style="FONT-FAMILY: 'Courier New'"><font size="3"><font color="#000000">java.naming.provider.url=t3://localhost:7001<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: 'Courier New'"><font size="3"><font color="#000000">&nbsp;<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><span style="FONT-FAMILY: 'Courier New'"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><o:p></o:p></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">The jndi.properties file may also require a username/password.<span style="mso-spacerun: yes">&nbsp; </span>These JNDI properties should be modified to use the principal and credentials created on the Weblogic Server.<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><span style="mso-spacerun: yes">&nbsp;</span><o:p></o:p></font></font></font></p>
<ol style="MARGIN-TOP: 0in" type="1" start="3">
<li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><font size="3"><font color="#000000"><font face="Times New Roman">For every element in orion-application-client.xml, create a corresponding element in weblogic-application-client.xml to map any Java EE references to the resources bound in Oracle WebLogic Server.<o:p></o:p></font></font></font></li></ol>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<ol style="MARGIN-TOP: 0in" type="1" start="4">
<li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><font size="3"><font color="#000000"><font face="Times New Roman">Modify the classpath of the client to include the Oracle WebLogic Server client jars.<span style="mso-spacerun: yes">&nbsp; </span>The jars required for the classpath are determined by the protocol that the customer wishes to use for this client.<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></font></font></li></ol>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">Please refer to the following Weblogic Server documentation to determine the appropriate client jar to use:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><a href="http://download-llnw.oracle.com/docs/cd/E12840_01/wls/docs103/client/basics.html#wp1066820"><font face="Times New Roman" size="3">Client Types and Features</font></a><o:p></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<ol style="MARGIN-TOP: 0in" type="1" start="5">
<li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"><font size="3"><font color="#000000"><font face="Times New Roman">Modify any application client startup scripts to use the Oracle WebLogic Server application client launcher.<o:p></o:p></font></font></font></li></ol>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">&nbsp;<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"><font size="3"><font color="#000000"><font face="Times New Roman">The following is an example of a typical command line for launching a Weblogic Application Client:<o:p></o:p></font></font></font></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt 0.5in"><span lang="EN"><font size="3"><font color="#000000"><font face="Courier New">java weblogic.demo.DemoClient myclient.jar t3://localhost:7001<o:p></o:p></font></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN"><font size="3"><font color="#000000"><font face="Courier New">&nbsp;<o:p></o:p></font></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN"><font size="3"><font color="#000000"><font face="Courier New">&nbsp;<o:p></o:p></font></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN" style="FONT-FAMILY: 'Times New Roman'"><font size="3"><font color="#000000">The following links will be helpful when attempting to upgrade an application client from OC4J to Weblogic Server:<o:p></o:p></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN" style="FONT-FAMILY: 'Times New Roman'"><font size="3"><font color="#000000">&nbsp;<o:p></o:p></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN" style="FONT-FAMILY: 'Times New Roman'"><font size="3"><font color="#000000">"WLS - Programming Standalone Clients"<o:p></o:p></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN"><a href="http://download-llnw.oracle.com/docs/cd/E12840_01/wls/docs103/client/"><font face="Courier New" size="3">Programming Stand-alone Clients</font></a><o:p></o:p></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN"><font size="3"><font color="#000000"><font face="Courier New">&nbsp;<o:p></o:p></font></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN"><font size="3"><font color="#000000"><font face="Courier New">"Oracle Fusion Middleware Upgrade"<o:p></o:p></font></font></font></span></p>
<p class="MsoBodyTextIndent" style="MARGIN: 0in 0in 0pt"><span lang="EN"><a href="http://www.oracle.com/technology/products/middleware/upgrade/index.html"><font face="Courier New" size="3">Oracle Fusion Middleware Upgrade</font></a></span><span lang="EN" style="FONT-FAMILY: 'Times New Roman'"><o:p></o:p></span></p>
<p>&nbsp;</p>]]>
      
   </content>
</entry>

<entry>
   <title>Message Driven Bean Migration from OC4J to WebLogic</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/09/message_driven_bean_migration.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14323</id>
   
   <published>2009-09-10T20:12:28Z</published>
   <updated>2009-09-10T20:45:30Z</updated>
   
   <summary><![CDATA[ Both OC4J and WebLogic have a provider specific descriptor that, in conjunction with the standard ejb-jar.xml descriptor, integrates MDBs with the container and provides inbound configuration that identifies the source destination and related information.&nbsp; This source destination may share...]]></summary>
   <author>
      <name>john.leinaweaver</name>
      
   </author>
   
      <category term="Technical" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p class="MsoNormal">
</p>
<p class="MsoNormal"><span style="font-weight: bold;"></span>Both OC4J
and WebLogic have a provider specific descriptor
that, in conjunction with the standard ejb-jar.xml descriptor,
integrates MDBs
with the container and provides inbound configuration that identifies
the
source destination and related information.&nbsp; This source
destination may share the same instance as the MDB, be from a different
instance, or even a different JMS provider.&nbsp;&nbsp;&nbsp; This
discussion will focus on the configuration approaches of OC4J and
WebLogic and offer what needs to be considered when migrating an
existing MDB deployed to OC4J to a WebLogic server.</p>
<h2>OC4J and WebLogic MDB Configuration Approaches
</h2>
Each OC4J JMS MDB endpoint is associated with a set of configuration
properties (referred to as ActivationSpec
properties).&nbsp;&nbsp;&nbsp;
These properties are typically set in the <span
style="font-family: monospace;">orion-ejb-jar.xml</span>, however,
the properties can also be set in the <span
style="font-family: monospace;">ejb-jar.xml</span> file if the JMS
connector is included in an application's .ear file.&nbsp;&nbsp; The
syntax for each file is different.<br>
<br>
<code>&lt;orion-ejb-jar&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;enterprise-beans&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;message-driven-deployment
name="simpleMdb" resource-adapter="tibcojms"&gt;<br>
</code><code>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;config-property&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;config-property-name&gt;ExamplePropertyName&lt;/config-property-name&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;config-property-value&gt;ExampleValue&lt;/config-property-value&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/config-property&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
<br>
</code><a name="ejb-jar_activation-config-property"></a>When using the
<span style="font-family: monospace;">ejb-jar.xml</span> file, the
properties are added to each
&lt;message-driven&gt; node, using the following syntax:<br>
<br>
<code>&lt;ejb-jar&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;enterprise-beans&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;message-driven&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;ejb-name&gt;simpleMdb&lt;/ejb-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;activation-config<br>
</code><code>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;activation-config-property&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;activation-config-property-name&gt;ExamplePropertyName<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;/activation-config-property-name&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;activation-config-property-value&gt;ExampleValue<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;/activation-config-property-value&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;/activation-config-property&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; ...<br>
</code><br>
A complete listing of OC4J JMS ActivationSpec properties and their
usage can be found in <a
href="http://download.oracle.com/docs/cd/B32110_01/web.1013/b28958/jms.htm#CIHIGGHH">chapter
four of the OC4J Services Guide</a>, fine tuning MDB endpoints.<br>
<br>
For WebLogic, Message Driven Beans can be integrated into the server
through the use of the &lt;message-driven-descriptor&gt; stanza within
the <span style="font-family: monospace;">weblogic-ejb-jar.xml</span>
file. <br>
<br>
<code>&lt;weblogic-ejb-jar&gt;<br>
&nbsp;&nbsp;&lt;weblogic-enterprise-bean&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;ejb-name&gt;SimpleMdb&lt;/ejb-name&gt;</code><br>
<code>&nbsp;&nbsp;&nbsp; </code><code class="cCode">&lt;message-driven-descriptor&gt;<br>
&nbsp; &nbsp; &nbsp;&nbsp;
&lt;destination-jndi-name&gt;...&lt;/destination-jndi-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;initial-context-factory&gt;...&lt;/initial-context-factory&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;connection-factory-jndi-name&gt;...&lt;/connection-factory-jndi-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;jms-client-id&gt;...&lt;/jms-client-id&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;generate-unique-jms-client-id&gt;...&lt;/generate-unique-jms-client-id&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;durable-subscription-deletion&gt;...&lt;/durable-subscription-deletion&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
&nbsp; &nbsp; &lt;/message-driven-descriptor&gt;</code><code><br>
&nbsp;
&lt;/weblogic-enterprise-bean&gt;<br>
&lt;/weblogic-ejb-jar&gt;</code><code><br>
</code><br>
A complete description for developing MDBs in WebLogic can be found in
the <a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13719/message_beans.htm#EJBPG399">Design
Message-Driven Beans</a> guide.<a
href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/ejb/DDreference-ejb-jar.html"></a><br>
<h2>MDB Migration Considerations</h2>
<h3>Resource References</h3>
It's very common for MDB applications to leverage resource references
for forwarding/response purposes.&nbsp; Like OC4J, WebLogic provides an
element in its proprietary <span style="font-family: monospace;">weblogic-ejb-jar.xml</span>
to map a logical
resource reference to a JNDI location. &nbsp; This element is named
&lt;resource-description&gt;.&nbsp;&nbsp; <span
class="046592623-09092009"></span><font color="#0000ff"><a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13727/j2ee.htm#g1329180">Enhanced
Support for Using WebLogic JMS with EJBs and Servlets</a> <span
style="color: rgb(0, 0, 0);">steps through its usage step-by-step and
also describes how WebLogic automatically wraps and pools resource
references.</span></font><a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13712/weblogic_xml.htm#i1087465"></a>
<h3>XA Support <br>
</h3>
Both OC4J and WebLogic utilize the standard JEE <span
style="font-family: monospace;">ejb-jar.xml </span>descriptor
to identify if the inbound MDB participates in an XA
transaction.&nbsp;&nbsp; <br>
<pre xml:space="preserve" class="oac_no_warn">&lt;ejb-jar&gt;<br> &lt;enterprise-beans&gt;<br> &lt;message-driven&gt;<br><span
style="font-weight: bold;"> &lt;transaction-type&gt;Container&lt;/transaction-type&gt;</span><br><br> &lt;assembly-descriptor&gt;<br> &lt;container-transaction&gt;<br> &lt;method&gt;<br> &lt;ejb-name&gt;...&lt;/ejb-name&gt;<br> &lt;method-name&gt;onMessage()&lt;/method-name&gt;<br> &lt;/method&gt;<br> <span
style="font-weight: bold;">&lt;trans-attribute&gt;Required&lt;/trans-attribute&gt;</span><br><br></pre>
Users must then specify a JMS connection factory that implements the XA
for the inbound MDB and for any connection factories configured as
resource-references used within the MDB.
<h3>Translating OC4J JMS MDB ActivationSpec Properties</h3>
Migrating the MDB involves understanding which ActivationSpec
properties are defined for the MDB in OC4J, then utilize the WebLogic
MDB descriptor elements to configure similar behavior.&nbsp;&nbsp;
Furthermore, any ActivationSpec properties defined within the standard
<span style="font-family: monospace;">ejb-jar.xml</span> descriptor
should either be commented out or
removed.&nbsp;&nbsp; WebLogic will not process OC4J specific
activation-config-properties.<br>
<br>
A listing of OC4J JMS MDB ActivationSpec properties and how they may be
translated to the descriptors for WebLogic's MDB implementation is a
follows:<br>
<br>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2"
cellspacing="2">
<tbody>
<tr>
<td
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">OC4J
JMS MDB <br>
ActivationSpec Property<br>
</td>
<td
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Purpose<br>
</td>
<td
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">How
to define
in WebLogic<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><small>ConnectionFactoryJndiName,<br>
Destination Name,<br>
DestinationType<br>
</small></td>
<td style="vertical-align: top;"><small>MDB inbound configuration
including the JNDI names for the connection factory and destination and
the destination type.<br>
</small></td>
<td style="vertical-align: top;"><small>The inbound JNDI names
for the MDB are configured as <span style="font-style: italic;">connection-factory-jndi-name</span>
and <span style="font-style: italic;">destination-jndi-name </span>elements
in the <span style="font-style: italic;">message-driven-subscription</span>
section of weblogic-ejb-jar.xml.<br>
The destination type is specified using the <span
style="font-style: italic;">destination-type</span> element in
the <span style="font-style: italic;">message-driven</span> section of
ejb-jar.xml.<br>
</small></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>SubscriptionDurability,<br>
SubscriptionName<br>
</small></td>
<td style="vertical-align: top;"><small>Identifies if an MDB's
topic subscription is durable or non-durable and the subscription name.<br>
</small></td>
<td style="vertical-align: top;"><small>The subscription
durability is configured as <span style="font-style: italic;">subscription-durability
</span>element in the <span style="font-style: italic;">message-driven</span>
section of ejb-jar.xml.&nbsp; Subscription name can not be specified in
WebLogic.<br>
</small></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>ClientID</small></td>
<td style="vertical-align: top;"><small>If set, connections used
by the inbound MDB connection will set this clientID</small></td>
<td style="vertical-align: top;"><small>Set by the <span
style="font-style: italic;">jms-client-id</span> element in the <span
style="font-style: italic;">message-driven</span> section of <span
style="font-style: italic;">weblogic-ejb-jar.xml</span>.&nbsp;&nbsp;
Additionally, </small><span
style="font-size: 10pt; font-family: &quot;Times New Roman&quot;;">a <span
style="font-style: italic;">generate-unique-jms-client-id </span>element
in the same descriptor may be used in some cases.</span></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>AcknowledgeMode<br>
</small></td>
<td style="vertical-align: top;"><small>Controls quality of
service for MDB's onMessage<br>
</small></td>
<td style="vertical-align: top;"><span
style="font-size: 10pt; font-family: &quot;Times New Roman&quot;;">Configured
as <span style="font-style: italic;">acknowledge-mode </span>element
in the <span style="font-style: italic;">message-driven </span>section
of the
ejb.jar.xml. </span></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>MessageSelector<br>
</small></td>
<td style="vertical-align: top;"><small>Selector expression to
filter inbound messages<br>
</small></td>
<td style="vertical-align: top;"><span
style="font-size: 10pt; font-family: &quot;Times New Roman&quot;;">Configured
as <span style="font-style: italic;">message-selector </span>element
in the <span style="font-style: italic;">message-driven</span> section
of the
ejb-jar.xml.</span></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>UseExceptionQueue, <br>
ExceptionQueueName,<br>
IncludeBodiesInExceptionQueue<br>
</small></td>
<td style="vertical-align: top;"><small>Specifies how to handle
problem messages (if they should be saved to an exception queue and in
what format)<br>
</small></td>
<td style="vertical-align: top;"><small>WebLogic does not handle
problem messages on an MDB by MDB basis.&nbsp;&nbsp; User needing such
features may consider configuring an error destination if the JMS
provider is WebLogic.<br>
</small></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>MaxDeliveryCnt</small></td>
<td style="vertical-align: top;"><small>The number of times an
MDB will attempt to process the same message before it is discarded.</small></td>
<td style="vertical-align: top;"><small>WebLogic MDBs do not
supply this capability directly. <br>
If the source destination is a WebLogic JMS destination, users can
configure a delivery limit&nbsp;in&nbsp;the&nbsp;JMS destination
configuration.&nbsp;&nbsp;&nbsp; Also, if the source is a WebLogic JMS
destination you can configure redelivery delay.<br>
</small></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>MaxListenerThreads,<br>
MinListenerThreads,<br>
ReceiverThreads</small></td>
<td style="vertical-align: top;"><small>Controls the maximum and
minimum number of receiver threads to create for the endpoint.&nbsp;
(RecieverThreads was depricated in OC4J 10.1.3.4 in favor of
Min/MaxListenerThreads)</small></td>
<td style="vertical-align: top;"><span style="font-size: 10pt;">This
is configured by the <span style="font-style: italic;">max-beans-in-free-pool</span>
and dispatch-policy element values in the <span
style="font-style: italic;">message-driven-descriptor </span>element
of weblogic-ejb-jar.xml.</span></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>ListenerThreadMaxPollInterval,<br>
ListenerThreadMaxIdleDuration,<br>
ListenerThreadMinBusyDuration<br>
</small></td>
<td style="vertical-align: top;"><small>Controls the throttling
of the number of MDB threads, how fast should they ramp up or down
(works in conjunction with MaxListenerThreads and MinListenerThreads).<br>
</small></td>
<td style="vertical-align: top;"><span
style="font-size: 10pt; font-family: &quot;Times New Roman&quot;;">No action
required.<span style="">&nbsp; </span>WebLogic MDB thread throttling
is either automatic or is
delegated to the source JMS server's built in asynchronous consumer
capability,
depending on the use case</span></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>EndpointFailureRetryInterval<br>
</small></td>
<td style="vertical-align: top;"><small>If endpoint can not be
processed, how long until it will be scheduled to be retried</small></td>
<td style="vertical-align: top;">
<p class="MsoNormal"><span style="font-size: 10pt;">The <i>init-suspend-seconds</i>
element<o:p></o:p> Allows
an MDB to suspend it's JMS connection when the EJB container detects a
JMS
resource outage.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt;">The <i>max-suspend-seconds</i>
element provides the maximum number of
seconds to
suspend an MDB's JMS connection when the EJB container detects a JMS
resource
outage.<o:p></o:p></span></p>
<span style="font-size: 10pt; font-family: &quot;Times New Roman&quot;;">Additionally,
the <i>jms-polling-interval-seconds </i>element sets the number of
seconds between attempts by the
EJB container to
reconnect to a JMS destination that has become unavailable.</span></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>ResUser,<br>
ResPassword<br>
</small></td>
<td style="vertical-align: top;"><small>Allow a pre-defined
username/password to be specified for the MDB's JMS connection.<br>
</small></td>
<td style="vertical-align: top;"><small>Users may utilize the JMS
Foreign Server (even for the local WebLogic JMS server) to specify
pre-defined username/passwords for the MDB's inbound connection.<br>
</small>
<h3 style="font-weight: normal;" class="sect2"><small><small><a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13719/message_beans.htm#EJBPG454">Configuring
a Security Identity for a Message-Driven Bean</a> is another approach
available in WebLogic.<br>
</small></small></h3>
</td>
</tr>
</tbody>
</table>
<br>
<h3>When the Destination is Remote</h3>
When a destination is remote, both WebLogic and OC4J require
further configuration.
<br>
<br>
OC4J requires that remote destinations and connection
factories be configured as part of a JMS Connector.<span style="">&nbsp;
</span>The JMS connector will use an OC4J resource-provider to access a
foreign server's context.<span style="">&nbsp; </span>The connector
includes entries in oc4j-connectors.xml to map foreign destinations and
the
resource adapter's oc4j-ra.xml descriptor for mapping connection
factories.<span style="">&nbsp;&nbsp; </span>OC4J utilizes the same
JMS
Connector approach when accessing JMS objects for the local OC4J
instance's JMS
server objects.
<br>
<br>
For WebLogic, remote destinations are preferably accessed via
Foreign Server Context, Foreign Connection Factory, and Foreign
Destination
mappings that are configured in a JMS configuration system module.<span
style=""></span><br>
<br>
In WebLogic, a destination is known to be "local" to a
WebLogic MDB when the MDB and destination both run on the same server
or
cluster. In cases where the destination is deployed on a different
server or
cluster, it is referred to as a "remote" destination to the MDB.<span
style="">&nbsp;&nbsp; <br>
<br>
A remote destination also includes those defined in the Oracle AQ JMS
provider and non-Oracle JMS providers..&nbsp;&nbsp; Integrating AQ JMS
with WebLogic 10.3.1 is discussed in <a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13738/aq_jms.htm#JMSAD565">Interoperating
with Oracle AQ JMS</a>.&nbsp;&nbsp; Information for integrating AQ JMS
with earlier WebLogic releases can be found in <a
href="http://blogs.oracle.com/learnwithpavan/2008/12/aq_weblogic_jms_connectivity_u.html">AQ
- Weblogic JMS Connectivity using Weblogic JMS Bridge</a>.&nbsp;&nbsp;
Integrating WebLogic with non-Oracle providers is discussed in </span><a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13738/advance_config.htm#i1081815">Configuring
Foreign Server Resources to Access Third-Party JMS Providers</a><br>
<span style=""><br>
</span>
The nature of a destination--local versus remote--dictates to
some extent how the following key elements in the <code><span
style="font-size: 10pt; font-family: &quot;Courier New&quot;;">message-destination-descriptor</span></code>
for the MDB in <code><span
style="font-size: 10pt; font-family: &quot;Courier New&quot;;">weblogic-ejb-jar.xml</span></code>
are configured, as shown in the table below:<br>
<br>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2"
cellspacing="2">
<tbody>
<tr>
<td colspan="1" rowspan="3"
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">WebLogic
message-driven-description Attribute<br>
</td>
<td colspan="3" rowspan="1"
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Value<br>
</td>
</tr>
<tr>
<td colspan="1" rowspan="2"
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Destination
is Local<br>
</td>
<td colspan="2" rowspan="1"
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Destination
is Remote<br>
</td>
</tr>
<tr>
<td
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Not
using Foreign Server (not the preferred method)<br>
</td>
<td
style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Using
Foreign Server (preferred method)<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><small>provider-url<br>
</small></td>
<td style="vertical-align: top;"><small>Do not specify<br>
</small></td>
<td style="vertical-align: top;"><small>Specify remote/foreign
provider-url<br>
</small></td>
<td style="vertical-align: top;"><small>Do not specify
provider-url.&nbsp; The URL is implicitly encoded in the Foreign Server
configuration.<br>
</small></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>initial-context-factory<br>
</small></td>
<td style="vertical-align: top;"><small>Do not specify<br>
</small></td>
<td style="vertical-align: top;"><small>Specify the initial
context factory class name used by the JMS provider except when the
remote provider is WebLogic JMS, in which case, do not specify this
value (use the default)<br>
</small></td>
<td style="vertical-align: top;"><small>do not specify
initial-context-factory<br>
</small></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>destination-jndi-name<br>
</small></td>
<td style="vertical-align: top;"><small>Specify the name bound in
the local JNDI tree for the destination<br>
</small></td>
<td style="vertical-align: top;"><small>Specify the name of the
destination, as bound in the remote provider's JNDI tree<br>
</small></td>
<td style="vertical-align: top;"><small>Specify the name of the
Foreign Destination you set up in your local JNDI tree that corresponds
to the remote or foreign destination.<br>
</small></td>
</tr>
<tr>
<td style="vertical-align: top;"><small>connection-factory-jndi-name<br>
</small></td>
<td style="vertical-align: top;"><small>Do not specify
connection-factory-jndi-name unless a custom connection factory is
configured to be used with the MDB.<br>
</small></td>
<td style="vertical-align: top;"><small>Specify the name of the
connection fatory used by the JMS provider, as bound in the remote JNDI
tree, except when the remote provider is WebLogic JMS in which case it
is okay to use the default.<br>
</small></td>
<td style="vertical-align: top;"><small>Specify the Foreign
Connection Factory you set up in your local JNDI tree that corresponds
to the remote JMS provider's connection factory.<br>
</small></td>
</tr>
</tbody>
</table>
<br>
<h2>For more information regarding WebLogic and MDB Integration
</h2>
<ul>
<li><a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e14529/messaging.htm">JMS
Information Roadmap</a><br>
</li>
<li><a class="olink EJBPG399"
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13719/message_beans.htm#EJBPG399">Design
Message-Driven Beans</a><a class="olink PERFM271"
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13814/mdbtuning.htm#PERFM271">Tuning
Message-Driven Beans</a></li>
<li><a
href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/ejb/DDreference-ejb-jar.html">weblogic-ejb-jar.xml
Deployment Descriptor Reference</a></li>
<li>Information describing WebLogic JMS features such as redelivery
delay, delivery limits, etc can be found in <a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13727/manage_apps.htm">Managing
Your Applications</a>.</li>
<li><a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13727/interop.htm#JMSPG553">I</a><a
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13727/interop.htm#JMSPG553">ntegrating
Remote JMS Providers FAQ</a><br>
</li>
</ul>
<br>
<br>
<h3><br>
</h3>
<br>
<p class="MsoNormal"><o:p></o:p></p>]]>
      
   </content>
</entry>

<entry>
   <title>Using the Console to Create Repeatable Configuration Scripts</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/08/using_the_console_to_create_re.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.14113</id>
   
   <published>2009-08-31T19:05:32Z</published>
   <updated>2009-08-31T19:23:56Z</updated>
   
   <summary>WebLogic Server provides several administration tools such as the WLS Console (a graphical user interface) and WLST (a tool that runs Jython-based configuration scripts). If you need to make small ad hoc changes or one time configuration changes, the WLS...</summary>
   <author>
      <name>tom.moreau</name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p>WebLogic Server provides several administration tools such as the WLS Console (a graphical user interface) and WLST (a tool that runs Jython-based configuration scripts).</p>

<p>If you need to make small ad hoc changes or one time configuration changes, the WLS Console is a great choice. However, sometimes you need to repeatedly make a set of coordinated changes. For example, you might want to scale up a domain by periodially adding an SSL-enabled server to an existing cluster as the load goes up. In these cases, writing a WLST script can be a better choice. A script guarantees consistency and saves the administrator from having to repeatedly make coordinated changes across a number of console pages.</p>

<p>So, how do you get started writing your WLST script, especially if you're not a WLST script expert? The WLS Console provides a recording feature that writes out the edits you make in the console to a WLST script.<br />
The basic idea is that you:<ol><li> Log into the WLS Console and turn on script recording.</li><br />
<li> Use the WLS console to make some changes (e.g add a new SSL-enabled server to a existing cluster).</li><br />
<li>Turn off script recording.</li><br />
<li>Hand edit the captured script to clean it up and parameterize it (for example, have it prompt for the server name).</li><br />
</ol>This can be a lot easier than starting from scratch since the console will show you which WLST commands you should be using.</p>

<p>This blog walks you through how to use the WLS Console's WLST script recording feature to create a script. The script prompts the adminstrator for a server name, listen address, listen port and SSL listen port. Then it creates a new SSL-enabled server with these values and adds it to the existing cluster named 'MyCluster'.</p>

<p>For this blog, I'm assuming that you're using a development mode domain that has the 'Automatically Acquire Lock and Activate Changes' console preference enabled (this is the default for development mode domains). I'm also assuming your domain already has a cluster named 'MyCluster'.</p>

<p>Here are the steps.</p>

<p><big>Step 1 - Turn On Recording</big><br />
Log into the WLS Console and click 'Record' (in the the toolbar near the top of the page). This starts WLST script recording. When you start recording, the console prints out the name of the WLST script file it will create. For example:<br />
<blockquote>The recording session has started. Recording to C:\mydomain\Script1251228165047.py.</blockquote>Any configuration changes you make will be recorded in this script. Remember the name of this script since you'll be hand editing it later.</p>

<p>Note: deployment plan changes and security data changes (such as adding, deleting and modifying users, groups, roles and policies) will not be captured in the script.</p>

<p><big>Step 2 - Use the WLS Console to Make Typical Edits</big><br />
Use the WLS Console to make some changes to the domain's configuration. For this example, create a new server in 'MyCluster', enable SSL for the server and customize the server's listen address, listen port and SSL listen port:<ol><li>Click 'Servers' on the console home page.</li><br />
<li>Click 'New' to create a new server.</li><br />
<li>Set 'Server Name' to 'MyServer'.</li><br />
<li>Set 'Server Listen Address' to 'MyListenAddress'.</li><br />
<li>Set 'Listen Port' to '7777'.</li><br />
<li>Select the 'Yes, make this server a member of an existing cluster.' radio button.</li><br />
<li>Select 'MyCluster' from the list of clusters.</li><br />
<li>Click 'Finish'.</li><br />
<li>Click 'MyServer' in the servers table.</li><br />
<li>Click the 'SSL Listen Port Enabled' check box.</li><br />
<li>Set 'SSL Listen Port' to '8888'.</li><br />
<li>Click 'Save'.</li></ol><big>Step 3 - Turn Off Recording</big><br />
Click 'Record' again in the toobar near the top of the page. This stops WLST script recording. The console will print out the name of the script again:<br />
<blockquote>The recording session has ended. Script recorded to C:\mydomain\Script1251228165047.py.</blockquote>You now have a script that shows how to add a new SSL-enabled server named 'MyServer' to the cluster 'MyCluster':<blockquote><code>startEdit()</p>

<p>cd('/')<br />
cmo.createServer('MyServer')</p>

<p>cd('/Servers/MyServer')<br />
cmo.setListenAddress('MyListenAddress')<br />
cmo.setListenPort(7777)<br />
cmo.setCluster(getMBean('/Clusters/MyCluster'))</p>

<p>activate()</p>

<p>startEdit()<br />
cmo.setListenPortEnabled(true)<br />
cmo.setJavaCompiler('javac')<br />
cmo.setClientCertProxyEnabled(false)<br />
cmo.setMachine(None)</p>

<p>cd('/Servers/MyServer/SSL/MyServer')<br />
cmo.setEnabled(true)<br />
cmo.setListenPort(8888)</p>

<p>activate()</p>

<p>startEdit()</code></blockquote>If you look at this script, you'll notice that it isn't ready to use yet:<ul><li>It doesn't connect to the admin server at the beginning or disconnect at the end</li><br />
<li>It doesn't call 'edit' to tell WLST to use the 'edit' MBean server. Note: the administration server has several different MBean servers. The 'edit' MBean server is the one that lets you view and manage the domain's configuration.</li><br />
<li>There are extra 'activate' and 'startEdit' calls. This is because 'Automatically Acquire Lock and Activate Changes' is enabled (this preference makes every console page uses a separate configuration editing session).</li><br />
<li>The server name, cluster name, listen address, listen port and SSL listen port values are hard coded.</li></ul><big>Step 4 - Edit the Captured Script</big><br />
Make a copy of the captured script, then edit the copy to address these issues.<ul><li>Call 'connect' at the beginning of the script. To connect, WLST needs to know the admin server url as well as the admin user name and password. You have two choices on how to get this information:</li><ul><li>Prompt for them or get them from the command line, then pass them to the 'connect' command.</li><br />
  <li>Don't pass any parameters to the 'connect' command. Instead, always run WLST from the domain directory on the admin server's machine. When you do this, WLST can automatically figure out the username, password, and url. This example takes this approach.</li></ul><li>Call 'edit' to tell WLST to use the admin server's 'edit' JMX server.</li><br />
<li>Call 'disconnect' at the end of the script.</li><br />
<li>Remove the extra 'activate' and 'startEdit' commands.</li><br />
<li>Parameterize the script, that is, let the administrator specify the server name, listen address, listen port and SSL listen port. The two main ways to get these parameters are to prompt for them or to get them from the command line. This example prompts for them. Note: Since this example wants to show how to add new servers to an existing cluster, it leaves the cluster name hard coded in the script (ie. 'MyCluster'). This is typical. Most scripts want to parameterize some values and hard code others.</li><br />
<li>You also might want to add some error handling to the script. This example does not show how to do this.</li></ul>Here is the edited script (e.g. C:\temp\MyCreateServerScript.py):<blockquote><code>connect()<br />
edit()</p>

<p>myServerName = raw_input('Enter server name:')<br />
myListenAddress = raw_input('Enter listen address:')<br />
myListenPort = int(raw_input('Enter listen port:'))<br />
mySSLListenPort = int(raw_input('Enter SSL listen port:'))</p>

<p>startEdit()</p>

<p>cd('/')<br />
cmo.createServer(myServerName)</p>

<p>cd('/Servers/' + myServerName)<br />
cmo.setListenAddress(myListenAddress)<br />
cmo.setListenPort(myListenPort)<br />
cmo.setCluster(getMBean('/Clusters/MyCluster'))</p>

<p>cmo.setListenPortEnabled(true)<br />
cmo.setJavaCompiler('javac')<br />
cmo.setClientCertProxyEnabled(false)<br />
cmo.setMachine(None)</p>

<p>cd('/Servers/' + myServerName + '/SSL/' + myServerName)<br />
cmo.setEnabled(true)<br />
cmo.setListenPort(mySSLListenPort)</p>

<p>activate()<br />
disconnect()</code></blockquote>You now have a parameterized WLST script that your administrator can use to add new SSL-enabled servers to 'MyCluster' as the load goes up.</p>

<p><big>Using the Script</big><br />
Here's how to run the script:<ol><li>'cd' to your domain's directory on the admin server's machine</li><br />
<li>run the .\bin\setDomainEnv.cmd script</li><br />
<li>java weblogic.WLST C:\temp\MyCreateServerScript.py</li><ul><li>Enter server name:server99</li><br />
  <li>Enter listen address:listenaddress99</li><br />
  <li>Enter listen port:7099</li><br />
  <li>Enter SSL listen port:8099</li><br />
</ul></ol>At this point, you can log into your domain's WLS Console, go to the 'Servers' table and view the new server that the script created.</p>

<p><big>Summary</big><br />
In summary, if you want to create a parameterized WLST script that edits a domain's configuration:<ol><li>Log in into your domain's WLS Console and turn on recording.</li><br />
<li>Use the console to make the kind of configuration changes that you want your script to have.</li><br />
<li>Turn off recording.</li><br />
<li>Make a copy of the captured script, clean it up and parameterize it.</li><br />
</ol>For more information on the WebLogic Server Console's WLST script recording feature, see <a href=http://download-llnw.oracle.com/docs/cd/E15051_01/wls/docs103/ConsoleHelp/taskhelp/console/RecordWLSTScripts.html>http://download-llnw.oracle.com/docs/cd/E15051_01/wls/docs103/ConsoleHelp/taskhelp/console/RecordWLSTScripts.html</a><br />
For more information on the WebLogic Server WLST scripting tool, see <a href=http://download.oracle.com/docs/cd/E13222_01/wls/docs91/config_scripting/index.html>http://download.oracle.com/docs/cd/E13222_01/wls/docs91/config_scripting/index.html</a><br />
</p>]]>
      
   </content>
</entry>

<entry>
   <title>Starting WLS through nodemanager details</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/WebLogicServer/2009/08/starting_wls_through_nodemanager_details.html" />
   <id>tag:blogs.oracle.com,2009:/WebLogicServer//380.13938</id>
   
   <published>2009-08-20T21:47:30Z</published>
   <updated>2009-08-20T21:54:24Z</updated>
   
   <summary> More and more users are utilizing the nodemanager agent to start and monitor their WebLogic server instances. This helps ensure high availability of the WebLogic Server with automatic restarts as well as supporting automatic whole server migration. With this...</summary>
   <author>
      <name>josh.dorr</name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/WebLogicServer/">
      <![CDATA[<p><br />
More and more users are utilizing the nodemanager agent to start and monitor their WebLogic server instances.  This helps ensure high availability of the WebLogic Server with automatic restarts as well as supporting automatic whole server migration.  With this increased use there has also been an increase in scenarios for starting a WebLogic Server instance.  In fact some questions have come up on how to configure the domain for setting specific properties or environment variables for a WebLogic Server instance when it is started through the nodemanager agent.  </p>

<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://blogs.oracle.com/WebLogicServer/assets_c/2009/08/server_start-423.html" onclick="window.open('http://blogs.oracle.com/WebLogicServer/assets_c/2009/08/server_start-423.html','popup','width=1327,height=1009,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://blogs.oracle.com/WebLogicServer/assets_c/2009/08/server_start-thumb-1327x1009-423.png" width="150" height="100" alt="server_start.PNG" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></a></span>The best method for specifying command line properties for a server is by specifying those properties in the ServerStartMBean's arguments attribute.  Each ServerMBean has a ServerStartMBean that stores start up specific values.  These values can be set in the console by visiting the server specific configuration page, and then finding the "ServerStart" tab where the attributes can be set.  These values can also be set in an edit session using WLST: <br />
cd('Servers/YOUR_SERVER_NAME/ServerStart/YOUR_SERVER_NAME')<br />
set('Arguments', '-Dweblogic.debug.DebugServerMigration')</p>

<p>Setting the values in the ServerStartMBean will ensure that "-Dweblogic.debug" flags or other custom properties are passed to the server.  This is because a start call from the console or from WLST will go through the admin server, gathering the appropriate properties from the configuration, and send this information to the nodemanager.  The information will be passed to the server regardless of whether the nodemanager is configured to start the server using a java command line (default) or a start script.</p>

<p>Storing the information in the ServerStartMBean also ensures that the information is centrally stored in the config.xml and will be referenced no matter which machine and nodemanager is used when starting the WebLogic Server.  This will help to set the value once and maintain it in the configuration as opposed to storing it in start scripts scattered across multiple machines.</p>

<p>Another requirement may be an environment variable be specified prior to starting the server.  There are 2 different ways to do this.</p>

<p>1.  Make use of a custom start script that will contain the specific environment variables necessary.  To do this, first configure the nodemanager to use a custom start script by specifying StartScriptEnabled=true and StartScriptName=customStartWebLogic.sh in the nodemanager.properties file or on the command line when starting the nodemanager.  Then create the customStartWebLogic.sh in the domain directory that will set the appropriate variables and subsequently call startWebLogic.sh. An very basic example of customStartWebLogic.sh below:</p>

<p>export FOO=foo_value<br />
. ./startWebLogic.sh</p>

<p><br />
2.  Make use of the environment that the java based nodemanager is running in to pass that information on to the server.  To do this, set the necessary environment variables prior to starting the nodemanager. </p>

<p>Both of these solutions allow for multiple servers to be started through the nodemanager without having to set the same property for each server.  But they also create an extra configuration step for each machine that will be used in the domain.  The advantages of creating a custom start script is that the configuration will preserve the correct environment variable, where the nodemanager environment may leave room for a mistake where the environment variable is not correctly set.</p>]]>
      
   </content>
</entry>

</feed>
