<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2009-02-24T12:24:16Z</created-at>
  <description></description>
  <id type="integer">912</id>
  <name>Home</name>
  <number type="integer">49</number>
  <person-id type="integer">2802</person-id>
  <text>= [[image: wembed.gif]] The embedded container launcher =
Wembed is a tiny utility that encapsulates servlet containers that can be embedded so they can be used more easily to test web applications. 
The idea is to allow developers to test web applications with different containers just by doing some small configuration changes, and  also allowing them to be able to use those embedded containers in automatic tests with [http://ant.apache.org/ Ant].

== [[image: contents.png]] Documentation index ==
* [[image: agt_runit.png]] [[#quickstart| Quickstart]]
* [[image: ark.png ]] [[#step|Step by step installation]]
* [[image: player_play.png ]] [[#running|Running YOUR web application with Wembed]]
* [[image: mymac.png]] [[#showcase|Showcasing your web application with different containers]]
* [[image: testbed_protocol.png]] [[ AntHtmlUnit | Using Wembed inside Ant to perform JUnit tests]]

&lt;span id=&quot;quickstart&quot; /&gt;
== [[image: agt_runit.png]]Quickstart ==
* You need to have Java 6 properly installed.
* Go to the [http://kenai.com/projects/wembed/downloads downloads section] and grab the Wembed standalone release.
* Unpack the zip file to the directory of your liking.
* Edit bin/server.properties and set the '''base property''' to the directory where you have your web application deployed.
* Edit bin/server.properties and set the '''extra property''' to the directory where you have the extra jar files that your application requires and are usually provided by the container.
* Move to the bin directory and execute '''java -jar bin\Wembed-server.jar''', or if you have the .jar files correctly associated, simply double-click on '''bin\Wembed-server.jar'''.
* Go to [http://localhost:8080/] to see your application up &amp; running.

&lt;span id=&quot;step&quot; /&gt;
== [[image: ark.png ]]Step by step installation ==
The first thing to do is to download Wembed from the [http://kenai.com/projects/wembed/downloads downloads section]. Let's suppose you grab the .zip version (Wembed_XX_standalone), download it and uncompress it in a folder.
* You need to have Java 6 installed and properly configured. To verify open a command window and type '''java -version''', you should see something like:

 &gt; java -version
 java version &quot;1.6.0_11&quot;
 Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
 Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

* Once you have Java 6 properly set up, open a command window and move to the directory where you just uncompressed Wembed. Then type '''java -jar bin\Wembed-server.jar'''. That's it!
After a brief splash screen, you should see a window open like this one:

[[image: Wembed-GUI-sample.gif ]]

You can then go and check the URL where the default web application is deployed (by default [http://localhost:8080/]) If everything went fine, you should see a page with the simple message &#8220;Hello wembed!&#8221;. If you want, you can also make sure that the datasources are also working fine by accessing the page [http://localhost:8080/jdbc.jsp]. There you should see a list of four items ordered alphabetically, which are the result of running a query against an embedded HSQL database, accessed through a container managed data source.

If anything goes wrong, push the button &#8220;Console Show/Hide&#8221; of the GUI and you will be able to see the server logs to find out what went wrong.

&lt;span id=&quot;running&quot; /&gt;
= [[image: player_play.png ]] Running YOUR web application with Wembed =
By default, Wembed mounts as a web application the folder called web at the installation directory. But don't worry, in order to use it with your own application, you don't need to copy your application in that folder, you just need to edit the bin/server.properties file and configure the '''base property''' to point to the directory where your web application has been deployed.
So, for example, if your applications is deployed at the directory  ''/home/me/Apps/MyWebApp'', simply configure the property like this:
 # Default is ./web
 # base=./web
 base=/home/me/Apps/MyWebApp
 ...
Run the Wembed-server.jar again and you should see your application up &amp; running it. Note that you can also do it through the command line, setting the base as a System property, like this:
  java -Dbase=/home/me/Apps/MyWebApp -jar Wembed-server.jar

'''Warning:''': The embedded containers included with Wembed come with a very basic set of dependencies, enough to compile JSP pages, create a DataSource and access it through JNDI. So if you start your application and see various ''ClassNotFoundException'', that's normal :). That's what the '''extra property''' is for. This setting configures a directory where you will be putting the ''extra'' .jar libraries that your application requires but are not included with it because they are usually shipped with the servlet container.

&lt;span id=&quot;showcase&quot; /&gt;
== [[image: mymac.png]] Showcasing your web application with different containers ==
Wembed provides encapsulates the embedded servlet container implementation so you can test you application with different containers. Wembed ships currently with two implementations:
* '''JettyEmbeddedContainer''', using [http://www.mortbay.org/jetty/ Jetty 6.1.7] as embedded container.
* '''TomcatEmbeddedContainer''', using [http://tomcat.apache.org/ Tomcat 5.5] as embedded container.
By default, Wembed uses the first container implementation that is found in the bin directory (of the lib-XXX form), so if you don't install one of them, it will automatically use the other. But if you want to choose specifically which container to use, you simply need to specify the '''container property''' to the name of the implementation you want to use. You can do it either through the '''server.properties''' file:

  # Default is the first one that appears in the classpath
  #container=jetty
  #container=tomcat
  container=XXX
  ...
or setting the container system property when you execute the .jar file, like this:
  java -Dcontainer=XXX -jar Wembed-server.jar
Other containers such as [http://www.caucho.com/ Caucho Resin] have been tested and have a WIP implementation, and others are planned for when the servlet containers implement the proper hooks.

== other interesting things to check ==
* [[image: testbed_protocol.png]] [[ AntHtmlUnit | Using Wembed inside Ant to perform JUnit tests]]
* [[image: agt_utilities.png ]] Modifying the Wembed configuration
* [[image: agt_softwareD.png ]] Building Wembed from the source

=== Supported embedded containers ===
The list of containers that are currently supported by Wembed are the following:
* [http://www.mortbay.org/jetty/ Jetty 6.1.7]: Included with Wembed
* [http://tomcat.apache.org/tomcat-5.5-doc/ Tomcat 5.5]: Included with Wembed

Some other containers that are being tested or ''in the works''
* [http://kenai.com/jira/browse/WEMBED-3 WEMBED-3] -&gt; [http://www.caucho.com/ Caucho Resin]: Implementation almost ready with Resin 4.0. The tests are all green, and the remaining issues are simply facilitating deployment and usage.
* [http://kenai.com/jira/browse/WEMBED-10 WEMBED-10] -&gt; [https://embedded-glassfish.dev.java.net/ Embedded GlassFish v3]: GlassFish v3 itself is in beta and the embedded version is missing some basic features.
* [http://kenai.com/jira/browse/WEMBED-11 WEMBED-11] -&gt; [https://grizzly.dev.java.net/ Grizzly]: It misses the abilty to add some extra classpath to the applications. Once it is implemented, it seems it will be very easy to add to the list.
* [http://kenai.com/jira/browse/WEMBED-14 WEMBED-14] -&gt; [http://tomcat.apache.org/tomcat-6.0-doc/ Tomcat 6.0]: It won't be supported.

If you have a favourite embedded servlet container that is not in the list, feel free to suggest it to us. In order to be able to be integrated with Wembed, the basic features a container has to implement:
* Be able to be started/stop from Java code and be able to configure:
** The listening port
** The context name
* Be able to deploy an exploded application (a directory)
* Be able to set some extra classpath for the libraries that are not included by the application



----
''Using icons from [http://www.everaldo.com/crystal/ the Crystal project ]''</text>
  <text-as-html>&lt;h1&gt;&lt;a name='The_embedded_container_launcher'&gt;&lt;/a&gt; &lt;?link_for_image wembed.gif?&gt; The embedded container launcher &lt;/h1&gt;
&lt;p&gt;Wembed is a tiny utility that encapsulates servlet containers that can be embedded so they can be used more easily to test web applications. 
The idea is to allow developers to test web applications with different containers just by doing some small configuration changes, and  also allowing them to be able to use those embedded containers in automatic tests with &lt;a class='external' href=&quot;http://ant.apache.org/&quot;&gt;Ant&lt;/a&gt;.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Documentation_index'&gt;&lt;/a&gt; &lt;?link_for_image contents.png?&gt; Documentation index &lt;/h2&gt;
&lt;ul&gt;&lt;li&gt; &lt;?link_for_image agt_runit.png?&gt; &lt;a href='#quickstart' class='internal'&gt; Quickstart&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;?link_for_image ark.png?&gt; &lt;a href='#step' class='internal'&gt;Step by step installation&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;?link_for_image player_play.png?&gt; &lt;a href='#running' class='internal'&gt;Running YOUR web application with Wembed&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;?link_for_image mymac.png?&gt; &lt;a href='#showcase' class='internal'&gt;Showcasing your web application with different containers&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;?link_for_image testbed_protocol.png?&gt; &lt;a href='&lt;?url_for_page  AntHtmlUnit ?&gt;' class='internal'&gt; Using Wembed inside Ant to perform JUnit tests&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span id=&quot;quickstart&quot; /&gt;&lt;/p&gt;&lt;h2&gt;&lt;a name='Quickstart'&gt;&lt;/a&gt; &lt;?link_for_image agt_runit.png?&gt;Quickstart &lt;/h2&gt;
&lt;ul&gt;&lt;li&gt; You need to have Java 6 properly installed.
&lt;/li&gt;&lt;li&gt; Go to the &lt;a class='external' href=&quot;http://kenai.com/projects/wembed/downloads&quot;&gt;downloads section&lt;/a&gt; and grab the Wembed standalone release.
&lt;/li&gt;&lt;li&gt; Unpack the zip file to the directory of your liking.
&lt;/li&gt;&lt;li&gt; Edit bin/server.properties and set the &lt;b&gt;base property&lt;/b&gt; to the directory where you have your web application deployed.
&lt;/li&gt;&lt;li&gt; Edit bin/server.properties and set the &lt;b&gt;extra property&lt;/b&gt; to the directory where you have the extra jar files that your application requires and are usually provided by the container.
&lt;/li&gt;&lt;li&gt; Move to the bin directory and execute &lt;b&gt;java -jar bin\Wembed-server.jar&lt;/b&gt;, or if you have the .jar files correctly associated, simply double-click on &lt;b&gt;bin\Wembed-server.jar&lt;/b&gt;.
&lt;/li&gt;&lt;li&gt; Go to &lt;a class='external' href=&quot;http://localhost:8080/&quot;&gt;http://localhost:8080/&lt;/a&gt; to see your application up &amp;amp; running.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span id=&quot;step&quot; /&gt;&lt;/p&gt;&lt;h2&gt;&lt;a name='Step_by_step_installation'&gt;&lt;/a&gt; &lt;?link_for_image ark.png?&gt;Step by step installation &lt;/h2&gt;
&lt;p&gt;The first thing to do is to download Wembed from the &lt;a class='external' href=&quot;http://kenai.com/projects/wembed/downloads&quot;&gt;downloads section&lt;/a&gt;. Let's suppose you grab the .zip version (Wembed_XX_standalone), download it and uncompress it in a folder.
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; You need to have Java 6 installed and properly configured. To verify open a command window and type &lt;b&gt;java -version&lt;/b&gt;, you should see something like:
&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt; &amp;gt; java -version
 java version &amp;quot;1.6.0_11&amp;quot;
 Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
 Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
&lt;/pre&gt;&lt;ul&gt;&lt;li&gt; Once you have Java 6 properly set up, open a command window and move to the directory where you just uncompressed Wembed. Then type &lt;b&gt;java -jar bin\Wembed-server.jar&lt;/b&gt;. That's it!
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;After a brief splash screen, you should see a window open like this one:

&lt;/p&gt;&lt;p&gt;&lt;?link_for_image Wembed-GUI-sample.gif?&gt;

&lt;/p&gt;&lt;p&gt;You can then go and check the URL where the default web application is deployed (by default &lt;a class='external' href=&quot;http://localhost:8080/&quot;&gt;http://localhost:8080/&lt;/a&gt;) If everything went fine, you should see a page with the simple message &#8220;Hello wembed!&#8221;. If you want, you can also make sure that the datasources are also working fine by accessing the page &lt;a class='external' href=&quot;http://localhost:8080/jdbc.jsp&quot;&gt;http://localhost:8080/jdbc.jsp&lt;/a&gt;. There you should see a list of four items ordered alphabetically, which are the result of running a query against an embedded HSQL database, accessed through a container managed data source.

&lt;/p&gt;&lt;p&gt;If anything goes wrong, push the button &#8220;Console Show/Hide&#8221; of the GUI and you will be able to see the server logs to find out what went wrong.

&lt;/p&gt;&lt;p&gt;&lt;span id=&quot;running&quot; /&gt;&lt;/p&gt;&lt;h1&gt;&lt;a name='Running_YOUR_web_application_with_Wembed'&gt;&lt;/a&gt; &lt;?link_for_image player_play.png?&gt; Running YOUR web application with Wembed &lt;/h1&gt;
&lt;p&gt;By default, Wembed mounts as a web application the folder called web at the installation directory. But don't worry, in order to use it with your own application, you don't need to copy your application in that folder, you just need to edit the bin/server.properties file and configure the &lt;b&gt;base property&lt;/b&gt; to point to the directory where your web application has been deployed.
So, for example, if your applications is deployed at the directory  &lt;i&gt;/home/me/Apps/MyWebApp&lt;/i&gt;, simply configure the property like this:
&lt;/p&gt;&lt;pre&gt; # Default is ./web
 # base=./web
 base=/home/me/Apps/MyWebApp
 ...
&lt;/pre&gt;&lt;p&gt;Run the Wembed-server.jar again and you should see your application up &amp;amp; running it. Note that you can also do it through the command line, setting the base as a System property, like this:
&lt;/p&gt;&lt;pre&gt;  java -Dbase=/home/me/Apps/MyWebApp -jar Wembed-server.jar
&lt;/pre&gt;&lt;p&gt;&lt;b&gt;Warning:&lt;/b&gt;: The embedded containers included with Wembed come with a very basic set of dependencies, enough to compile JSP pages, create a DataSource and access it through JNDI. So if you start your application and see various &lt;i&gt;ClassNotFoundException&lt;/i&gt;, that's normal :). That's what the &lt;b&gt;extra property&lt;/b&gt; is for. This setting configures a directory where you will be putting the &lt;i&gt;extra&lt;/i&gt; .jar libraries that your application requires but are not included with it because they are usually shipped with the servlet container.

&lt;/p&gt;&lt;p&gt;&lt;span id=&quot;showcase&quot; /&gt;&lt;/p&gt;&lt;h2&gt;&lt;a name='Showcasing_your_web_application_with_different_containers'&gt;&lt;/a&gt; &lt;?link_for_image mymac.png?&gt; Showcasing your web application with different containers &lt;/h2&gt;
&lt;p&gt;Wembed provides encapsulates the embedded servlet container implementation so you can test you application with different containers. Wembed ships currently with two implementations:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; &lt;b&gt;JettyEmbeddedContainer&lt;/b&gt;, using &lt;a class='external' href=&quot;http://www.mortbay.org/jetty/&quot;&gt;Jetty 6.1.7&lt;/a&gt; as embedded container.
&lt;/li&gt;&lt;li&gt; &lt;b&gt;TomcatEmbeddedContainer&lt;/b&gt;, using &lt;a class='external' href=&quot;http://tomcat.apache.org/&quot;&gt;Tomcat 5.5&lt;/a&gt; as embedded container.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;By default, Wembed uses the first container implementation that is found in the bin directory (of the lib-XXX form), so if you don't install one of them, it will automatically use the other. But if you want to choose specifically which container to use, you simply need to specify the &lt;b&gt;container property&lt;/b&gt; to the name of the implementation you want to use. You can do it either through the &lt;b&gt;server.properties&lt;/b&gt; file:

&lt;/p&gt;&lt;pre&gt;  # Default is the first one that appears in the classpath
  #container=jetty
  #container=tomcat
  container=XXX
  ...
&lt;/pre&gt;&lt;p&gt;or setting the container system property when you execute the .jar file, like this:
&lt;/p&gt;&lt;pre&gt;  java -Dcontainer=XXX -jar Wembed-server.jar
&lt;/pre&gt;&lt;p&gt;Other containers such as &lt;a class='external' href=&quot;http://www.caucho.com/&quot;&gt;Caucho Resin&lt;/a&gt; have been tested and have a WIP implementation, and others are planned for when the servlet containers implement the proper hooks.

&lt;/p&gt;&lt;h2&gt;&lt;a name='other_interesting_things_to_check'&gt;&lt;/a&gt; other interesting things to check &lt;/h2&gt;
&lt;ul&gt;&lt;li&gt; &lt;?link_for_image testbed_protocol.png?&gt; &lt;a href='&lt;?url_for_page  AntHtmlUnit ?&gt;' class='internal'&gt; Using Wembed inside Ant to perform JUnit tests&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;?link_for_image agt_utilities.png?&gt; Modifying the Wembed configuration
&lt;/li&gt;&lt;li&gt; &lt;?link_for_image agt_softwareD.png?&gt; Building Wembed from the source
&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='Supported_embedded_containers'&gt;&lt;/a&gt; Supported embedded containers &lt;/h3&gt;
&lt;p&gt;The list of containers that are currently supported by Wembed are the following:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://www.mortbay.org/jetty/&quot;&gt;Jetty 6.1.7&lt;/a&gt;: Included with Wembed
&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://tomcat.apache.org/tomcat-5.5-doc/&quot;&gt;Tomcat 5.5&lt;/a&gt;: Included with Wembed
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
Some other containers that are being tested or &lt;i&gt;in the works&lt;/i&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://kenai.com/jira/browse/WEMBED-3&quot;&gt;WEMBED-3&lt;/a&gt; -&amp;gt; &lt;a class='external' href=&quot;http://www.caucho.com/&quot;&gt;Caucho Resin&lt;/a&gt;: Implementation almost ready with Resin 4.0. The tests are all green, and the remaining issues are simply facilitating deployment and usage.
&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://kenai.com/jira/browse/WEMBED-10&quot;&gt;WEMBED-10&lt;/a&gt; -&amp;gt; &lt;a class='external' href=&quot;https://embedded-glassfish.dev.java.net/&quot;&gt;Embedded GlassFish v3&lt;/a&gt;: GlassFish v3 itself is in beta and the embedded version is missing some basic features.
&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://kenai.com/jira/browse/WEMBED-11&quot;&gt;WEMBED-11&lt;/a&gt; -&amp;gt; &lt;a class='external' href=&quot;https://grizzly.dev.java.net/&quot;&gt;Grizzly&lt;/a&gt;: It misses the abilty to add some extra classpath to the applications. Once it is implemented, it seems it will be very easy to add to the list.
&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://kenai.com/jira/browse/WEMBED-14&quot;&gt;WEMBED-14&lt;/a&gt; -&amp;gt; &lt;a class='external' href=&quot;http://tomcat.apache.org/tomcat-6.0-doc/&quot;&gt;Tomcat 6.0&lt;/a&gt;: It won't be supported.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
If you have a favourite embedded servlet container that is not in the list, feel free to suggest it to us. In order to be able to be integrated with Wembed, the basic features a container has to implement:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; Be able to be started/stop from Java code and be able to configure:
&lt;ul&gt;&lt;li&gt; The listening port
&lt;/li&gt;&lt;li&gt; The context name
&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt; Be able to deploy an exploded application (a directory)
&lt;/li&gt;&lt;li&gt; Be able to set some extra classpath for the libraries that are not included by the application
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;hr&gt;&lt;/hr&gt;&lt;p&gt;&lt;i&gt;Using icons from &lt;a class='external' href=&quot;http://www.everaldo.com/crystal/&quot;&gt;the Crystal project &lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</text-as-html>
  <updated-at type="datetime">2009-05-22T07:27:52Z</updated-at>
  <wiki-id type="integer">3492</wiki-id>
</page>
