<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Seth White&apos;s Blog</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/" />
    <link rel="self" type="application/atom+xml" href="http://dev2dev.bea.com/blog/swhite/atom.xml" />
   <id>tag:dev2dev.bea.com,2008:/blog/swhite//123</id>
    <updated>2008-02-23T04:27:01Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.31</generator>
 
<entry>
    <title>Configuring Eclipse for Automatic Deployment of Event Server Applications</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2008/02/configuring_ecl_1.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2008/02/configuring_ecl_1.html</id>
    
    <published>2008-02-23T04:26:47Z</published>
    <updated>2008-02-23T04:27:01Z</updated>
    
    <summary>In this entry I describe how to configure Eclipse to automatically redeploy an Event Server application while doing iterative development.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>In my last entry, <a href="http://dev2dev.bea.com/blog/swhite/archive/2008/02/configuring_ecl.html" target="_blank">Configuring Eclipse to launch WebLogic Event Server</a>, I described how to configure Eclipse so that one could easily launch a WL EvS server instance within the IDE.&#160; In this entry, I will show how to configure Eclipse to build and automatically deploy an Event Server application to a running Event Server instance.&#160; I have found that configuring Eclipse in this way makes it a great environment for doing iterative development of Event Server applications. In particular, it allows one to make full use of the Eclipse debugger to debug application code and quickly test code changes.    <br /></p>  <p>Before going any further, I would like to mention that BEA provides some <a href="https://dev2devclub.bea.com/updates/wlevs-tools/2.0/" target="_blank">nice tooling for the Event Server</a>.&#160; You may want to set things up yourself, however, if for some reason you cannot use the Event Server Eclipse plug-in.&#160; In my case, I like to use Eclipse 3.3, but the plug-in requires Eclipse 3.2.&#160; <br />    <br />I'm going to show how to automate deployment of the HelloWorld sample application that ships with the Event Server 2.0 release, but the same technique is applicable to any application that is using ant as its build tool.&#160; First, I created an Eclipse project that contains the HelloWorld sample application.&#160; The screenshot below shows this project's contents in the Package Explorer.&#160; Next, I opened the ant build file for the project and added two new targets: install and uninstall.&#160; Like the name implies, these targets uninstall and install the HelloWorld app.&#160; They do this by invoking the command line deployment utility for the Event Server.    <br /></p>  <p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_2.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="802" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb.png" width="1315" border="0" /></a> </p>  <p>   <br />The code sample below shows a close-up of the install target. The URL port is the same as the netio port that is specified in the top-level server config.xml configuration file.&#160; The username and password default to &quot;wlevs&quot; for the sample applications.&#160; The install target assumes that the application bundle is available and ready to be deployed.&#160; We shall rely on the existing dist target to create the application bundle in the &quot;dist&quot; subdirectory.</p>  <pre class="csharpcode" style="width: 729px; height: 298px">
&lt;property name=<span class="str">&quot;bundle.file.name&quot;</span> <span class="kwrd">value</span>=<span class="str">&quot;com.bea.wlevs.example.helloworld_2.0.0.0.jar&quot;</span>/&gt;
&lt;property name=<span class="str">&quot;wlevs.home.dir&quot;</span> <span class="kwrd">value</span>=<span class="str">&quot;${base.dir}/../../../..&quot;</span> /&gt;
&lt;target name=<span class="str">&quot;install&quot;</span>&gt;
    &lt;java classname=<span class="str">&quot;com.bea.wlevs.deployment.Deployer&quot;</span>
          classpath=<span class="str">&quot;${wlevs.home.dir}/bin/com.bea.wlevs.deployment.client_2.0.jar&quot;</span>&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;-url&quot;</span> /&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;http://localhost:9002/wlevsdeployer&quot;</span> /&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;-user&quot;</span> /&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;wlevs&quot;</span> /&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;-password&quot;</span> /&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;wlevs&quot;</span> /&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;-install&quot;</span> /&gt;
        &lt;arg <span class="kwrd">value</span>=<span class="str">&quot;${dist.dir}/${bundle.file.name}&quot;</span> /&gt;
    &lt;/java&gt;
&lt;/target&gt;</pre>

<p>After updating the ant build file, the next step is to configure Eclipse to invoke the new ant targets.&#160; The figure below shows how to open the ant task configuration window.&#160; Begin by right clicking the build.xml file in the Package Explorer view.</p>

<p>&#160;</p>

<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="824" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_2.png" width="1317" border="0" />

  <br /></p>

<p>I recommend giving the ant run configuration a nice name since you will want to add the run configuration to your favorites list.&#160; Here, I have chosen the name &quot;helloworld_src install&quot;.&#160; I have also selected three ant targets to be run: uninstall, all, and install.&#160; I want them run in that order when this configuration is invoked, so I used to the&quot;Target execution order&quot; box to specify this.&#160; In other words, the task will first uninstall the application, then run the all target to build a new application bundle, and finally deploy the new application bundle to the running server.&#160; After making your changes, click Apply and then Close to save the changes without running the ant build yet.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_11.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="759" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_1.png" width="745" border="0" /></a>&#160; <br />

  <br />Next, let's add our new ant task to the favorites list.&#160; The figure below shows how to open the &quot;Organize Favorites&quot; window.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_19.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="745" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_7.png" width="1189" border="0" /></a> </p>

<p>Click &quot;Add...&quot; and then select the ant task that you want to add.&#160; Click OK twice.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_23.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="745" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_9.png" width="1190" border="0" /></a> </p>

<p>&#160;</p>

<p>Next, open the run box and run the helloworld server.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_17.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="746" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_5.png" width="1191" border="0" /></a> </p>

<p>You should see the output from the server in the Eclipse Console view.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_25.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="747" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_10.png" width="1193" border="0" /></a> </p>

<p>&#160;</p>

<p>Now, let's make a simple code change before redeploying the application.&#160; I have added some text, &quot; After redeploy: &quot;,&#160;&#160; to the message printed by the HelloWorld application.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_27.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="745" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_11.png" width="1190" border="0" /></a> </p>

<p>Now, select the &quot;helloworld_src install&quot; and target from the favorites menu.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_33.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="746" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_14.png" width="1191" border="0" /></a> </p>

<p>You should see the message printed by the application change once the application is redeployed, as in the figure below.</p>

<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_29.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="746" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/cc0445067c66_DF2C/image_thumb_12.png" width="1191" border="0" /></a> </p>

<p>&#160;</p>

<p>Eclipse remembers the last task run from the favorites list, so you can build and automatically redeploy the application repeatedly by simply clicking the favorites icon on the menu bar.&#160; If you want to shut down the server, simply close the console view.&#160; To summarize, the basic steps&#160; were: </p>

<ol>
  <li>Add the install and uninstall targets to the ant build file.</li>

  <li>Create an ant run configuration to invoke the new targets.</li>

  <li>Add the run configuration to the favorites menu.</li>

  <li>Invoke ant to build and redeploy the application within Eclipse.</li>
</ol>

<p>I have been using this style of eclipse config for several months and found that it works well.&#160; I can generally rebuild and redeploy my applications in 10 seconds or so, but this will vary depending on the application complexity, of course.&#160;&#160; </p>

<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:78706501-4f49-4119-b394-a60e82fc13f5" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>,<a href="http://technorati.com/tags/Eclipse" rel="tag">Eclipse</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>Configuring Eclipse to launch WebLogic Event Server</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2008/02/configuring_ecl.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2008/02/configuring_ecl.html</id>
    
    <published>2008-02-16T04:06:33Z</published>
    <updated>2008-02-16T04:16:59Z</updated>
    
    <summary>In this post, I describe how to configure the Eclipse IDE to launch the WebLogic Event Server.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>It's been a while since my last post.&#160; For the last few months I have been busy writing code for the next release of the <a href="http://bea.com/framework.jsp?CNT=index.htm&amp;FP=/content/products/weblogic/event_server/">WebLogic Event Server</a>.&#160; Now, the development team has reached our internal &quot;feature complete&quot; milestone for the 3.0 release, so I have time to blog again.     <br />    <br />One thing that's nice about the fact that the Event Server is based on an <a href="http://www.osgi.org/Main/HomePage" target="_blank">OSGi</a> kernel is that it makes it easy to configure <a href="http://www.eclipse.org/" target="_blank">Eclipse</a> to launch the Event Server as a normal Java application.&#160; You essentially just need to specify the Java class for the server, add three jars to the classpath, configure the usual command line options, and away you go. OSGi will take care of loading any additional jars that the server needs.     <br />    <br />Before I go into detail concerning the setup, I should mention that BEA does provide some nice <a href="https://dev2devclub.bea.com/updates/wlevs-tools/2.0/">Eclipse tooling for the Event Server</a> that can also be used to launch the server.&#160; You may want to set things up yourself, however, if you are using a different version of Eclipse than the one the Event Server plug-in supports.&#160; I have been using Eclipse 3.3 for almost a year, for example, and the plug-in requires Eclipse 3.2.     <br />    <br />From within Eclipse, start by by selecting Run &gt; Open Run Dialogue.&#160; When the Run dialogue box opens click on &quot;Java Application&quot; and then click on the leftmost menu item above (the one that looks like a blank sheet of paper) to create a new run configuration for the Java application.     <br />Next, we need to fill in some information.&#160; The screenshot below shows the main screen of the run configuration with the values that I used.&#160; In this example, I am going to configure the server to use the domain for the helloworld sample application that comes with the 2.0 release.    <br />    <br /> You can see that I have named the run configuration &quot;helloworld server&quot;.&#160; I have also associated this run configuration with my helloworld_domain project.&#160; This is an eclipse project that I created and that is rooted at the domain directory of the helloworld sample application that can be found in the Event Server 2.0 release.&#160; I believe you can actually specify whatever you want for the Name and Project, the important thing on this screen is the Main class: com.bea.wlevs.Server.&#160; This is the primordial class whose main method will launch the Event Server.     <br /></p>  <p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image_2.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="592" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image_thumb.png" width="628" border="0" /></a></p>  <p>   <br />Next, let's look at the arguments that are passed to the server.&#160; I have disabled security since I am just doing development.&#160; I have also specified the BEA and WLEVS home directories.&#160; These are the typical arguments that are specified when running the Event Server from the command line.&#160; I have also specified a value for the Working directory.&#160; This is the directory where the event server will be &quot;run&quot;.&#160; In this case, I have specified the root directory of my helloworld_domain project.&#160; I did this by clicking on the &quot;Workspace...&quot; button and then selecting the helloworld_domain project.     <br /></p>  <p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image6.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="591" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image6_thumb.png" width="628" border="0" /></a> </p>  <p>The next step is to specify the JRE&#160; for the server to use.&#160; The server should use the version of JRockIt that is installed with the Event Server.&#160; You may need to click on &quot;Installed JREs&#8230;&#8221; and tell Eclipse where to find JRockIt before you can specify it as the Alternate JRE&#160; to use.    <br />    <br /><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image19.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="531" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image19_thumb.png" width="630" border="0" /></a> </p>  <p>Next, let's configure the classpath for our server instance.&#160; Initially, the Classpath window will look something like this:    <br />    <br /><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image10.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="591" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image10_thumb.png" width="627" border="0" /></a> </p>  <p>&#160;</p>  <p>We need to configure the &quot;User Entries&quot; portion of the classpath.&#160; First, delete whatever is there for &quot;UserEntries&quot; by default.&#160; Then, you will need to add three jars from the bin directory of your Event Server installation.&#160; In the example below,I have done this by selecting&quot;Add External JARs...&quot; , and selecting each jar from my Event Server installation's bin directory.</p>  <p>&#160;</p>  <p>&#160;<a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image_8.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="524" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image14_thumb.png" width="622" border="0" /></a></p>  <p>That's it!&#160; Now, if you click on Run the server should boot and deploy the helloworld sample application.</p>  <p>&#160;</p>  <p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image23.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="516" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image23_thumb.png" width="627" border="0" /></a> </p>  <p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/ConfiguringEclipsetolaunchWebLogicEventS_EA2B/image_8.png"></a></p>  <p>To recap, we specified the following: </p>  <ol>   <li>The Main class for the server. </li>    <li>The commandline arguments to the server.</li>    <li>The server's working directory.</li>    <li>The JRE for the server to use.</li>    <li>The classpath for the server.</li> </ol>  <p>At this point, you can repeatedly run the server by clicking on the green Run button near the top of the Eclipse window. Eclipse will remember the last application that was run, so a single click is all it takes. You can also run the server in debug mode in order to debug applications using the Eclipse debugger.&#160; </p>  <p>If you want to run the server using a different domain, you can copy your existing run configuration for the server and then just change the working directory so that it is the same as the domain directory for the new </p>  <p>domain you want to use. In other words, you don't need to go through all the steps of creating a new run configuration again.</p>  <div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:667c8ae8-70cf-4341-8cff-d556c9f83f5e" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/Eclipse" rel="tag">Eclipse</a>,<a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>WebLogic Event Server: Using Third-Party Libraries</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/10/weblogic_event_6.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/10/weblogic_event_6.html</id>
    
    <published>2007-10-29T17:48:25Z</published>
    <updated>2007-10-30T00:04:49Z</updated>
    
    <summary>In this entry I discuss the options for packaging third-party Java  libraries for use by Event Server applications.  This is a common requirement and there are some interesting twists when doing this for Event Server applications.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>In this entry I discuss the options that are available for configuring third-party Java libraries for use with Event Server 2.0 applications.&nbsp; This is a common requirement for many applications.  <p>The first option that I would like to discuss is adding a third-party library jar to the <a href="http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html">boot classpath</a> of the Event Server.&nbsp; This is a good option to use if you want to try out a third-party library quickly during development and may also be appropriate for production deployments.&nbsp; When using JRockit or the Sun JVM adding&nbsp;a jar to the boot classpath requires that one specify an additional argument when starting the Event Server, namely: -Xbootclasspath/a: &lt;path_to_library_jar&gt;\&lt;jar_file_name&gt;.&nbsp; This will append the library jar to the boot classpath of the virtual machine and make the classes contained within the jar available to all applications deployed in your Event Server instance.&nbsp; <br><br>How does this work exactly?&nbsp; Well, the Event Server is based on a modular architecture (<a href="http://www.osgi.org/">OSGi</a>) in which each module is given its own classloader for loading the classes and resources needed by that module.&nbsp; This fact plus the fact that each application is packaged as a module means that each application effectively gets its own classloader.&nbsp;&nbsp;An application&nbsp;classloader first attempts to load classes from its parent which by default is the Java boot classloader before loading classes from some other module or from itself.&nbsp; So, adding a class to the boot classpath will guarantee that the application loads the class from there.&nbsp; If you would like more details about how OSGi bundle classloaders search for classes, see Section 3.8.4 of the <a href="http://www2.osgi.org/Specifications/HomePage">OSGi Release 4 Core Specification</a>.&nbsp; </p> <p>This approach works well for simple third-party libraries, but it has some limitations.&nbsp; For example, all of the classes needed by the third-party library must be visible to the boot classloader.&nbsp; This means you might end up needing to add several jars to the boot classpath if the jars reference each other's classes.&nbsp; It also means that the third-party library cannot load classes contained in the application bundle since they are not visible to the boot classloader.&nbsp; Another thing to keep in mind is that adding a class to the boot classpath makes it visible to all applications running in the server which may not be what you want.<br><br>Another technique that is quite similar to adding your library to the boot classpath is to place the library in the extensions subdirectory of the JVM.&nbsp; The extension subdirectory is located here: &lt;JAVA_HOME&gt;/jre/lib/ext.&nbsp; This can be useful if your library needs to load classes contained in other extension libraries.&nbsp; If you decide to do things this way you need to specify the following command line argument to the JVM in addition to copying your library into the extensions directory.</p> <p>-Dosgi.parentClassloader=ext</p> <p>This argument tells the&nbsp;application classloaders to use the extension classloader as their parent and delegate to it instead of delegating to the boot classloader.&nbsp; </p> <p>You may be wondering why I recommend adding libraries to the boot or extension classpaths rather than simply using the -classpath option of the JVM.&nbsp; This is because the Event Server uses&nbsp;java's -jar feature to specify the Java executable, like so</p> <p>java&nbsp; ... -jar &lt;WLEVS_HOME&gt;/bin/wlevs_2.0.jar</p> <p>When the -jar option is used the user classpath setting is ignored, which means you can't use -classpath.&nbsp; Of course, you could try to start the event server without using -jar, but this is not recommended.</p> <p>So far, we've discussed what I would call "quick and dirty" techniques for configuring third-party libraries.&nbsp; These techniques are great for prototyping during development.&nbsp; A second, more elegant approach is to package the third-party library inside the application bundle itself.&nbsp; You can do this by "exploding" the third-party jar or by including it directly.&nbsp; If you include the third-party jar directly, you need to add it to what is called the "bundle classpath" by adding an entry like the following in the Manifest.mf file for your application.<br><br>Bundle-Classpath: &lt;path_name&gt;/&lt;file_ name&gt;.jar</p> <p>This tells the server which nested jars in the application bundle contain classes that should be loaded by the application classloader.&nbsp; This approach has a couple of advantages.&nbsp; One advantage is that it helps to keep the application self-contained.&nbsp; This makes it easier to deliver the application to another group for testing or deployment on a production system.&nbsp; Another advantage is that the third-party library can now load any class that is visible to the bundle, including user-written classes.&nbsp; This can be useful if the third-party library loads application classes by name.</p> <p>The final option for configuring a third-party library is to package the library in its own bundle and deploy it to the server as a separate application.&nbsp; The library bundle must export a set of packages containing classes that other bundles can use and it must also import any packages that contain classes that the library itself needs.&nbsp; Getting these lists of exported and imported packages right usually requires some knowledge of the internal workings of the third-party library, so if your vendor hasn't provided you with a bundle up front, this option may be rather difficult.&nbsp; It's worth noting, however, that tools&nbsp;like <a href="http://www.aqute.biz/Code/Bnd">bnd</a> can help immensely with the bundle creation process.&nbsp; Conversely, if the third-party library needs to load application classes, your application bundle will need to export them.&nbsp; Exporting classes from an application bundle has a subtle disadvantage which is that hot redeploy of the application may not work as expected once other bundles in the system have imported the application classes.&nbsp; This is because a bundle can only import one version of a class, so if you hot redeploy your application and have made changes to an application class, those changes will not be visible to other bundles that have imported your application class until you restart the server.&nbsp; For this reason, it's generally a good idea to avoid exporting classes from your applications.</p> <p>That completes the list of alternatives for configuring third-party libraries.&nbsp; To sum things up, the quick and dirty approaches are great for prototyping but make the application less self-contained.&nbsp; Packaging third-party libraries in a separate bundle works well unless the third-party library needs to import application classes in which case it probably a better idea to package the third-party library within the application bundle itself.</p> <p></p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:adee130f-9cb7-40cd-81e8-dfcf9bc507f0" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a>, <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/OSGi" rel="tag">OSGi</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>WebLogic Event Server and WebLogic Server: What&apos;s the difference?</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/09/weblogic_event_5.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/09/weblogic_event_5.html</id>
    
    <published>2007-09-19T04:46:01Z</published>
    <updated>2007-09-19T06:19:43Z</updated>
    
    <summary>WebLogic Event Server and WebLogic Server are both application servers, but there are fundamental differences that set them apart.  This blog entry examines the things that make them unique.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>I had the chance to speak with a number of people -- developers, managers, consultants, and architects -- who stopped by the Event Server booth last week during BEAWorld in San Francisco.&nbsp; I would like to say "Thanks" to everyone who took time to watch the Event Server demos and ask us questions.<br><br>One question that I heard come up in various forms at the booth was "What is the difference between WebLogic Event Server and WebLogic Server?".&nbsp; Many folks were hearing about the Event Server for the first time and wondered if the Event Server was a layer of software that ran on top of WebLogic Server (WLS) or if it was a special version of WLS. These seemed like very reasonable questions -- after all Complex Event Processing (CEP) is a relatively new area for many people and the Event Server is a new product -- the first version, WebLogic Event Server 2.0, was released in July this year.<br><br>One of my previous blog entries, <a href="http://dev2dev.bea.com/blog/swhite/archive/2007/08/weblogic_event.html">WebLogic Event Server and mSA</a>, &nbsp;touched on these questions somewhat.&nbsp; The Event Server is best thought of as a separate software stack from WLS.&nbsp; The Event Server is based on BEA's mSA architecture, however, so it is a completely modular server whose modules come from different sources, including the open source community.&nbsp; As it happens, one source for the modules that are included in the Event Server is actually WebLogic Server.&nbsp; But wait a minute, I just said that the Event Server was a separate piece of software from WLS, what's going on?<br><br>Some of what's going on is historical.&nbsp; WLS predates mSA.&nbsp; WLS contained a lot of cool stuff though, like JDBC connection pooling, and it made sense to turn those subsystems of WLS into mSA modules and reuse them in products like WebLogic Event Server.&nbsp; So, the Event Server does contain pieces of WLS, but for the most part it's a different piece of software and a different application server.<br><br>There are many other differences between the Event Server (WL EvS) and WebLogic Server (WLS).&nbsp; One is the application programming models that each support.&nbsp; WLS supports J2EE as its primary programming model in addition to frameworks, like Spring, that make using J2EE easier.&nbsp; The Event Server has a programming model that is based on Spring, but the Event Server's programming model extends the basic Spring programming model so that it provides a real-time container for complex event processing.&nbsp; The most obvious extension to Spring is the CEP engine itself.&nbsp; The CEP engine supports a SQL-based query language, called the Event Processing Language (EPL), for filtering, joining, and correlating real-time events.&nbsp; Other extensions to Spring include custom tags for configuring the Event Processing Network (EPN) that makes up an application and dynamic configuration metadata for application components, among others.<br><br>Another thing that differentiates the Event Server and WLS&nbsp;is the types of applications that each application server hosts.&nbsp; Most of the applications today that run on WLS are Web applications that human users interact with using a browser although, to be sure, there are a number of Web service apps and JMS apps also.&nbsp; The Event Server, on the other hand, is an application server for hosting purely event driven applications.&nbsp; Event driven applications are driven by other remote systems that generate events, like trade events from a stock exchange, instead of through human interaction with a browser.&nbsp; The interaction between the Event Server and the systems that supply events is typically one-way, instead of the request-response style of interaction that is common for Web and Web service applications.&nbsp; Event driven applications typically consume events from input sources and publish events or generate actions, such as triggering a BPM workflow, to a different set of output sources.</p> <p>These are the major differences, but there are many additional things that could be mentioned such as the fact that the Event Server is designed for applications that have strict latency requirements.&nbsp; This should be enough to give a general sense of how these two application servers stack up.<br></p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:d5f7ae60-3820-442c-bb50-822891ee5b97" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/WL%20EvS" rel="tag">WL EvS</a>, <a href="http://technorati.com/tags/mSA" rel="tag">mSA</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a>, <a href="http://technorati.com/tags/WLS" rel="tag">WLS</a>, <a href="http://technorati.com/tags/Spring" rel="tag">Spring</a>, <a href="http://technorati.com/tags/EPL" rel="tag">EPL</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>WebLogic Event Server and Distributed Caching</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/09/weblogic_event_4.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/09/weblogic_event_4.html</id>
    
    <published>2007-09-14T04:20:25Z</published>
    <updated>2007-09-14T04:23:11Z</updated>
    
    <summary>There is a white paper available that discusses how to use WebLogic Event Server 2.0 and distributed caching technology together.  A sample application and source code is also available for download.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[I have written a white paper titled "WebLogic Event Server and Distributed Caching".&nbsp; It is available <a href="http://dev2dev.bea.com/pub/a/2007/09/event-server-caching.html">here</a>.&nbsp; The paper gives an overview of the Event Server and event driven applications, so it may be of interest to folks that have a general interest in what WebLogic Event Server is and what kind of applications it is designed to host.&nbsp; The paper also gives a brief overview of distributed caching and describes how distributed caching can be used to provide high availability and increased performance for applications running on the Event Server.<br><br>There is a sample application with source code available with the white paper also.&nbsp; The sample application shows how the Event Server can be used together with the GemFire distributed cache from <a href="http://www.gemstone.com/">GemStone Systems</a>.&nbsp; The last half of the white paper describes the sample application in detail.&nbsp; Some of the other interesting things demonstrated by the sample application (besides things related to caching) include:<br><br> <ol> <li>How to automate generation of the OSGi manifest when packaging an application as a bundle.</li> <li>How to use Spring to inject dependencies into a user-defined function for an <a href="http://edocs.bea.com/wlevs/docs20/epl_guide/overview.html">EPL</a> query.</li> <li>Deploying and undeploying, starting and stopping applications using ant.</li> <li>Using group by in EPL queries.</li> <li>Packaging third-party libraries with an Event Server application.</li> <li>A more complex example of how to extend the configuration system of the Event Server.</li></ol> <p>If you have any questions about the paper or sample application, send them my way.</p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:1cd28630-109b-4c1c-8029-0a72e3bf89a2" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/GemFire" rel="tag">GemFire</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a>, <a href="http://technorati.com/tags/Spring" rel="tag">Spring</a>, <a href="http://technorati.com/tags/EPL" rel="tag">EPL</a>, <a href="http://technorati.com/tags/OSGi" rel="tag">OSGi</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>WebLogic Event Server at BEAWorld</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/09/weblogic_event_3.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/09/weblogic_event_3.html</id>
    
    <published>2007-09-08T04:39:05Z</published>
    <updated>2007-09-08T17:59:51Z</updated>
    
    <summary>Here&apos;s my round up of Event Server related activities going on at BEAWorld, San Francisco this year.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p><a href="http://www.bea.com/beaworld/us/index.jsp?PC=undefined">BEAWorld 2007</a> is taking place next week in San Francisco at the Moscone Center.&nbsp; It's a three day conference this year -- Monday to Wednesday.&nbsp; For those that would like to learn more about the Event Server or meet the Event Server team, there will be a number of opportunities. </p> <p>There are three conference sessions related to the Event Server:</p> <p><a href="https://www.beaworldevents.com/US/catalog/catalog/catalog.jsp">eBay builds high performance applications with BEA and EDA<br></a><a href="https://www.beaworldevents.com/US/catalog/catalog/catalog.jsp">Thomson Financial - Examining the impact of Event Driven Architectures in Financial Services</a><br><a href="https://www.beaworldevents.com/US/catalog/catalog/catalog.jsp">Introduction to Event-Driven SOA</a></p> <p>The "Introduction to Event-Driven SOA" takes place at 2 p.m. on Wednesday, but I'm not sure about the others. I don't see any times listed on the BEAWorld website.</p> <p>There is also a roundtable session</p> <p><a href="https://www.beaworldevents.com/US/catalog/catalog/catalog.jsp">Event-Driven SOA</a></p> <p>In addition to these, the Event Server development team will be hosting a series of Meet the Experts sessions at the BEA Pavilion on the show floor.&nbsp; Here is the schedule for the Meet the Experts sessions:<br><br></p> <table cellspacing="0" cellpadding="2" width="817" border="1" unselectable="on"> <tbody> <tr> <td valign="top" width="136">Day</td> <td valign="top" width="153">Time</td> <td valign="top" width="518">Description</td></tr> <tr> <td valign="top" width="139">Monday</td> <td valign="top" width="153">6:15 p.m.-7:00 p.m.</td> <td valign="top" width="518"> <p>WebLogic Event Server: Eclipse-based Application Development and Monitoring</p></td></tr> <tr> <td valign="top" width="142">Tuesday&nbsp;&nbsp; </td> <td valign="top" width="153">&nbsp;12:30 p.m.-1:15 p.m. </td> <td valign="top" width="518"> <p>Accelerating your BEA WebLogic Event Server Performance/CEP Engines versus Rules Engine</p></td></tr> <tr> <td valign="top" width="143">Tuesday</td> <td valign="top" width="153">1:15 p.m.-2:00 p.m.</td> <td valign="top" width="518"> <p>Event Process Infrastructure/Caching for WebLogic Event Server</p></td></tr> <tr> <td valign="top" width="145">Wednesday</td> <td valign="top" width="153">12:30 p.m.-1:15 p.m.</td> <td valign="top" width="518"> <p>WebLogic Event Server Interaction with other BEA products/Time and Event Driven Products:&nbsp; Core Topics</p></td></tr> <tr> <td valign="top" width="146">Wednesday</td> <td valign="top" width="153">1:15 p.m.-2:00 p.m.</td> <td valign="top" width="518"> <p>Managing and Configuring BEA's WebLogic Event Server</p></td></tr> <tr> <td valign="top" width="147">Wednesday</td> <td valign="top" width="153">1:15 p.m.-2:00 p.m.</td> <td valign="top" width="518"> <p>Time and Event Driven Products:&nbsp; Use Cases</p></td></tr></tbody></table> <p>&nbsp;  <p>I will be hosting the Meet the Experts session on Tuesday at 1:15.  <p>The members of the development team will also be staffing the Event Server booth from 12-6 on Tuesday and Wednesday.&nbsp; If you are interested, stop by and take a look at the demos that we will have running and hear about the latest performance results for the Event Server---they are pretty amazing.&nbsp;</p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:caea907a-a733-4c84-9b35-d31ce8ea61b5" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a>, <a href="http://technorati.com/tags/EDA" rel="tag">EDA</a>, <a href="http://technorati.com/tags/SOA" rel="tag">SOA</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>Troubleshooting the WLEvS application component lifecycle</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/08/troubleshooting.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/08/troubleshooting.html</id>
    
    <published>2007-09-01T03:31:25Z</published>
    <updated>2007-09-05T17:10:18Z</updated>
    
    <summary>There are times when a programming or configuration error can prevent a component lifecycle method from being invoked. This entry discusses some of these situations and what can be done to avoid them.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>In this post I discuss some of the things that can prevent a component's lifecycle methods from being called by the container.&nbsp; I'll bet that others have run into this -- you've written your component, carefully coded some interesting logic in a lifecycle method, but when you deploy your application nothing happens because the lifecycle method isn't called.&nbsp; This can be a source of frustration, but hopefully this post will give you the knowledge you need to fix the problem.<br><br>If your component has dynamic configuration metadata, then you will have component methods annotated with the @Prepare, @Activate,&nbsp;and @Rollback annotations.&nbsp; One condition that can prevent these methods from being called is if the id of the component in the Spring application context does not match the value of the name element for the component in the&nbsp; dynamic configuration file.&nbsp; You will have metadata for the component in both places since Spring is used to instantiate and wire the component into the application, while the dynamic metadata for the component is kept in an external configuration file so that it is more easily updatable.</p> <p>For example, if you have the following Spring component definition:</p><pre class="csharpcode">&lt;bean id=<span class="str">"cache"</span>
        <span class="kwrd">class</span>=<span class="str">"com.bea.wlevs.example.caching.gemfire.GemfireCache"</span>
        destroy-method=<span class="str">"destroy"</span>&gt;
&lt;/bean&gt; </pre>
<p><font face="Courier New" size="2">t</font>hen the XML in the dynamic configuration file for this component must look something like this:</p><pre class="csharpcode">&lt;cache-system&gt;
        &lt;name&gt;cache&lt;/name&gt;
        &lt;multi-cast-port&gt;0&lt;/multi-cast-port&gt;
        &lt;locators&gt;localhost[10987]&lt;/locators&gt;
        ...
&lt;/cache-system&gt;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>Note that the name and id values must match exactly and are case-sensitive.&nbsp; If they do not match then the container won't realize that the dynamic metadata should be injected into the Spring "cache"  component and the prepare, activate, and rollback methods will not be called.</p>
<p>Another thing to make sure of when your component has dynamic configuration, is that the component implements the com.bea.wlevs.ede.api.Stage interface.&nbsp; This is a marker interface that the container uses to identify Spring beans that are part of an event processing network -- a stage in the network essentially.&nbsp; If your bean doesn't implement this interface, then it won't get Prepare, Activate, or Rollback callbacks.&nbsp; It's okay if your component isn't really a stage, but just a regular Spring bean.&nbsp; Implementing this interface will allow your bean to get the lifecycle callbacks. </p>
<p>Another problem that I have run into occurred when I wanted a Pojo component to receive a DisposableBean.destroy callback.&nbsp;  </p>
<p>&nbsp;</p><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> GemfireCache implements Cache, DisposableBean, Stage {

<span class="kwrd">public</span> <span class="kwrd">void</span> destroy() throws Exception {
        <span class="kwrd">if</span> (initialized) {
            cache.close();
            distributedSystem.disconnect();
            initialized = <span class="kwrd">false</span>;
        }
    }
...
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>My Pojo  needed to do this because it had allocated a cache resource when it was initialized and it needed to clean up when the application was undeployed/uninstalled.&nbsp; For some reason, the container just wouldn't call this method for me unless I included a destroy-method attribute in the Spring configuration for the bean, as you see in the Spring bean definition that I included earlier in this entry. This may have been due to something peculiar in my application, but if you run into this problem you may want to give the solution a try.</p>
<p>I'd like to mention just one more thing that I have run into.&nbsp; If you have a component A that references another component B, and the referenced component B uses dynamic configuration, make sure that you don't invoke any of the methods on component B until it has reached the afterConfigurationActive stage of its lifecycle.&nbsp; </p>
<p>This rule has&nbsp;a couple&nbsp;implications.&nbsp;&nbsp; Of course, it means that component A cannot call methods on component B from A's constructor, setter,&nbsp; afterPropertiesSet, Prepare, Activate, or Rollback lifecycle methods.&nbsp; It also means that&nbsp;component B cannot be a Spring factory bean, because Spring will attempt to invoke methods on the factory bean before it has reached the afterConfigurationActive lifecycle stage. </p>
<p>Well, that wraps up&nbsp;my list of the top lifecycle issues that I have run into.&nbsp; If you have run into some additional gotchas, I would like to hear about them!</p>
<p>
<div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:33f75a60-7ef8-4663-84d5-0a8a23d6a36b" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/Spring" rel="tag">Spring</a>, <a href="http://technorati.com/tags/Spring-OSGi" rel="tag">Spring-OSGi</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a></div><br></p><pre class="csharpcode">&nbsp;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>]]>
        
    </content>
</entry>
<entry>
    <title>More on the lifecycle of Event Server components</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/08/more_on_the_lif.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/08/more_on_the_lif.html</id>
    
    <published>2007-08-28T19:46:08Z</published>
    <updated>2007-09-05T17:09:45Z</updated>
    
    <summary>In this post I look at making a dynamic configuration change to an Event Server component and show the lifecycle methods that are called.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>In my last post I began talking about the lifecycle of <a href="http://dev2dev.bea.com/wlevent/">Event Server</a> application components and about how dynamic changes to component metadata impact the lifecycle.&nbsp; I didn't get a chance to actually illustrate dynamic changes, however, so I would like to go into that here.<br><br> It's actually pretty easy to make a dynamic change to an Event Server component.&nbsp; The Event Server exposes a configuration mbean for every component that has dynamic configuration metadata, so the first step is to connect to the Event Server using a <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">JMX</a> client.&nbsp; I often use <a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html">jconsole</a> for making simple changes.&nbsp; After starting the Event Server in the usual way, start jconsole in a separate window. In the Connection dialog box select the Remote tab and enter the JMX port for the server, along with the hostname.&nbsp; If you're not sure about the port, look in your server configuration file which is here: &lt;domain home&gt;/config/config.XML.&nbsp; In the configuration file you should see a JMX element that looks something like this:</p> <p>&nbsp;</p><pre class="csharpcode">&lt;jmx&gt;
    &lt;jndi-service-name&gt;JNDI&lt;/jndi-service-name&gt;
    &lt;rmi-service-name&gt;RMI&lt;/rmi-service-name&gt;
    &lt;rmi-registry-port&gt;1099&lt;/rmi-registry-port&gt;
    &lt;rmi-jrmp-port&gt;9999&lt;/rmi-jrmp-port&gt;
&lt;/jmx&gt; <br><br><br></pre>
<p>In this example, the port to use in jconsole is 1099.</p><pre class="csharpcode">&nbsp;</pre><pre class="csharpcode"><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/MoreonthelifecycleofEventServercomponent_A63B/image_1.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="230" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/MoreonthelifecycleofEventServercomponent_A63B/image_thumb_1.png" width="352" border="0"></a> </pre>
<p>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</p>
<p>Click Connect.&nbsp; Once you are connected, navigate to the mBean that you want to invoke.&nbsp;  In this example, I will invoke an operation on the mBean that represents my <a href="http://www.gemstone.com/">Gemfire</a> distributed cache configuration in order to change the lock timeout for the cache.</p>
<p>&nbsp;</p>
<p><a href="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/MoreonthelifecycleofEventServercomponent_A63B/image_2.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="614" alt="image" src="http://dev2dev.bea.com/blog/swhite/WindowsLiveWriter/MoreonthelifecycleofEventServercomponent_A63B/image_thumb_2.png" width="739" border="0"></a> </p>
<p>Here I have typed in a new value of 15 seconds for the timeout. Then I just click on the operation button to invoke the mBean.&nbsp; Now if I look in my Event Server console window I see that the following has been printed.</p>
<p>&nbsp;</p><pre class="csharpcode">----------------------------------prepare called.
----------------------------------activate called.</pre><pre class="csharpcode">&nbsp;</pre>
<p>So, we see that the prepare and activate methods have been called in order to update my caching component with its new configuration.&nbsp; The caching component validates the new timeout value in the prepare method and then updates the cache during activate.&nbsp; My previous post shows the code for the prepare and activate methods, so take a look at there if you want to see the code.&nbsp; It is possible to do any number of dynamic configuration updates to an application component while an Event Server application is running.</p>
<div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:40766764-6197-420e-ab68-098a4564e870" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/Gemfire" rel="tag">Gemfire</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a>, <a href="http://technorati.com/tags/JMX" rel="tag">JMX</a></div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>]]>
        
    </content>
</entry>
<entry>
    <title>WebLogic Event Server application components</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/08/weblogic_event_2.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/08/weblogic_event_2.html</id>
    
    <published>2007-08-23T19:40:04Z</published>
    <updated>2007-09-05T17:09:12Z</updated>
    
    <summary>WebLogic Event Server application components can respond to dynamic changes in their configuration metadata.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>A WebLogic Event Server application is essentially a network of application components that form an event processing network.&nbsp; An application component can be an Adapter, Stream, Processor, or user-written bean. Application components are wired together using Spring.  <p>One of the interesting things about Event Server components is their lifecycle. Event Server components are <a href="http://www.springframework.org/">Spring</a> beans, so they support all of the lifecycle methods that regular Spring beans support. However, Event Server components also provide additional lifecycle methods for dynamically injecting changes made to their configuration metadata while they are running.&nbsp;  <p>How is this different from other component models?&nbsp; Consider Spring or <a href="http://java.sun.com/products/ejb/">EJB 3.0</a>. These each&nbsp;inject a component with its metadata once, when the component is being initialized.&nbsp; After the component is up and running, dependency injection is finished.&nbsp; If the configuration metadata for an Event Server component is changed while the application is running, however,&nbsp;the real-time container will notify the component of the changes. The configuration metadata can be reinjected into a component any number of times, essentially, while the component is running.  <p>There are some component frameworks, like <a href="http://www.jboss.com/products/seam">Seam</a>, which also perform dependency injection at runtime.&nbsp; Seam uses the term bijection for this.&nbsp; The Event Server uses dynamic injection differently than Seam, however.&nbsp; For example, dynamic configuration data for Event Server components is persistent and changes to the configuration data are transactional, and the data that is injected&nbsp;is component metadata.&nbsp; Seam, on the other hand, uses dynamic injection as an alternative to passing method parameters&nbsp;to and returning results from&nbsp;the business methods of a component.&nbsp; Thus, the data being injected is not typically persistent or transactional, or part of the component's configuration. <p>Let's look at some sample code to illustrate what's been said. </p><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> CacheFacade implements InitializingBean, ActivatableBean,
        SuspendableBean, DisposableBean, Stage {

    <span class="kwrd">private</span> Cache cache;

    <span class="kwrd">public</span> CacheFacade() {
        System.<span class="kwrd">out</span>
                .println(<span class="str">"-------------------------------constructor called."</span>);
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> setCache(Cache cache) {
        System.<span class="kwrd">out</span>.println(<span class="str">"-------------------------------setCache called."</span>);
        <span class="kwrd">this</span>.cache = cache;
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> afterPropertiesSet() {
        System.<span class="kwrd">out</span>.println(<span class="str">"-------------------------------afterPropertiesSet called."</span>);
    }

    @Prepare
    <span class="kwrd">public</span> <span class="kwrd">void</span> prepare(CacheConfig configuration) {
        System.<span class="kwrd">out</span>
                .println(<span class="str">"----------------------------------prepare called"</span>);
        <span class="kwrd">if</span> (configuration.isSetLockTimeout()
                &amp;&amp; configuration.getLockTimeout().intValue() &lt; 0) {
            <span class="kwrd">throw</span> <span class="kwrd">new</span> RuntimeException(<span class="str">"lock timeout cannot be negative: "</span>
                    + configuration.getLockTimeout().intValue());
        }
    }

    @Activate
    <span class="kwrd">public</span> <span class="kwrd">void</span> activate(CacheConfig configuration) {
        System.<span class="kwrd">out</span>
                .println(<span class="str">"----------------------------------activate called"</span>);
        cache.setLockTimeout(configuration.getLockTimeout().intValue());
    }

    @Rollback
    <span class="kwrd">public</span> <span class="kwrd">void</span> rollback(CacheConfig configuration) {
        System.<span class="kwrd">out</span>.println(<span class="str">"----------------------------------rollback called"</span>);
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> afterConfigurationActive() {
        System.<span class="kwrd">out</span>
                .println(<span class="str">"-------------------------------afterConfigurationActive called."</span>);
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> suspend() {
        System.<span class="kwrd">out</span>.println(<span class="str">"-------------------------------suspend called."</span>);
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> destroy() throws Exception {
        System.<span class="kwrd">out</span>.println(<span class="str">"-------------------------------destroy called."</span>);
        cache.close();
    }

    Map getMap(String name) {
        <span class="kwrd">return</span> cache.getRegion(name);
    }    
}</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>&nbsp;</p>
<p>This is a bean from a sample application that I have been working on. Its purpose is to provide a thin facade on top of a Gemfire  distributed cache, but I have added a complete set of lifecycle methods to illustrate the component lifecycle. Here is what the Spring configuration for this component looks like.</p>
<p>&nbsp;</p><pre class="csharpcode">&lt;bean id=<span class="str">"cacheFacade"</span>
        <span class="kwrd">class</span>=<span class="str">"com.bea.wlevs.example.caching.cache.CacheFacade"</span> 
        destroy-method=<span class="str">"destroy"</span> init-method=<span class="str">"afterPropertiesSet"</span>&gt;
    &lt;property name="cache"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class="kwrd">ref</span> bean=<span class="str">"gemFireCache"</span> /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/property&gt;<br>&lt;/bean&gt;</pre><pre class="csharpcode">&nbsp;</pre>
<p>When I deploy my application, the cacheFacade bean prints the following output. </p><pre class="csharpcode">&nbsp;</pre><pre class="csharpcode">-------------------------------constructor called.
-------------------------------setCache called.
-------------------------------afterPropertiesSet called.
----------------------------------prepare called
----------------------------------activate called
-------------------------------afterConfigurationActive called.</pre><pre class="csharpcode">&nbsp;</pre>
<p>After the constructor is called, the static Spring properties are injected.&nbsp; In this case there is just one static property named "cache".&nbsp; Once the static properties are injected, the Spring initialize method is called.&nbsp; Next, the dynamic metadata for the component is injected by calling the prepare and activate methods (I will discuss these more in a future post.)&nbsp; Finally, the afterConfigurationActive method is called.&nbsp; This gives the component a chance to do some final initialization after all dynamic configuration has been set for the application (including other application components).</p>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p></p>
<p>When the application is undeployed, the cacheFacade bean prints the following.</p><pre class="csharpcode">&nbsp;</pre><pre class="csharpcode">-------------------------------suspend called.
-------------------------------destroy called.</pre><pre class="csharpcode">&nbsp;</pre>
<p>The component uses the destroy lifecycle method callback to close the Gemfire cache, thus integrating the distributed cache into the lifecycle of the application.</p>
<div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:077b98b9-67ff-438f-b431-f6e82f017181" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/Spring" rel="tag">Spring</a>, <a href="http://technorati.com/tags/Seam" rel="tag">Seam</a>, <a href="http://technorati.com/tags/EJB3.0" rel="tag">EJB3.0</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a></div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>]]>
        
    </content>
</entry>
<entry>
    <title>WebLogic Event Server Applications Are Bundles Too</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/08/weblogic_event_1.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/08/weblogic_event_1.html</id>
    
    <published>2007-08-18T01:18:35Z</published>
    <updated>2007-09-05T17:07:50Z</updated>
    
    <summary>The WebLogic Event Server is composed of a set of OSGi bundles, but in addition to server modules, applications are packaged as OSGi bundles too.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<p>In my previous entry I discussed the Event Server's modular architecture and explained that each system module -- from the adapter framework to the JMX management layer -- is packaged as an <a href="http://www.osgi.org/">OSGi</a> bundle.&nbsp; One of the neat things about the Event Server is that applications that developers write for the server are also packaged as an OSGi bundle.&nbsp; This allows for a very uniform server architecture, especially in terms of classloading, but it raises an interesting question, namely, what's the best way for a developer to create the OSGi bundle that contains their application? The answer to this question depends a lot on the build tool being used.&nbsp; Most Java developers use <a href="http://ant.apache.org/">ant</a> today, of course, although <a href="http://maven.apache.org/">maven</a> is an interesting alternative.&nbsp; I've tried maven, but haven't been completely won over (yet -- but I would like to be).&nbsp; I'll stick to talking about ant since that's still what is most common.&nbsp; </p> <p>Ant doesn't have built-in support for creating OSGi bundles the way it does for jar, war, and ear files. Maybe you're thinking, "Hey, OSGi bundles are just fancy jar files, so why not use the jar task?".&nbsp; This is the approach taken by the sample applications that  are part of the Event Server 2.0 release.&nbsp; Take a look at the build.xml file for the helloworld sample application to see exactly how this works.&nbsp; &nbsp;The main drawback of doing things this way is having to maintain the manifest file by hand.&nbsp; (Note that I'm assuming we are not using some other tool, like an IDE, that helps with maintaining the manifest for now, just plain ant.)&nbsp; For example, if you decide to implement your own adapter, you will likely start by adding some code to your project that looks like this:</p><pre class="csharpcode">import com.bea.wlevs.ede.api.Adapter;

<span class="kwrd">public</span> <span class="kwrd">class </span>MyAdapter implements Runnable, Adapter {
...
}</pre>Notice that the MyAdapter class imports the com.bea.wlevs.ede.api.Adapter interface.&nbsp; Now, since the interface that is being imported by MyAdapter is contained in a separate bundle -- the Event Server's com.bea.wlevs.ede.api bundle in this case -- the application bundle will  itself need to import the package containing the interface. This is done by placing an entry like the following in the manifest file for the application bundle:<br><pre class="csharpcode">Import-Package:
    com.bea.wlevs.ede.api;version=<span class="str">"2.0.0.0"</span></pre>
<p>Managing these double imports, importing the class and importing the package, can become quite tedious. Fortunately, the OSGi community has been faced with the problem of easily creating bundles for awhile and there are some tools available that can make things easier when using ant.&nbsp; One that I have been using is the <a href="http://www.aqute.biz/Code/Bnd">bnd</a> tool which was written by Peter Kriens.  (Bnd was previously called Btool.)  Here is the&nbsp;task from a sample application that I have been writing that  uses bnd to create&nbsp;the application bundle:  &nbsp;</p><pre class="csharpcode">&lt;target name=<span class="str">"dist"</span>&gt;
        &lt;taskdef resource=<span class="str">"aQute/bnd/ant/taskdef.properties"</span>
                 classpath=<span class="str">"lib/bnd-0.0.177.zip"</span> /&gt;

        &lt;bnd classpath=<span class="str">"${output.dir}"</span>
             eclipse=<span class="str">"false"</span>
             failok=<span class="str">"false"</span>
             exceptions=<span class="str">"true"</span>
             files=<span class="str">"example.bnd"</span>
             output=<span class="str">"${dist.dir}/${bundle.file.name}"</span> /&gt;
&lt;/target&gt;</pre>
<p>You can see from the taskdef element that I have downloaded the bnd zip file and placed it in the lib directory of my project.&nbsp; The classpath attribute of the bnd task is set to the output directory where my compiled Java classes are located.&nbsp; The compiled classes together with the example.bnd file constitute&nbsp; the input to bnd which it uses to generate its output, in this case my application bundle.&nbsp; Here is what my example.bnd file looks like:</p><pre class="csharpcode">Export-Package: com.bea.wlevs.example.event
Import-Package: javax.xml.bind;version=<span class="str">"2.0"</span>,\
javax.xml.bind.annotation;version=2.0,\
javax.xml.bind.annotation.adapters;version=2.0,\
javax.xml.bind.attachment;version=2.0,\
javax.xml.bind.helpers;version=2.0,\
javax.xml.bind.util;version=2.0,\
com.bea.wlevs.configuration;version=<span class="str">"2.0.0.0"</span>,\
com.bea.wlevs.configuration.application;version=<span class="str">"2.0.0.0"</span>,\
com.sun.xml.bind.v2;version=<span class="str">"2.0.2"</span>,\
*;resolution:=optional
Private-Package: com.bea.wlevs.example.*
Include-Resource: META-INF/spring=src/main/resources/META-INF/spring,\
META-INF/wlevs=src/main/resources/META-INF/wlevs
Bundle-SymbolicName: myexample<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style></pre>
<p>It's important to export the package containing the application's event classes so that server bundles -- like the EPL bundle -- can use them.&nbsp; It's a best practice to always put the event classes in their own package, hence the single entry in the Export-Package section.&nbsp; 
<p>I'm planning to have a&nbsp; custom extension to the XML configuration for my application which is the reason for the JAXB imports.&nbsp; The configuration extension feature of the Event Server uses JAXB.&nbsp; This is an advanced feature which not every application needs to use.&nbsp; In my case, I wouldn't have required any entries in the Import-Package section if I wasn't creating custom configuration. 
<p>The Private-Package section lists all of the classes for my sample since they need to be included in the application bundle.&nbsp; The Include-Resource section&nbsp;pulls in my spring application context file and event server configuration files into the application bundle.
<p>I have found&nbsp;bnd to be a useful tool.&nbsp; If you&nbsp;try it&nbsp;with your own Event Server applications, let me know what you think. I should note that there is another tool called <a href="http://oscar-osgi.sourceforge.net/mangen/">mangen</a> for generating bundle manifests which I have not yet tried.&nbsp; Developers using maven may also want to try the maven OSGi plug-in.&nbsp; IDEs, like Eclipse, also have support for maintaining the OSGi manifest.&nbsp; I will try to post about my experiences using Eclipse in the future.</p>
<div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:b8b2327e-3ea0-4749-aa22-e8da9d38d217" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/OSGi" rel="tag">OSGi</a>, <a href="http://technorati.com/tags/bnd" rel="tag">bnd</a>, <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a></div>]]>
        
    </content>
</entry>
<entry>
    <title>WebLogic Event Server and mSA</title>
    <link rel="alternate" type="text/html" href="http://dev2dev.bea.com/blog/swhite/archive/2007/08/weblogic_event.html" />
    <id>http://dev2dev.bea.com/blog/swhite/archive/2007/08/weblogic_event.html</id>
    
    <published>2007-08-16T19:49:15Z</published>
    <updated>2007-08-16T19:49:27Z</updated>
    
    <summary>WebLogic Event Server is a modular application server for event processing applications that leverages OSGi.</summary>
    <author>
        <name>swhite</name>
        
    </author>
            <category term="Product: WebLogic Event Server" />
    
    <content type="html" xml:lang="" xml:base="http://dev2dev.bea.com/blog/swhite/">
        <![CDATA[<div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:db474e65-4b3d-49c5-8fe4-d82d4f427f2b" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/OSGi" rel="tag">OSGi</a>, <a href="http://technorati.com/tags/mSA" rel="tag">mSA</a>, <a href="http://technorati.com/tags/WLEvS" rel="tag">WLEvS</a>, <a href="http://technorati.com/tags/CEP" rel="tag">CEP</a></div> <p>I joined the <a href="http://dev2dev.bea.com/wlevent/">WebLogic Event Server</a> (WLEvS) team in January this year.&nbsp; One thing that got me interested in working as a developer on the Event Server was that it was the first product to be built using BEA's new <a href="http://www.bea.com/framework.jsp?CNT=msa.jsp&amp;FP=/content/">microService Architecture</a> (mSA).&nbsp; This is what makes the Event Server a "modular" application server. Now, mSA is based on <a href="http://www.osgi.org/">OSGi</a>, so an Event Server module is really just an OSGi bundle.&nbsp; In fact, every bit of code in the Event Server is packaged as an OSGi&nbsp;bundle making it a completely modular server.&nbsp; <br><br>Some bundles that make up the Event Server are specific to the Event Server, of course.&nbsp; These are the bundles that were built by the Event Server development team.&nbsp; If you download and install the <a href="http://commerce.bea.com/showproduct.jsp?family=WLEVS&amp;major=2.0&amp;minor=0">Event Server 2.0 release</a> -- the 2.0 release is actually the first release -- you will find these bundles in the wlevs/modules directory under your BEA_HOME directory.&nbsp; The Event Server bundles all have names like com.bea.wlevs.&lt;module specific name&gt;_2.0.0.0.jar.&nbsp; You can tell from the jar file names that the fourteen Event Server bundles include bundles for things like the adapter framework, the CEP engine, the deployment subsystem, the JMX management layer, Spring custom tags and other related Spring classes, among others.</p> <p>The Event Server also relies on a set of generic bundles that are part of mSA, but that are not specific to the Event Server.&nbsp; You will find these bundles in the modules directory under your BEA_HOME directory.&nbsp; The mSA bundles include bundles that were written by the mSA development team, bundles harvested from existing BEA products (like WebLogic Server), and bundles from the open source community.&nbsp; One of the core ideas of mSA is that mSA bundles can be reused across many BEA products.&nbsp; If you have only installed in the Event Server then you will only see the mSA bundles required by the Event Server in the modules directory.&nbsp; I count 141 mSA bundles in this release of the Event Server -- that's a lot of bundles!&nbsp;</p> <p>It&nbsp;says a lot about the underlying OSG backplane that it is able to quickly and efficiently load all of the bundles when the server starts.&nbsp;By the way, the&nbsp;mSA uses the <a href="http://www.eclipse.org/equinox/">Equinox</a> OSGi implementation from the Eclipse project.&nbsp; Having a large number of relatively fine-grained bundles helps to keep the footprint of the Event Server small since only the code that the Event Server needs is loaded into memory.&nbsp; If you take a close look at the names of the mSA bundles you will see that there are several bundles that comprise the Spring framework. There is also a bundle for the Jetty web server.&nbsp; An example of a bundle that was harvested from WebLogic Server is the com.bea.core.datasource bundle which contains the connection pooling implementation from WLS.&nbsp; The fact that the Event Server leverages a number of bundles from mature projects like WLS and Spring should help to make it a more solid platform.</p>]]>
        
    </content>
</entry>

</feed> 