<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Musings of a Trained Monkey: Jetty and WebLogic JNDI sitting in a tree...</title>
    <link>http://www.stevelongdo.com/articles/2007/05/17/jetty-and-weblogic-jndi-sitting-in-a-tree</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Jetty and WebLogic JNDI sitting in a tree...</title>
      <description>I am a huge fan of &lt;a href="http://jetty.mortbay.org/"&gt;Jetty&lt;/a&gt; for Java web application development.  Love how fast it loads, reloads, and generally kicks the crap out of Tomcat.  The &lt;a href="http://jetty.mortbay.org/"&gt;Jetty team&lt;/a&gt; seems to follow the &lt;strong&gt;&lt;span class="caps"&gt;JEE&lt;/span&gt;&lt;/strong&gt; specifications that they do implement (not all of them) much more strictly than Tomcat.  This makes it a very good testbed for developing applications that will be eventually hosted on &lt;a href="http://bea.com/framework.jsp?CNT=index.htm&amp;#38;FP=/content/products/weblogic/server/"&gt;WebLogic Server&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;Until you need to do something like run &lt;strong&gt;Message Driven Beans&lt;/strong&gt; with &lt;strong&gt;&lt;span class="caps"&gt;WLS&lt;/span&gt;&lt;/strong&gt; special performance enhancing sauce.  &lt;a href="http://jetty.mortbay.org/"&gt;Jetty&lt;/a&gt; has it&amp;#8217;s jetty-plus configuration which supports &lt;strong&gt;&lt;span class="caps"&gt;JNDI&lt;/span&gt;&lt;/strong&gt; and some other &lt;strong&gt;&lt;span class="caps"&gt;JEE&lt;/span&gt;&lt;/strong&gt; niceties. If you really want to use the full on &lt;strong&gt;&lt;span class="caps"&gt;BEA JMS&lt;/span&gt;/MDB&lt;/strong&gt; combo though you have a problem.&lt;br /&gt;&lt;br /&gt;Including the &lt;strong&gt;weblogic.jar&lt;/strong&gt; in &lt;a href="http://jetty.mortbay.org/"&gt;Jetty&amp;#8217;s&lt;/a&gt; classpath is not the answer.  This will cause all sorts of confusion about which implementations of &lt;strong&gt;java.&lt;/strong&gt; * and &lt;strong&gt;javax.&lt;/strong&gt; * packages to use.  Within the &lt;a href="http://bea.com/framework.jsp?CNT=index.htm&amp;#38;FP=/content/products/weblogic/server/"&gt;WebLogic Server&lt;/a&gt; distribution&amp;#8217;s server/lib directory there is a &lt;strong&gt;wlclient.jar&lt;/strong&gt;.  Again this won&amp;#8217;t work right in your overall classpath, but it will work if you put the &lt;strong&gt;wlclient.jar&lt;/strong&gt; inside of a webapp&amp;#8217;s &lt;span class="caps"&gt;WEB&lt;/span&gt;-INF/lib directory. Your code will just need to make a small accommodation for connecting to &lt;strong&gt;&lt;span class="caps"&gt;WLS JNDI&lt;/span&gt;&lt;/strong&gt; constructing the &lt;code&gt;InitialContext&lt;/code&gt; with the WebLogic specific properties:
&lt;pre&gt;&lt;code&gt;
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL, "t3://localhost:7001");
    InitialContext ctx = null;
  try{
      InitialContext ctx = new InitialContext(props);
       (...Lookup JMS Queues, place Messages, etc...)
  } catch (Exception e) {
     (do something!)
  } finally {
       try{ ctx.close() } catch (Exception e) { (eek! just have to eat this one!)}
  }
&lt;/code&gt;&lt;/pre&gt;
This gives you the flexibility of using &lt;a href="http://jetty.mortbay.org/"&gt;Jetty&lt;/a&gt; configured &lt;strong&gt;&lt;span class="caps"&gt;JNDI&lt;/span&gt;&lt;/strong&gt; objects as well as leveraging WebLogic &lt;strong&gt;&lt;span class="caps"&gt;JNDI&lt;/span&gt;&lt;/strong&gt; objects without having to eat huge WebLogic redeployment startup times for your web application.</description>
      <pubDate>Thu, 17 May 2007 04:26:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d836dfeb-7d70-4341-9e6c-18d4438012c5</guid>
      <author>Steve Longdo</author>
      <link>http://www.stevelongdo.com/articles/2007/05/17/jetty-and-weblogic-jndi-sitting-in-a-tree</link>
      <category>jetty</category>
      <category>weblogic</category>
      <category>java</category>
    </item>
  </channel>
</rss>
