<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>tomcat &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/tomcat/</link>
	<description>Feed of posts on WordPress.com tagged "tomcat"</description>
	<pubDate>Sun, 29 Nov 2009 18:07:09 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Tomcat Hibernate Datasource Configuration For MySQL]]></title>
<link>http://jefferyhaynes.net/2009/11/29/tomcat-hibernate-datasource-configuration-for-mysql/</link>
<pubDate>Sun, 29 Nov 2009 18:06:11 +0000</pubDate>
<dc:creator>theartoftechonline</dc:creator>
<guid>http://jefferyhaynes.net/2009/11/29/tomcat-hibernate-datasource-configuration-for-mysql/</guid>
<description><![CDATA[My last post dealt with Websphere configuration for Hibernate with a Datasource for MySQL.  I also m]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My last post dealt with Websphere configuration for Hibernate with a Datasource for MySQL.  I also mentioned how I typically use Apache Tomcat to do a lot of my testing before deploying to Websphere.  Smart readers will know that the types of applications I am referring to do not include JMS or EJBs but are straight Servlet or Web Services type apps.  Development and Testing for full J2EE based applications should take place using other Application Servers, and or development environments.</p>
<p>With that said, I thought I would post the steps I went through to configure Tomcat for a Datasource, and what I had to do to configure my Hibernate configuration file for that source.</p>
<p>&#160;</p>
<p>First off, I made no changes to my hibernate.cfg.xml from the one I deployed to Websphere.  So the following configuration parameters are still the same.</p>
<pre class="brush: plain;">
&#60;div&#62;&#60;property name=”current_session_context_class”&#62;thread&#60;/property&#62;&#60;/div&#62;
&#60;div id=&#34;_mcePaste&#34;&#62;&#60;property name=”hibernate.bytecode.use_reflection_optimizer”&#62;false&#60;/property&#62;&#60;/div&#62;
&#60;div id=&#34;_mcePaste&#34;&#62;&#60;property name=”hibernate.connection.datasource”&#62;java:comp/env/jdbc/mysqlblogpostdataref&#60;/property&#62;&#60;/div&#62;
&#60;div id=&#34;_mcePaste&#34;&#62;&#60;property name=”show_sql”&#62;true&#60;/property&#62;&#60;/div&#62;
&#60;div id=&#34;_mcePaste&#34;&#62;&#60;property name=”dialect”&#62;org.hibernate.dialect.MySQLDialect&#60;/property&#62;&#60;/div&#62;
&#60;div&#62;&#60;property name=”hibernate.bytecode.use_reflection_optimizer”&#62;false&#60;/property&#62;&#60;/div&#62;
&#60;div&#62;&#60;property name=”hibernate.connection.datasource”&#62;java:comp/env/jdbc/mysqlblogpostdataref&#60;/property&#62;&#60;/div&#62;
&#60;div&#62;&#60;property name=”show_sql”&#62;true&#60;/property&#62;&#60;/div&#62;
&#60;div&#62;&#60;property name=”dialect”&#62;org.hibernate.dialect.MySQLDialect&#60;/property&#62;&#60;/div&#62;
</pre>
<p>I also kept my web.xml the same as my deployment to Websphere.</p>
<pre class="brush: plain;">

&#60;resource-ref&#62;
&#60;description&#62;My Blog DataSource&#60;/description&#62;
&#60;res-ref-name&#62;jdbc/mysqlblogpostdataref&#60;/res-ref-name&#62;
&#60;res-type&#62;javax.sql.DataSource&#60;/res-type&#62;
&#60;res-auth&#62;Container&#60;/res-auth&#62;
&#60;/resource-ref&#62;
</pre>
<p>Secondly edit your Context.xml file stored in the $CATALINA_HOME/conf directory and add a Resource entry.</p>
<pre class="brush: plain;">

&#60;Context path=&#34;/DBTest&#34; docBase=&#34;DBTest&#34;
debug=&#34;5&#34; reloadable=&#34;true&#34; crossContext=&#34;true&#34;&#62;

&#60;!-- maxActive: Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to -1 for no limit.
--&#62;

&#60;!-- maxIdle: Maximum number of idle dB connections to retain in pool.
Set to -1 for no limit.  See also the DBCP documentation on this
and the minEvictableIdleTimeMillis configuration parameter.
--&#62;

&#60;!-- maxWait: Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded.  Set to -1 to wait indefinitely.
--&#62;

&#60;!-- username and password: MySQL dB username and password for dB connections  --&#62;

&#60;!-- driverClassName: Class name for the old mm.mysql JDBC driver is
org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
--&#62;

&#60;!-- url: The JDBC connection url for connecting to your MySQL dB.
--&#62;

&#60;Resource name=&#34;jdbc/mysqlblogpostdataref&#34; auth=&#34;Container&#34; type=&#34;javax.sql.DataSource&#34;
maxActive=&#34;100&#34; maxIdle=&#34;30&#34; maxWait=&#34;10000&#34;
username=&#34;dbuser&#34; password=&#34;yourpassword&#34; driverClassName=&#34;com.mysql.jdbc.Driver&#34;
url=&#34;jdbc:mysql://localhost:3306/yourdatabase&#34;/&#62;
&#60;/Context&#62;
</pre>
<p>The key here is to make sure your resource name in the context.xml matches your reference name in the web.xml, this is the only way Tomcat environments know how to map resources from your deployment descriptor to the context.xml.</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Vaadin Framework]]></title>
<link>http://sidney3172blog.wordpress.com/2009/11/27/vaadin-framework/</link>
<pubDate>Fri, 27 Nov 2009 15:15:30 +0000</pubDate>
<dc:creator>Sergey Gibert</dc:creator>
<guid>http://sidney3172blog.wordpress.com/2009/11/27/vaadin-framework/</guid>
<description><![CDATA[Сегодня я расскажу об ещё одном прекрасном framework`е под название Vaadin. Это фреймворк, который п]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div id="_mcePaste">Сегодня я расскажу об ещё одном прекрасном framework`е под название <a href="http://vaadin.com">Vaadin</a>. Это фреймворк, который предоставляет возможности сходные с GWT(Google Web Toolkit) &#8211; построение Web 2.0 &#8211; интерфейсов (RIA), только он более приятен и интуитивно понятен обычному java-разработчику. Как и в GWT вы пишите чистый java-код, который интерпретируется в Java + Java Script код. Это очень удобно. Демо (уже ставшее традицией для таких фремворков) можно лицезреть вот <a href="http://demo.vaadin.com/sampler/">тут</a>.</div>
<div><!--more--></div>
<div id="_mcePaste">Сегодня, как водится, я расскажу как все настроить для работы с Vaadin, и напишем hello world приложение. (В следующих статьях я расскажу об основных виджетах, лэйаутах (layouts), и с создании своих собственных кастомных виджетов).</div>
<div id="_mcePaste">Итак начнем.</div>
<div id="_mcePaste">Я буду настраивать как водится среду Eclipse (Galileo) которую можно и нужно скачать вот <a href="http://eclipse.org">тут</a>.</div>
<div id="_mcePaste">А дальше все делается исключительно внутри самого Eclipse. (конечно если очень хочется то можно на официальном сайте скачать <a href="http://vaadin.com/download">архив Vaadin</a> &#8211; там кстати есть очень полезная <a href="http://vaadin.com/book">книга (pdf)</a> по использованию данного фреймворка).</div>
<div>1) Добавляем в эклипс репозиторий Vaadin (адрес  <code>http://vaadin.com/eclipse</code>)</div>
<div>2) Устанавливаем появившиеся пакеты.</div>
<div>Следующий шаг &#8211; нам потребуется  контейнер сервлетов &#8211; вы можете использовать ваш любимый, а я свой &#8211; <a href="http://tomcat.apache.org/">tomcat</a>. Сначала его скачаем <a href="http://tomcat.apache.org/download-60.cgi">тут</a> (логично использовать последнюю 6ю версию). После этого. В eclipse настраиваем новый сервер (File &#8211; New &#8211; Other &#8211; Server)</div>
<div><a href="http://sidney3172blog.wordpress.com/files/2009/11/capture.png"><img class="aligncenter size-medium wp-image-180" title="Capture" src="http://sidney3172blog.wordpress.com/files/2009/11/capture.png?w=276" alt="" width="276" height="300" /></a>далее указываем  путь до сервера (CATALINA_HOME &#8211; папка bin от tomcat).</div>
<div>Все теперь остается создать новый проект.</div>
<div>Выбираем &#8211; New &#8211; Project &#8211; Other &#8211; Vaadin.</div>
<div>Делаем имя для проекта, в качестве Runtime указываем только что созданный Apache Tomcat.</div>
<div>Кликаем по кнопке Download.</div>
<div><a href="http://sidney3172blog.wordpress.com/files/2009/11/capture2.png"><img class="aligncenter size-medium wp-image-181" title="Capture2" src="http://sidney3172blog.wordpress.com/files/2009/11/capture2.png?w=255" alt="" width="255" height="300" /></a>Выбираем последнюю доступную версию. После этого eclipse загрузит файл <code>vaadin-6.1.5.jar</code></div>
<div>После установки, можно начинать &#8220;творить&#8221;.</div>
<blockquote><p><code><span style="font-family:'Courier New';color:black;font-size:x-small;">package com.example.testvaadin;</span></code></p>
<p><code><span style="font-family:'Courier New';color:black;font-size:x-small;">import com.vaadin.Application;<br />
import com.vaadin.ui.*;<br />
import com.vaadin.ui.Button.ClickEvent;<br />
import com.vaadin.ui.Button.ClickListener;</span></code></p>
<p><code><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> TestvaadinApplication extends Application {<br />
@Override<br />
<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> init() {<br />
final Label hello = <span style="color:#0000ff;">new</span> Label(<span style="color:#a31515;">"Hello, %username%"</span>);<br />
hello.setVisible(<span style="color:#0000ff;">false</span>);<br />
Window mainWindow = <span style="color:#0000ff;">new</span> Window(<span style="color:#a31515;">"My new web 2.0 application with vaadin"</span>);<br />
Panel rootPanel = <span style="color:#0000ff;">new</span> Panel(<span style="color:#a31515;">"&#60;h1 align='center'&#62;My First Vaadin Application&#60;/h1&#62;"</span>);<br />
rootPanel.setSizeFull();<br />
Button clickMe = <span style="color:#0000ff;">new</span> Button(<span style="color:#a31515;">"Say, Hello world!"</span>);<br />
clickMe.addListener(<span style="color:#0000ff;">new</span> ClickListener()<br />
{<br />
<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> buttonClick(ClickEvent <span style="color:#0000ff;">event</span>)<br />
{<br />
hello.setVisible(!hello.isVisible());<br />
}<br />
});<br />
rootPanel.setSizeFull();<br />
rootPanel.setContent(<span style="color:#0000ff;">new</span> VerticalLayout());<br />
rootPanel.addComponent(hello);<br />
rootPanel.addComponent(clickMe);<br />
mainWindow.addComponent(rootPanel);<br />
setMainWindow(mainWindow);<br />
}</code></p>
<p><code> </code><code><span style="font-family:'Courier New';color:black;font-size:x-small;">}<br />
</span><br />
<span style="color:gray;font-size:xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color:gray;font-size:xx-small;">Source Code Highlighter</span></a>.</span></code></p></blockquote>
<p>нажимаем <strong>run on server </strong>и видим следующую картинку:</p>
<p><a href="http://sidney3172blog.wordpress.com/files/2009/11/capture3.png"><img class="aligncenter size-medium wp-image-182" title="Capture3" src="http://sidney3172blog.wordpress.com/files/2009/11/capture3.png?w=300" alt="" width="300" height="223" /></a>Вот так.  Сами поэкспериментируйте с виджетами, но учтите, что нужно постоянно чистить кеши tomcat`a, иначе будут сложности (сделать это можно в свойствах сервера &#8220;Clean Tomcat Work Directory&#8221;).</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Configuring HTTPS on Tomcat 6.0.18]]></title>
<link>http://pojoe.wordpress.com/2009/11/26/configuring-https-on-tomcat-6-0-18/</link>
<pubDate>Thu, 26 Nov 2009 16:14:59 +0000</pubDate>
<dc:creator>Joseph Shum</dc:creator>
<guid>http://pojoe.wordpress.com/2009/11/26/configuring-https-on-tomcat-6-0-18/</guid>
<description><![CDATA[My Liferay application was running on the domain www.pojoe.ca and resided on Tomcat 6 in its own VM ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">My Liferay application was running on the domain <a href="http://www.pojoe.ca/">www.pojoe.ca</a> and resided on Tomcat 6 in its own VM while my SSO server was running on another Tomcat 6 instance on another VM under the domain sso.pojoe.ca. I wanted to establish an SSL connection between the two over a self-signed certificate.</span></span></p>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">I started by setting up HTTPS on my SSO server.</span></span></p>
<ul>
<li><span style="font-family:Symbol;"><span style="font-size:small;"> </span></span><span style="font-family:Symbol;"><span style="font-size:small;"> </span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Create the keystore and private key in some directory. I use /opt/tomcat/security</span></span><span style="font-family:Arial,sans-serif;"> </span></li>
</ul>
<blockquote><p><span style="font-family:Arial,sans-serif;">keytool -genkey -alias mykey -keypass changeit -keyalg RSA -keystore server.keystore</span></p></blockquote>
<ul>
<li><span style="font-family:Symbol;"> </span><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Answer the prompts.  Use <a href="http://www.pojoe.ca/">sso.pojoe.ca</a> (your domain) when asked for first/last name.  This is critical.</span></span></li>
</ul>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">NOTE:</span></span> <span style="font-family:Arial,sans-serif;"><span style="font-size:small;">From <a href="http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html">http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html</a></span></span></p>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">I am using name-based virtual hosts on a secured connection which can be problematic. This is a design limitation of the SSL protocol itself. The SSL handshake, where the client browser accepts the server certificate, must occur before the HTTP request is accessed. As a result, the request information containing the virtual host name cannot be determined prior to authentication, and it is therefore not possible to assign multiple certificates to a single IP address. If all virtual hosts on a single IP address need to authenticate against the same certificate, the addition of multiple virtual hosts should not interfere with normal SSL operations on the server. Be aware, however, that most client browsers will compare the server&#8217;s domain name against the domain name listed in the certificate, if any (applicable primarily to official, CA-signed certificates). If the domain names do not match, these browsers will display a warning to the client user. In general, only address-based virtual hosts are commonly used with SSL in a production environment.</span></span></p>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">server.keystore is generated.</span></span></li>
</ul>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">List the keys currently stored in your keystore.</span></span></li>
</ul>
<blockquote><p><span style="font-family:Arial,sans-serif;">keytool -list -keystore server.keystore</span></p></blockquote>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">You should see the PrivateKeyEntry named mykey in the listing.</span></span></li>
</ul>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">This should be sufficient to begin receiving connections using HTTPS.</span></span></li>
</ul>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Generate the certificate.</span></span></li>
</ul>
<blockquote><p>keytool -export -alias mykey -keypass changeit -file mycert.crt -keystore server.keystore</p></blockquote>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">mycert.crt is generated.</span></span></li>
</ul>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Import the certificate into the keystore.</span></span></li>
</ul>
<blockquote><p>keytool -import -alias mycert -keypass changeit -file mycert.crt -keystore server.keystore</p></blockquote>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">You receive a warning that it already exists in the keystore.  Ignore it.  It is because Java expects separate keystore and trust store files and we are using only one. </span></span></li>
</ul>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">List the keys currently stored in your keystore.</span></span></li>
</ul>
<blockquote><p><span style="font-family:Arial,sans-serif;">keytool -list -keystore server.keystore</span></p></blockquote>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">You should see a TrustedCertEntry named </span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">mycert</span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:small;"> in the listing as well as the </span></span>PrivateKeyEntry named mykey<span style="font-family:Arial,sans-serif;"><span style="font-size:small;">.</span></span></li>
</ul>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Next I configured Tomcat to use the keystore I just setup. In server.xml uncomment the SSL connector port 8443. I’ve added the keystore file we created.</span></span></p>
<blockquote><p><span style="color:#008080;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#60;</span></span></span><span style="color:#3f7f7f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">Connector</span></span></span> <span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">port</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;8443&#8243;</span></span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> </span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">protocol</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;HTTP/1.1&#8243;</span></span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> </span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">SSLEnabled</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;true&#8221;</span></span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> maxThreads</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;150&#8243;</span></span></span> <span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">scheme</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;https&#8221;</span></span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> </span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">secure</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;true&#8221;</span></span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> </span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">clientAuth</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;false&#8221;</span></span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> </span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">sslProtocol</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;TLS&#8221;</span></span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> </span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">keystoreFile</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;/opt/tomcat/security/server.keystore&#8221;</span></span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;"> </span></span><span style="color:#7f007f;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">keystorePass</span></span></span><span style="color:#000000;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">=</span></span></span><span style="color:#2a00ff;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">&#8220;changeit&#8221;</span></span></span><span style="color:#008080;"><span style="font-family:Arial,sans-serif;"><span style="font-size:x-small;">/&#62;</span></span></span></p></blockquote>
<p><span style="color:#000000;"> </span></p>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">My SSO server is now ready to rock over HTTPS.</span></span></p>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;"> </span></span> <span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Next I’ll enable HTTPS on my Application server running Liferay. </span></span></p>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Create the keystore and private key in some directory. I use /opt/tomcat/security</span></span></p>
<blockquote><p><span style="font-family:Arial,sans-serif;">keytool -genkey -alias mykey -keypass changeit -keyalg RSA -keystore server.keystore</span></p></blockquote>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Answer the prompts.  Use <a href="http://www.pojoe.ca/">www.pojoe.ca</a></span></span> <span style="font-family:Arial,sans-serif;"><span style="font-size:small;">(your domain) when asked for first/last name.  This is critical. See notes from above.</span></span></li>
</ul>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Copy the mycert.crt certificate from the SSO server to /opt/servers/tomcat/security</span></span></li>
</ul>
<blockquote><p><span style="font-family:Arial,sans-serif;">keytool -import -alias mycert -keypass changeit -file mycert.crt -keystore server.keystore</span></p></blockquote>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">List the keys currently stored in your keystore.</span></span></li>
</ul>
<blockquote><p><span style="font-family:Arial,sans-serif;">keytool -list -keystore server.keystore</span></p></blockquote>
<ul>
<li><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">You should see a TrustedCertEntry named </span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">mycert</span></span><span style="font-family:Arial,sans-serif;"><span style="font-size:small;"> in the listing as well as </span></span>the PrivateKeyEntry named mykey.</li>
</ul>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Next we’ll set the JVM parameters to tell the application to use the trust store.</span></span></p>
<p><span style="font-family:Arial,sans-serif;">-Djavax.net.ssl.trustStore=/opt/servers/tomcat6.0.18/server.keystore</span></p>
<p><span style="font-family:Arial,sans-serif;">-Djavax.net.ssl.trustStorePassword=changeit</span></p>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">My Liferay application server and my CAS SSO server can now talk over HTTPS.</span></span></p>
<p>&#160;</p>
<p><span style="font-family:Arial,sans-serif;"><span style="font-size:small;">Reference:</span></span></p>
<p>http://java.sun.com/javase/6/docs/technotes/tools/windows/keytool.html</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Application Administrator]]></title>
<link>http://mindsourceinc.wordpress.com/2009/11/24/application-administrator/</link>
<pubDate>Tue, 24 Nov 2009 22:33:50 +0000</pubDate>
<dc:creator>Michelle</dc:creator>
<guid>http://mindsourceinc.wordpress.com/2009/11/24/application-administrator/</guid>
<description><![CDATA[This position is an Application Administrator to support operations within our client&#8217;s depart]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This position is an Application Administrator to support operations within our client&#8217;s department. This position has a critical role in delivering our services to clients and ensuring successful ongoing operation of our applications and services. It services a highly interactive software development build/release process as well as a rich operational environment with many interrelated applications/database services. The candidate should be self-motivated, detail oriented, adaptable to change and must work well in a flexible team environment with developers, QA, operations staff, system administrators and managers.</p>
<p><strong>RESPONSIBILITIES:</strong></p>
<p><span style="text-decoration:underline;"> </span></p>
<p><span style="text-decoration:underline;">Application and database support </span></p>
<ul>
<li>Provide on-going database administration in both back-end and front-end with application infrastructure support for our client&#8217;s administration systems, including the deployment of new applications.</li>
<li>Review the physical design of existing databases for optimal database structures, database performance tuning, security, database backup/recovery strategy, implementing high-availability, and pro-active and reactive performance analysis, monitoring, troubleshooting and resolution of issues, capacity planning, monitoring data growth and system utilization, trend analysis and predicting future database resource requirements.</li>
<li>Install web-base applications from ground up to full-ballooned implementation and support, including configuration at Unix/Linux/Windows system level, back-end integration with database, front-end integration with user-interface, final delivery to users to fulfill users’ requirement and on-going maintenance.</li>
<li>Take the lead in ensuring that application and web services are configured and tuned according to application needs; provide troubleshooting as needed.</li>
<li>Work with System Administrators to ensure test and production boxes conform to the software application configuration needs.</li>
<li>Support the department-wide infrastructure application for database management, system monitoring and notification, job scheduling, deployment, provision and patching automation, application topology and service level management for campus-wide system performance.</li>
</ul>
<p><span style="text-decoration:underline;">Build/release activities</span></p>
<ul>
<li>Manage the build, tagging and release processes for a number of interdependent Java web applications and background processes in the QA and production environments. Ensure the build and release process is scalable and repeatable.</li>
<li>Work with the development team to ensure efficient and understandable build procedures are adhered to and conform to a standard process for configuration and release management</li>
<li>Develop and maintain tools that automate the building of software releases for an Agile-based development process. This is one of continuous integration, where the automated build process can be run many times a day if necessary.</li>
<li>Work with and support the QA team to ensure automated test suites run as part of the continuous integration build process.</li>
</ul>
<p><strong>REQUIREMENT FOR SKILL AND COMPETENCIES:</strong></p>
<ul>
<li>Expert hands-on with shell scripts, other scripting languages, preferably Perl, and tool automations</li>
<li>Minimum 2 years database administration experience in Oracle and 3 years Application administration experience in Unix/Linux infrastructure environments is required.</li>
<li>Hands-on experience of Oracle databases 10g for 24/7 database operations and tool automation in installation, configuration, backup/recovery, startup/shutdown, data refresh, and application integrations.</li>
<li>Experience with OEM/Grid Control is highly desired.</li>
<li>Knowledge and understanding of large scale ERP implementation and support like Oracle Financial and PeopleSoft systems.</li>
<li>Expert knowledge of Apache and Tomcat, and other web/application servers such as JBoss</li>
<li>Strong Unix and system administration skills with basic network and security knowledge</li>
<li>Strong experience and ability in web applications deployment, configuration and integration from both OpenSource and Commercial based systems with or without sophisticated vendor support.</li>
<li>Java/J2EE based programs</li>
<li>Java/servlet/JSP based web applications</li>
<li>Experience with Subversion, PVCS or similar source code repository</li>
<li>Experience with Maven and familiarity with automated build processes</li>
<li>Experience with the Agile development methodology and concepts of extreme programming and continuous integration</li>
<li>Understanding of the layers/tiers of web applications and the communication protocol between the tiers with networking protocols (TCP/IP, HTTP, SSL, DNS, FTP, etc.)</li>
<li>Ability to multi-task and work in a team environment is critical and should have excellent communication skills in both verbal and written forms.</li>
<li>Ability to manage multiple competing priorities and work under pressure in high stress situations</li>
<li>Excellent communication skills in both verbal and written</li>
<li>Ability to work under pressure and to deliver results in a complex and dynamic operational environment</li>
</ul>
<p><strong>Qualifications</strong></p>
<p>Minimum 5 years as an IT professional in build/release and application/database administration, plus one or more of the following areas: IT infrastructure operations 24/7, systems analysis and design, or application development.</p>
<p><strong>Education</strong><br />
Bachelors Degree in Computer Science, Engineering or related field or equivalent experience</p>
<p>If you are interested, please send your resume to <a href="mailto:tsotelo@mindsource.com?subject=Application Administrator">tsotelo@mindsource.com</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Install Tomcat 6 on Debian Lenny with pinning]]></title>
<link>http://itnotepad.wordpress.com/2009/11/24/install-tomcat-6-on-debian-lenny-with-pinning/</link>
<pubDate>Tue, 24 Nov 2009 10:39:36 +0000</pubDate>
<dc:creator>nedwards</dc:creator>
<guid>http://itnotepad.wordpress.com/2009/11/24/install-tomcat-6-on-debian-lenny-with-pinning/</guid>
<description><![CDATA[I recently needed to install tomcat 6 on debian lenny, however it is not in the repository and there]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I recently needed to install tomcat 6 on debian lenny, however it is not in the repository and there is no backport.</p>
<p>There were two options, either use the tar or install the debian testing package. I have opted for the testing package as it is a debian specific setup and integrates properly.</p>
<p>I am assuming that you already have the debian java 6 package installed. Run the following as root.</p>
<p>First set the release to stable:<br />
<code><br />
echo 'APT::Default-Release "stable";' &#62; /etc/apt/apt.conf<br />
</code><br />
This is important and not setting this will cause issues.</p>
<p>Now add the testing repository:<br />
<code><br />
cat &#60;&#60;EOF&#62;/etc/apt/sources.list.d/squeeze.list<br />
# Repository for Squeeze, to get Tomcat6<br />
deb http://ftp.uk.debian.org/debian squeeze main contrib non-free<br />
deb-src http://ftp.uk.debian.org/debian squeeze main contrib non-free<br />
EOF<br />
</code></p>
<p>Now pin the new packages:<br />
<code><br />
cat &#60;&#60;EOF&#62;/etc/apt/preferences<br />
Package: *<br />
Pin: release o=Debian,a=stable<br />
Pin-Priority: 990<br />
Package: *<br />
Pin: release o=Debian,a=testing<br />
Pin-Priority: 500<br />
Package: tomcat6,tomcat6-admin,tomcat6-common,libtomcat6-java,libservlet2.5-java<br />
Pin: release o=Debian,a=testing<br />
Pin-Priority: 990<br />
EOF<br />
</code></p>
<p>The above with ensure that testing packages will only take the priority for the tomcat related packages. The higher pin priority takes precedence.</p>
<p>Now update the repositories and install tomcat 6.<br />
<code><br />
aptitude update<br />
aptitude install tomcat6<br />
</code></p>
<p>Ref:</p>
<p><a href="http://www.waltercedric.com/component/content/article/193-technical/1634-debian-lenny-how-to.html">http://www.waltercedric.com/component/content/article/193-technical/1634-debian-lenny-how-to.html</a><br />
<a href="http://linux.derkeiler.com/Mailing-Lists/Debian/2008-12/msg01207.html">Why no apt-pinning by release name?</a><br />
<a href="http://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_tweaking_candidate_version">http://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_tweaking_candidate_version</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[JavaBean in JSP : a simple tutorial]]></title>
<link>http://getch.wordpress.com/2009/11/20/javabean-in-jsp-a-simple-example/</link>
<pubDate>Fri, 20 Nov 2009 16:43:10 +0000</pubDate>
<dc:creator>manoj1987</dc:creator>
<guid>http://getch.wordpress.com/2009/11/20/javabean-in-jsp-a-simple-example/</guid>
<description><![CDATA[Hi ! Purpose of this tutorial : To give the reader a better understanding of using Java beans in JSP]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><span style="color:#333300;">Hi !</span></p>
<p><span style="color:#333300;"><span style="color:#993300;"><strong>Purpose of this tutorial</strong> :</span> To give the reader a better understanding of using Java beans in JSP.</span></p>
<p><span style="color:#333300;"><span style="color:#993300;"><strong>Advantage</strong> :</span> This tutorial serves as an instant learning tutorial for those who would want to learn about using  Java bean in JSP.</span></p>
<p><span style="color:#333300;"><span style="color:#993300;"><strong>Sources</strong> :</span> The code used in this short tutorial has been extracted from <cite></cite><em>www.jsptut.com</em></span></p>
<p><span style="color:#333300;"><span style="color:#993300;"><strong>What is a Java Bean ?</strong></span><br />
Java bean are classes written in the Java programming language conforming to a particular convention. A Java bean has a set of properties that can be read or changed. It is also possible to discover the properties a bea has available, which well suits beans for modeling all kinds of real world things that can also be described as a set of properties.</span></p>
<p><span style="color:#993300;"><strong>Illustration:</strong></span></p>
<p><span style="color:#333300;"><em><strong>What we will be doing?</strong></em></span></p>
<p><span style="color:#333300;">We will create a simple html page(<em>getName.htm</em>l) that is used to get user&#8217;s name, email and age.  When we submit that data, it invokes a JSP page(<em>SaveName.jsp</em>) that inserts the user entered data into a bean. We provide a &#8220;click here to continue&#8221; link in that same page, which when clicked would invoke another JSP page (<em>NextPage.jsp</em>) that retrieves the data that was inserted into the bean and displays it!</span></p>
<p><span style="color:#333300;">The implementation is simple and straight forward!</span></p>
<p><span style="color:#333300;"><em><strong>Tools needed:</strong></em></span></p>
<p><span style="color:#333300;">I have tested this code successfully in<span style="color:#008000;"> Tomcat 6.0</span> configured suitably with <span style="color:#008000;">jdk1.5.0_14 <span style="color:#000000;">and</span> jre1.5.0_14</span>.</span></p>
<p><span style="color:#333300;">code :</span></p>
<p><span style="color:#333300;"><span style="color:#339966;"><em>getName.html</em></span><br />
</span></p>
<p><span style="color:#333300;"><a rel="attachment wp-att-1590" href="http://getch.wordpress.com/2009/11/20/javabean-in-jsp-a-simple-example/getname-2/"><img class="aligncenter size-full wp-image-1590" title="getName_html" src="http://getch.wordpress.com/files/2009/11/getname1.png" alt="" width="480" height="165" /></a></span></p>
<p><span style="color:#333300;"><br />
</span></p>
<p><span style="color:#339966;"><em>SaveName.jsp</em></span></p>
<p><span style="color:#333300;"><a rel="attachment wp-att-1591" href="http://getch.wordpress.com/2009/11/20/javabean-in-jsp-a-simple-example/savename/"><img class="aligncenter size-full wp-image-1591" title="SaveName_jsp" src="http://getch.wordpress.com/files/2009/11/savename.png" alt="" width="480" height="161" /></a></span></p>
<p><span style="color:#333300;"><br />
</span></p>
<p><span style="color:#339966;"><em>NextPage.jsp</em></span></p>
<p><span style="color:#333300;"><a rel="attachment wp-att-1592" href="http://getch.wordpress.com/2009/11/20/javabean-in-jsp-a-simple-example/nextpage/"><img class="aligncenter size-full wp-image-1592" title="NextPage_JSP" src="http://getch.wordpress.com/files/2009/11/nextpage.png" alt="" width="480" height="154" /></a></span></p>
<p><span style="color:#333300;"><br />
</span></p>
<p><span style="color:#333300;">Keep the above files in your webserver directory. My webserver classpath is <span style="color:#339966;">C:\Tomcat 6.0\webapps\ROOT\</span> . Now we must develop a Java code to store the values obtained from the form. We then compile that Java code to obtain its &#8220;class&#8221; file. This class file is the real beauty of Java. Its contents look somewhat junk type when viewed using any editor. And that means that its not easy to hack your data from it(say, a password was sent from the form). </span></p>
<p><span style="color:#333300;">The contents of the Java code are very important. We define a Java class with fields &#8220;username&#8221;,&#8221;email&#8221; and &#8220;age&#8221; which must correspond exactly to the field names in getName.html. We define two types of methods in this Java code viz, a &#8220;setter&#8221; method and a &#8220;getter&#8221; method.</span></p>
<p><span style="color:#333300;"> In simple, </span></p>
<p><span style="color:#333300;">* The<span style="color:#339966;"> setter </span>method is a method that starts with the keyword &#8220;set&#8221; followed by the field name. In our example the setter methods would be setUsername,setEmail and setAge. Now compare this with the field names in getName.html. The only point you must note here is  the first letter, following &#8220;set&#8221;, is in uppercase. These setter methods insert the user entered data into the corresponding variable names into the bean.</span></p>
<p><span style="color:#333300;">At this point, by reasoning you should have understood that a bean is an instance of the Java class(correct me if i am wrong).</span></p>
<p><span style="color:#333300;">* The <span style="color:#339966;">getter</span> method is a method that returns the values stored in the javabean, to the entity that invoked it(<em>NextPage.jsp</em> in this case). The getter methods are named in the same way as setter methods except that the keyword &#8220;set&#8221; is replaced by &#8220;get&#8221;. So now we have getUsername,  getEmail, getAge</span></p>
<p><span style="color:#333300;">The java code is shown below:</span></p>
<p><span style="color:#333300;"><span style="color:#339966;"><em>UserData.java</em></span><br />
</span></p>
<p><span style="color:#333300;"><a rel="attachment wp-att-1595" href="http://getch.wordpress.com/2009/11/20/javabean-in-jsp-a-simple-example/userdata_java/"><img class="aligncenter size-full wp-image-1595" title="UserData_java" src="http://getch.wordpress.com/files/2009/11/userdata_java.png" alt="" width="461" height="451" /></a></span></p>
<p><span style="color:#333300;">Now compile the above Java code and place the code inside a folder named &#8220;user&#8221; because we have declared a java package by that name. This folder (along with the java class)should be placed in the following location:</span></p>
<p><span style="color:#339966;">&#60;Application_Base\application_name&#62;\WEB-INF\classes\</span></p>
<p><span style="color:#333300;">For me its :</span></p>
<p><span style="color:#339966;">C:\Tomcat 6.0\webapps\ROOT\WEB-INF\classes\</span></p>
<p><span style="color:#333300;">If the folder &#8220;classes&#8221; is not present then create one.</span></p>
<p><span style="color:#333300;">That is it invoke the getName.html file from the browser after starting Tomcat server and see the code in action. JSP rocks!</span></p>
<p><span style="color:#993300;"><strong>Output:</strong></span></p>
<p><span style="color:#333300;">See the output <a href="http://img697.imageshack.us/img697/3249/getnamehtmloutput.png" target="_blank">here</a> , <a href="http://img524.imageshack.us/img524/1464/savenamejspoutput.png" target="_blank">here</a> and <a href="http://img99.imageshack.us/img99/9266/nextpagejspoutput.png" target="_blank">here</a>.<br />
</span></p>
<p><span style="color:#993300;"><strong>What I have not explained here?</strong></span></p>
<p><span style="color:#333300;">I have not explained the meaning of the java bean tags in the jsp code given about. Their meanings and pupose are quite intuitive,if not just google to find more info on them.</span></p>
<p><span style="color:#993300;"><strong>How could i make use of this idea?</strong></span></p>
<p><span style="color:#333300;">You can use the idea gathered from this tutorial for designing a user login page using java beans. Creativity has no bounds.</span></p>
<p><span style="color:#993300;"><strong>References:</strong></span></p>
<ul>
<li><span style="color:#333300;"><a href="http://www.jsptut.com/" target="_blank">The best site for learning JSP</a></span></li>
<li><span style="color:#333300;"><a href="http://eng.vnulib.edu.vn/nguon_tai_nguyen/tl_dt/e_book/mlfolder.2005-04-04.3754370259/mlfolder.2005-04-04.0179214974/Addison%20Wesley%20JavaServer%20Pages%202nd%20Edition.pdf" target="_blank">More on JSP learning </a><br />
</span></li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Microsoft Azure to capture open source revenue streams]]></title>
<link>http://saviorodrigues.wordpress.com/2009/11/19/microsoft-azure-to-capture-open-source-revenue-streams/</link>
<pubDate>Thu, 19 Nov 2009 17:50:03 +0000</pubDate>
<dc:creator>Savio Rodrigues</dc:creator>
<guid>http://saviorodrigues.wordpress.com/2009/11/19/microsoft-azure-to-capture-open-source-revenue-streams/</guid>
<description><![CDATA[Three weeks ago I wrote that Amazon RDS was going to eat into MySQL&#8217;s revenue potential.  I al]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Three weeks ago I <a href="http://www.infoworld.com/d/open-source/amazon-rds-out-eat-open-source-vendor-lunches-174?page=0,0" target="_self">wrote that Amazon RDS was going to eat into MySQL&#8217;s revenue potential</a>.  I also pointed out that Amazon&#8217;s RDS was but a precursor to future Amazon cloud service offerings for other popular open source products.  While that post was centered on Amazon, it wasn&#8217;t a stretch to predict that any of the big IT vendors (IBM, Microsoft, HP, Google, Cisco, EMC/VMware, and Sun/Oracle) would offer RDS-like cloud services in the future.</p>
<p>Well, <a href="http://port25.technet.com/archive/2009/11/17/pdc-2009-the-windows-azure-platform.aspx" target="_blank">reading details of the Windows Azure platform</a> this week, the prediction badge no longer applies to Microsoft.  According to Microsoft, Azure SQL will support MySQL, and Azure .NET Services will support Apache Tomcat.  Microsoft will also support PHP and Apache Web Server on Azure.  I&#8217;ll focus on MySQL, and to a lesser degree Apache Tomcat for this discussion.  I believe MySQL and Apache Tomcat will be the first two products offered as a service on large IT vendor cloud platforms, aside from the IT vendor&#8217;s strategic software stack that is.</p>
<p>When Amazon decided to offer MySQL via Amazon RDS, they did so without purchasing MySQL support from Sun.  I&#8217;ve confirmed that Microsoft Azure is supporting MySQL on Azure without paying Sun for a MySQL Enterprise subscription.  The logic as to why Amazon could do without a MySQL Enterprise subscription applies equally to Microsoft:</p>
<blockquote><p>&#8220;Amazon&#8217;s decision to use the free version of MySQL to build RDS is completely sensible. First, Amazon has the technical skills to support their usage of MySQL without having to acquire the MySQL Enterprise subscription. Second, this decision helps Amazon lower the cost of RDS, which makes RDS more attractive to customers. This is clearly not good news for Sun/MySQL, which is missing out on capturing some portion of the revenue from MySQL users spending on RDS.&#8221;</p></blockquote>
<p>As in my previous post, I don&#8217;t want this to be about Amazon or Microsoft versus Sun/MySQL.</p>
<p>The larger point is if Amazon, Microsoft, IBM, HP, Google, Cisco, EMC/VMware, Oracle/Sun offer a simple and supported cloud service for running MySQL, Tomcat, JBoss, Mule or Apache HTTP instances, what reason do customers have to acquire <em>&#8220;enterprise subscriptions&#8221;</em> from the vendors developing these open source projects?  Until now, the value of an open source <em>&#8220;enterprise subscription&#8221;</em> has largely been access to support and access to administration and management tooling.  In the case of MySQL, the former is provided by Amazon RDS and Azure SQL as part of the per-hour service.  Again in the case of MySQL, the latter is rendered unnecessary or replicated through Amazon RDS and Azure SQL tools.</p>
<p>If Microsoft can find business justification to offer both a .NET runtime and Apache Tomcat runtime as a service, then I wouldn&#8217;t bet on other IT vendors being solely faithful to their strategic software stack in their cloud service offerings.  I expect MySQL and Apache Tomcat will be supported by a plurality of large IT vendor cloud offerings.</p>
<p>Let&#8217;s turn our attention to the popular Apache Tomcat runtime. Covalent, now part of VMware via SpringSource, and OpenLogic are leading providers of Tomcat support.  Realizing that the scalable revenue potential is in selling products, SpringSource launched tc Server, or <em>&#8220;Apache Tomcat with enterprise management&#8221;</em>.  While I applaud the &#8220;selling products&#8221; angle, I reiterate that enterprise management not enough of a differentiator when up against cloud services from large IT vendors.</p>
<p>I still think that proprietary features in the <em>&#8220;enterprise&#8221;</em> version of the open source product, which are note available in the <em>&#8220;free community&#8221;</em> version, will be the path forward for open source vendors. Large IT vendor cloud offerings for open source products will rely on availability of the <em>&#8220;free community&#8221;</em> version and whatever features are supported in this version.  If there are compelling features outside of administration and management tooling in the <em>&#8220;enterprise&#8221;</em> version, then customers have a reason to skip the IT vendor cloud service and pay for the <em>&#8220;enterprise&#8221; </em>open source product.  I know the proprietary features suggestion is difficult for open source vendors to accept, and more importantly, difficult to rationalize in front of customers.  Difficult, but necessary.</p>
<p>In the end, there is no way that all expenditures on open source products such as MySQL or Tomcat will occur through a large IT vendor cloud service.  Clearly customers will want to use open source in their private data centers and acquire support and administration/management tooling from the open source vendor. There is also clearly an issue if IT vendors capture too much of the customer expenditure on open source products via their cloud services, leaving open source vendors behind these products to scrimp on future product development.  A happy medium will be found.  Well, it may not be happy enough for open source vendors as they watch large IT vendors capture revenue around open source products. But that&#8217;s competition for you.</p>
<p>Fun times ahead.</p>
<p>Follow me on twitter at: <a href="http://twitter.com/SavioRodrigues" target="_blank">SavioRodrigues</a></p>
<p><em>PS: I <a href="http://www.infoworld.com/d/open-source/disclaimer-explained-672">should </a>state: &#8220;The postings on this site are my own and don&#8217;t necessarily represent IBM&#8217;s positions, strategies or opinions.&#8221;</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Access to Tomcat server has not been authorized]]></title>
<link>http://pandazen.wordpress.com/2009/11/19/access-to-tomcat-server-has-not-been-authorized/</link>
<pubDate>Thu, 19 Nov 2009 09:24:56 +0000</pubDate>
<dc:creator>pandazen</dc:creator>
<guid>http://pandazen.wordpress.com/2009/11/19/access-to-tomcat-server-has-not-been-authorized/</guid>
<description><![CDATA[For the first time, when I try to deploy a project using Netbeans, i got this message, &nbsp; Deploy]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>For the first time, when I try to deploy a project using Netbeans, i got this message,</p>
<p>&#160;</p>
<div id="_mcePaste">Deployment error:</div>
<div id="_mcePaste">Access to Tomcat server has not been authorized. Set the correct username and password with the &#8220;manager&#8221; role in the Tomcat customizer in the Server Manager.</div>
<div id="_mcePaste">See the server log for details.</div>
<div></div>
<div>After I googling, the solution,</div>
<div>- edit the content of C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\conf\tomcat-users.xml file.</div>
<div>-make sure you have role = manager and user that have manager role, like this</div>
<div></div>
<div>&#60;tomcat-users&#62;<br />
&#60;role rolename=&#8221;manager&#8221;/&#62;<br />
&#60;role rolename=&#8221;standard&#8221;/&#62;<br />
&#60;user username=&#8221;admin&#8221; password=&#8221;pwd&#8221; roles=&#8221;standard,manager&#8221;/&#62;<br />
&#60;/tomcat-users&#62;</div>
<div></div>
<div>-save the file and restart Tomcat server</div>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[LSNED 16: Finding the name of a servlet from a library that it uses]]></title>
<link>http://yaytay.wordpress.com/2009/11/19/lsned-16-finding-the-name-of-a-servlet-from-a-library-that-it-uses/</link>
<pubDate>Thu, 19 Nov 2009 06:02:18 +0000</pubDate>
<dc:creator>yaytay</dc:creator>
<guid>http://yaytay.wordpress.com/2009/11/19/lsned-16-finding-the-name-of-a-servlet-from-a-library-that-it-uses/</guid>
<description><![CDATA[I have a class that performs logging for a servlet. This class is wrapped up inside a jar and is use]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have a class that performs logging for a servlet.<br />
This class is wrapped up inside a jar and is used in a number of unrelated wars that are deployed in the same tomcat instance.<br />
In order to log useful information the class in the jar file needs to know something that it is human-understandable and unique for the servlet in which is it deployed.</p>
<p>This has been bothering me for a couple of weeks, but I&#8217;ve just worked out how to do it:</p>
<pre class="brush: java;">
public class ConfigReporter implements ApplicationListener
{
    private String artifactName;

    @Override
    public void onApplicationEvent( ApplicationEvent event )
    {
        if( event instanceof ContextRefreshedEvent )
        {
            ContextRefreshedEvent refreshEvent = (ContextRefreshedEvent)event;
            this.artifactName = &#34;Unknown&#34;;
            if( refreshEvent.getApplicationContext() instanceof WebApplicationContext )
            {
                WebApplicationContext webCtx = (WebApplicationContext)refreshEvent.getApplicationContext();
                this.artifactName = webCtx.getServletContext().getContextPath();
            }
            startup();
        }
        else if( event instanceof ContextClosedEvent )
        {
            shutdown();
        }
    }
</pre>
<p>The startup method does the actual logging, but it&#8217;s the context path from the web servlet context that is the good stuff.<br />
On tomcat this gives the same name that the tomcat manager servlet uses in its list of apps.<br />
The technique should work with any servlet container, but results will vary (i.e. the name given by jetty is not the same as the name given by tomcat).</p>
<p>Clearly this is dependent upon the war file, but if the user deviates from the standard (maven) naming structure then they should still recognise their alternative name in my list.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Monitorando Servidores JAVA com JCONSOLE]]></title>
<link>http://fabioojunior.wordpress.com/2009/11/18/monitorando-servidores-java-com-jconsole/</link>
<pubDate>Wed, 18 Nov 2009 16:13:08 +0000</pubDate>
<dc:creator>FabioJr</dc:creator>
<guid>http://fabioojunior.wordpress.com/2009/11/18/monitorando-servidores-java-com-jconsole/</guid>
<description><![CDATA[Vai um café ai? Um SysAdmin que não utiliza nenhuma ferramenta de monitoramento em seus servidores, ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div class="wp-caption aligncenter" style="width: 410px"><img class="   " title="Vai um café ai?" src="http://img412.imageshack.us/img412/6320/javah.jpg" alt="cafe" width="400" height="373" /><p class="wp-caption-text">Vai um café ai?</p></div>
<p>Um SysAdmin que não utiliza nenhuma ferramenta de monitoramento em seus servidores, está correndo um grande risco. Primeiro por não ter dados mais concretos sobre o desempenho normal de seus &#8220;filhotes&#8221;. Segundo que ele não pode prever uma falha, já que pode não conseguir visualizar que o número de requisições ao Apache estão crescendo muito rapidamente, por exemplo, ou que o consumo de memória da JVM do tomcat está fora do normal.</p>
<p>Ferramentas de monitoramento é o que não falta no mercado, tanto proprietárias quanto opensource. Entre elas, posso citar: Cacti, Nagios, Munin, Ganglia, Query Analyzer (MySQL &#8211; proprietário), Zenoss, etc. Estes são os que eu lembro de cabeça, mas uma busca no Google pode encontrar muitas outras ferramentas. IMHO estatística nunca é demais. Quanto mais dados sobre o desempenho dos servidores que eu cuido eu tiver, melhor será a decisão que eu vou tomar. Tenho meu planejamento para o blog, posts específicos de cada ferramenta que eu utilizo. Espero conseguir fazer todos eles&#8230; <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><!--more--></p>
<p>Ultimamente tenho trabalho com servidores JAVA. E JAVA, se você não controlar, pode dar muita dor de cabeça, principalmente pelo uso descontrolado de memória. Sem contar que quanto melhor tunado o servidor JAVA estiver, melhor vai ser a performance da aplicação. Como eu precisava de uma ferramenta que me permitisse visualizar o comportamento do servidor, fui atras de alguma q atendesse minhas necessidades. Encontrei o santo JCONSOLE, que já vem com o próprio JAVA. Ele tem tudo que eu precisava. Monitora a memória (Utilização, Garbage Collector, Pool), Threads e Classes.</p>
<p>Para que eu consiga acessá-lo remotamente, preciso adicionar alguns parâmetros na inicialização do meu Application Server. Neste exemplo vou usar o Tomcat, mas acredito que todos os Servlets JAVA aceitem os parâmetros iguais aos que serão apresentados aqui. (Utilizo a mesma configuração no Resin por exemplo)</p>
<p>A configuração consiste em 3 passos:</p>
<ol>
<li>Setar os parametros na variável CATALINA_OPTS;</li>
<li>Criar os arquivos de controle de acesso jmxremote.access e jmxremote.password</li>
<li>Reiniciar o serviço (tomcat)</li>
</ol>
<p>1. Setando os parâmetros da variável CATALINA_OPTS:</p>
<p>As opções que vamos incluir nesta variável são:</p>
<ul>
<li>-Dcom.sun.management.jmxremote                     # permite o monitoramento da jvm remotamente</li>
<li>-Dcom.sun.management.jmxremote.port=9099      # porta que  serviço irá rodar</li>
<li>-Dcom.sun.management.jmxremote.ssl=false        # não utiliza SSL</li>
<li>-Djava.rmi.server.hostname=meuservidor.com.br  # nome do host</li>
</ul>
<p>Como aqui eu tenho um script de inicialização do tomcat, eu adiciono estas opções direto no script que fica no <em>/etc/init.d</em>, adicionando a seguinte linha ao script:</p>
<table style="background:#F5F5F5;">
<tbody><code>CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9099 -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=meuservidor.com.br"; export CATALINA_OPTS</code></tbody>
</table>
<p>Se você não tiver um script de inicialização, você pode criar e exportar a variável na mão antes de iniciar o tomcat, ou colocar a linha acima no arquivo <em>/etc/enviroment</em>, ou no <em>/etc/profile</em>, notando que o profile só é executado quando o usuário faz login na máquina. Feito isso, vamos a próxima parte.</p>
<p>2. Criando os arquivos de controle de acesso:</p>
<p>Como bom SysAdmin, eu quero que o acesso as informações da JVM tenham acesso restrito. Para isso, vamos criar os arquivos que irão controlar esse acesso. Esses arquivos ficam armazenados dentro do diretório do JAVA, e toda vez q alguma aplicação que está com o jmxremote habilitado utilizar autenticação, ele irá consultar estes arquivos, que são o jmxremote.access e jmxremote.password. Uma informação adicional é que eu posso dizer, utilizando outras opções setadas na variável CATALINA_OPTS, quais arquivos o java deve consultar para verificar as permissões de acesso, mas nesse exemplo, esta opção não vem ao caso.</p>
<p>Então, vamos entrar no diretório onde ficarão armazenados os arquivos de controle de acesso:</p>
<table style="background:#F5F5F5;">
<tbody><code># cd $JAVA_HOME/jre/lib/management</code></tbody>
</table>
<p>E agora criamos os arquivos. O conteúdo do arquivo é tão simples, que podemos utilizar o comando echo para cri-alos, já com o conteúdo desejado. neste exemplo, quero criar dois usuários, um com permissões de leitura, e outro com permissão de leitura e escrita:</p>
<table style="background:#F5F5F5;">
<tbody><code># echo "fabio readonly" &#62; jmxremote.access</code></tbody>
</table>
<table style="background:#F5F5F5;">
<tbody><code># echo "fabiow readwrite" &#62;&#62; jmxremote.access</code></tbody>
</table>
<p>Cuidado com os caracteres &#8220;&#62;&#8221; e &#8220;&#62;&#62;&#8221; para não sobrescrever o conteúdo do arquivo no segundo comando. Mesma coisa para o arquivo que armazena as senhas:</p>
<table style="background:#F5F5F5;">
<tbody><code># echo "fabio minhasenha" &#62; jmxremote.password</code></tbody>
</table>
<table style="background:#F5F5F5;">
<tbody><code># echo "fabiow minhasenha2" &#62;&#62; jmxremote.password</code></tbody>
</table>
<p>A permissão destes arquivos deve ser modificada paa 600, portanto:</p>
<table style="background:#F5F5F5;">
<tbody><code># chmod 600 jmxremote.access</code></tbody>
</table>
<table style="background:#F5F5F5;">
<tbody><code># chmod 600 jmxremote.password</code></tbody>
</table>
<p>3. Para completar, reiniciamos o serviço:</p>
<table style="background:#F5F5F5;">
<tbody><code># service tomcat restart</code></tbody>
</table>
<p>ou</p>
<table style="background:#F5F5F5;">
<tbody><code># /etc/init.d/tomcat restart</code></tbody>
</table>
<p>ou</p>
<table style="background:#F5F5F5;">
<tbody><code># sh $CATALINA_HOME/bin/shutdown.sh</code></tbody>
</table>
<table style="background:#F5F5F5;">
<tbody><code># sh $CATALINA_HOME/bin/startup.sh</code></tbody>
</table>
<p>Feito isso, verifique se o tomcat iniciou corretamente, conferindo se o processo foi criado, e dando uma olhada no log:</p>
<table style="background:#F5F5F5;">
<tbody><code># ps ax &#124;grep tomcat</code></tbody>
</table>
<table style="background:#F5F5F5;">
<tbody><code># tail -n 100 $CATALINA_HOME/logs/catalina.out</code></tbody>
</table>
<p>Se estiver tudo ok, você já pode se conectar ao servidor utilizando o jconsole.</p>
<p>PS.: Os dados coletados durante a execução do jconsole, não são armazenados. Portanto, se você desligá-lo, e ligá-lo novamente, os dados obtidos na última execução do programa não estarão mais lá, e a timeline fica vazia outra vez. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>[]s</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Monitoring the JVM]]></title>
<link>http://danielreed.wordpress.com/2009/11/17/monitoring-the-jvm/</link>
<pubDate>Tue, 17 Nov 2009 22:37:40 +0000</pubDate>
<dc:creator>daniel reed</dc:creator>
<guid>http://danielreed.wordpress.com/2009/11/17/monitoring-the-jvm/</guid>
<description><![CDATA[WebCT&#8217;s CE/Vista application provided a very robust monitoring log file that included among ot]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>WebCT&#8217;s CE/Vista application provided a very robust monitoring log file that included among other things JVM memory usage.  It doesn&#8217;t appear Bb&#8217;s Release 9 (Project NG) provides a similar log and I haven&#8217;t found a log yet that includes any system monitoring information.  <a href="http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html" target="new">JConsole</a> can be used to monitor Tomcat in Bb&#8217;s Release 9 (Project NG) application.  JConsole will give you a nice view of how Tomcat is running but it&#8217;s probably not a good long term monitoring solution.  Run a <em>ps -ef &#124; grep java</em> to find the Tomcat&#8217;s PID and run a <em>jconsole [PID]</em>.  JConsole will give you a good look at the memory usage, garbage collection statistics, and thread information.</p>
<div id="attachment_246" class="wp-caption aligncenter" style="width: 310px"><a href="http://danielreed.wordpress.com/files/2009/11/jconsole-overview.png"><img class="size-medium wp-image-246" title="jconsole-overview" src="http://danielreed.wordpress.com/files/2009/11/jconsole-overview.png?w=300" alt="JConsole Overview" width="300" height="250" /></a><p class="wp-caption-text">JConsole Overview</p></div>
<div id="attachment_247" class="wp-caption aligncenter" style="width: 310px"><a href="http://danielreed.wordpress.com/files/2009/11/jconsole-summary.png"><img class="size-medium wp-image-247" title="jconsole-summary" src="http://danielreed.wordpress.com/files/2009/11/jconsole-summary.png?w=300" alt="JConsole VM Summary" width="300" height="281" /></a><p class="wp-caption-text">JConsole VM Summary</p></div>
<p>The JConsole tool is a JMX compliant GUI tool that connects to a running JVM, which started with the management agent.  JConsole is built on top of the <a href="http://java.sun.com/javase/6/docs/api/java/lang/management/ManagementFactory.html" target="new">java.lang.management API</a>.  To run JConsole (if the bin directory of the SDK is in your path) just type <em>jconsole</em>.  JConsole will open a dialog box where you can choose to monitor a local or remote process.  You can also start JConsole for local monitoring by running <em>jconsole [processID]</em> where processID is the application&#8217;s process ID (PID).</p>
<p>One important note about JConsole:<br />
Using jconsole to monitor a local application is useful for development and prototyping, but is not recommended for production environments, because jconsole itself consumes significant system resources. Remote monitoring is recommended to isolate the jconsole application from the platform being monitored.</p>
<p>One of the new features in Java 2 Platform, Standard Edition (J2SE) 5.0 is an API that provides monitoring and management support of the Java virtual machine (JVM).  You can manage and monitor the JVM, applications and the operating system.  Using JMX technology the platform management API (java.lang.management package) provides access to well defined objects called MXBeans.  MXBeans are also referred to as platform MBeans.  Each MXBean encapsulates a single functional area of the JVM.</p>
<p>You can use JMX to programatically retrieve all the information that JConsole displays.  I struggled for some time figuring this out.  You&#8217;ll need to use the <a href="http://java.sun.com/javase/6/docs/technotes/guides/attach/index.html" target="new">Java Attach API</a> to connect to the Tomcat JVM via Tomcat&#8217;s PID.  This Java program will connect to a VM and print VM, class, thread, memory and OS information:</p>
<pre class="brush: java;">
import com.sun.tools.attach.*;
import java.io.File;
import java.lang.management.ClassLoadingMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.OperatingSystemMXBean;
import java.lang.management.RuntimeMXBean;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

public class Attach {

    static final String CONNECTOR_ADDRESS = &#34;com.sun.management.jmxremote.localConnectorAddress&#34;;

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

        // attach to target VM via a PID
        VirtualMachine vm = VirtualMachine.attach(&#34;5480&#34;);

        // get the connector address
        String connectorAddress = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);

        // no connector address, so we start the JMX agent
        if (connectorAddress == null) {
           String agent = vm.getSystemProperties().getProperty(&#34;java.home&#34;) +
               File.separator + &#34;lib&#34; + File.separator + &#34;management-agent.jar&#34;;
           vm.loadAgent(agent);

           // agent is started, get the connector address
           connectorAddress = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
        }

        // establish connection to connector server
        JMXServiceURL url = new JMXServiceURL(connectorAddress);
        JMXConnector JMXConnector = JMXConnectorFactory.connect(url);
        MBeanServerConnection connection = JMXConnector.getMBeanServerConnection();

        RuntimeMXBean remoteRuntime = ManagementFactory.newPlatformMXBeanProxy(connection, ManagementFactory.RUNTIME_MXBEAN_NAME,RuntimeMXBean.class);
        System.out.println(&#34;Target VM is: &#34;+remoteRuntime.getName());
        System.out.println(&#34;Started since: &#34;+remoteRuntime.getUptime());
        System.out.println(&#34;With Classpath: &#34;+remoteRuntime.getClassPath());
        System.out.println(&#34;Args: &#34;+remoteRuntime.getInputArguments());
        System.out.println(&#34;Bootpath: &#34;+remoteRuntime.getBootClassPath());
        System.out.println(&#34;Spec Name: &#34;+remoteRuntime.getSpecName());
        System.out.println(&#34;Spec Vendor: &#34;+remoteRuntime.getSpecVendor());
        System.out.println(&#34;VM Name: &#34;+remoteRuntime.getVmName());
        System.out.println(&#34;VM Version: &#34;+remoteRuntime.getVmVersion());
        System.out.println();

        ClassLoadingMXBean remoteClass =  ManagementFactory.newPlatformMXBeanProxy(connection, ManagementFactory.CLASS_LOADING_MXBEAN_NAME,ClassLoadingMXBean.class);
        System.out.println(&#34;Current Classes Loaded: &#34;+remoteClass.getLoadedClassCount());
        System.out.println(&#34;Total Classes Loaded: &#34;+remoteClass.getTotalLoadedClassCount());
        System.out.println(&#34;Total Classes Unloaded: &#34;+remoteClass.getUnloadedClassCount());
        System.out.println();

        ThreadMXBean remoteThread = ManagementFactory.newPlatformMXBeanProxy(connection, ManagementFactory.THREAD_MXBEAN_NAME,ThreadMXBean.class);
        System.out.println(&#34;Thread Count: &#34;+remoteThread.getThreadCount());
        System.out.println(&#34;Peak Thread Count: &#34;+remoteThread.getPeakThreadCount());
        System.out.println(&#34;Daemon Thread Count: &#34;+remoteThread.getDaemonThreadCount());
        long[] tids = remoteThread.getAllThreadIds();
        for (int i = 0; i &#38;lt; tids.length; ++i) {
                ThreadInfo tinfo = remoteThread.getThreadInfo(tids[i]);
                System.out.println(&#38;quot;Thread name = &#38;quot; + tinfo.getThreadName());
        }
        System.out.println();

        MemoryMXBean remoteMemory = ManagementFactory.newPlatformMXBeanProxy(connection, ManagementFactory.MEMORY_MXBEAN_NAME,MemoryMXBean.class);
        System.out.println(&#38;quot;Committed: &#38;quot;+remoteMemory.getHeapMemoryUsage().getCommitted());
        System.out.println(&#38;quot;Init: &#38;quot;+remoteMemory.getHeapMemoryUsage().getInit());
        System.out.println(&#38;quot;Max: &#38;quot;+remoteMemory.getHeapMemoryUsage().getMax());
        System.out.println(&#38;quot;Used: &#38;quot;+remoteMemory.getHeapMemoryUsage().getUsed());
        System.out.println();

        OperatingSystemMXBean remoteOS = ManagementFactory.newPlatformMXBeanProxy(connection, ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,OperatingSystemMXBean.class);
        System.out.println(&#38;quot;OS Arch: &#38;quot;+remoteOS.getArch());
        System.out.println(&#38;quot;Number of procs: &#38;quot;+remoteOS.getAvailableProcessors());
        System.out.println(&#38;quot;OS Load: &#38;quot;+remoteOS.getSystemLoadAverage());

    }

}
</pre>
<p>These links are also very helpful:<br />
<a href="http://www.ibm.com/developerworks/java/library/j-mxbeans/" target="new">Using Java platform management beans</a><br />
<a href="http://blogs.sun.com/jmxetc/entry/how_to_retrieve_remote_jvm" target="new">How To Retrieve Remote JVM Monitoring And Management Information</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[[tomcat] Configurando o DBCP para o Oracle XE]]></title>
<link>http://ldiasrs.wordpress.com/2009/11/17/tomcat-configurando-o-dbcp-para-o-oracle-xe/</link>
<pubDate>Tue, 17 Nov 2009 12:06:54 +0000</pubDate>
<dc:creator>ldiasrs</dc:creator>
<guid>http://ldiasrs.wordpress.com/2009/11/17/tomcat-configurando-o-dbcp-para-o-oracle-xe/</guid>
<description><![CDATA[Abaixo segue um passo a passo de como configurar o DBCP (pool de conexões)  do Tomcat 6.0 para o Ora]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Abaixo segue um passo a passo de como configurar o DBCP (pool de conexões)  do Tomcat 6.0 para o Oracle XE</p>
<li> Copiar copiar o jar do driver Oracle(ojdbc14-10.2.0.3.jar) para <em>$CATALINA_HOME/lib/</em></li>
<li> No Tomcat 6.0 os jars do DBCP já estão presentes.</li>
<li> Configurar o arquivo Context(context.xml)<code>
<pre>
&#60; Resource name="jdbc/myoracle" auth="Container"
              type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:@127.0.0.1:1521:mysid"
              username="scott" password="tiger" maxActive="20" maxIdle="10"
              maxWait="-1" /&#62;</pre>
<p></code></li>
<li> Configurar o arquivo web.xml<code>
<pre>
&#60; description &#62;Oracle Datasource example&#60; /description &#62;
 &#60; res-ref-name &#62;jdbc/myoracle&#60; /res-ref-name &#62;
 &#60; res-type &#62;javax.sql.DataSource&#60; /res-type &#62;
 &#60; res-auth &#62;Container&#60; /res-auth &#62;
&#60; /resource-ref &#62;</pre>
<p></code></li>
<li> Exemplo Java: acessando uma nova conexão<code>
<pre>
Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
//etc.</pre>
<p></code><br />
<a href="http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20%28DBCP%29%20Configurations">REFERÊNCIA</a></li>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[java.lang.UnsupportedClassVersionError: Bad version number in .class file]]></title>
<link>http://bernytech.wordpress.com/2009/11/13/java-lang-unsupportedclassversionerror-bad-version-number-in-class-file/</link>
<pubDate>Fri, 13 Nov 2009 19:04:10 +0000</pubDate>
<dc:creator>bernytech</dc:creator>
<guid>http://bernytech.wordpress.com/2009/11/13/java-lang-unsupportedclassversionerror-bad-version-number-in-class-file/</guid>
<description><![CDATA[So this error appeared after I compiled my java classes, packaged them in a war, and deployed it to ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>So this error appeared after I compiled my java classes, packaged them in a war, and deployed it to the application server.  The only major change that happened to my system was an upgrade to Snow Leopard.  I searched the web forums and discovered that this issue is due to compiling the java classes with a different Java compiler version than the JVM version on the application server.</p>
<p>How can this be?  It was working fine all this time.  I checked my JAVA_HOME environment variable and it was pointing to a JVM-specific directory:  1.X.0</p>
<p>On the command line, I typed:  </p>
<p>javac -version </p>
<p>and it returned the latest version.  So I thought that maybe the OS upgrade overrided my default Java compiler.  I started to look into the ant file to find a task attribute to point to a specific JVM.  After redeployment, the error still persisted.</p>
<p>So finally, I thought about testing the actual java compiler, in the 1.X.0 directory.  I typed: javac -version and it returned again the latest version.  I tried:  ./javac -version.. the results are the same.</p>
<p>Then I traversed to the other previous versioned directories.  All of them returned the latest version. </p>
<p>This was really odd.  So finally, I decided to override all the directories from the AWESOME Time Machine.  Specifically, I replaced the directories with the directories before the OS upgrade.  </p>
<p>I ran the compilation and deployment and the issue is RESOLVED.  </p>
<p>I&#8217;m not sure why Snow Leopard overrided my directories with the latest Java compiler, but I&#8217;m glad the war file is deployable.  If I didn&#8217;t discover this issue, then it  would have caused me unneccessary stress and panic if it was a release day.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How do I set up Tomcat on my mac for deploying apps on my local machine?]]></title>
<link>http://simisjavatips.wordpress.com/2009/11/13/how-do-i-set-up-tomcat-on-my-mac-for-deploying-apps-on-my-local-machine/</link>
<pubDate>Fri, 13 Nov 2009 17:41:58 +0000</pubDate>
<dc:creator>Simi</dc:creator>
<guid>http://simisjavatips.wordpress.com/2009/11/13/how-do-i-set-up-tomcat-on-my-mac-for-deploying-apps-on-my-local-machine/</guid>
<description><![CDATA[1. Dowload the tar.gz package. 2. Copy the tar.gz package to /usr/local folder 3. Unzip the tar.gz p]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>1. Dowload the tar.gz package.<br />
2. Copy the tar.gz package to /usr/local folder<br />
3. Unzip the tar.gz package<br />
<code>&#62;&#62; tar -xzf</code><br />
4. Create a symbolic link to the tomcat package for simplified upgrades<br />
<code>&#62;&#62; sudo ln -s /usr/local/ /usr/local/tomcat</code><br />
5. Change the ownership of the folders to nobody to make for restrictive running of tomcat<br />
<code>&#62;&#62; chown -R nobody:nobody /usr/local/tomcat</code><br />
6. Create scripts to start and stop tomcat (my preference is in ~/bin)<br />
a. start_tomcat<br />
<code>#! bin/sh<br />
export $CATALINA_HOME= /usr/local/tomcat<br />
export $JAVA_HOME= /usr/java<br />
$CATALINA_HOME/bin/startup.sh<br />
</code><br />
b. stop_tomcat<br />
<code>#! bin/sh<br />
export $CATALINA_HOME= /usr/local/tomcat<br />
export $JAVA_HOME= /usr/java<br />
$CATALINA_HOME/bin/shutdown.sh<br />
</code></p>
<p><strong>Note:</strong><br />
a. The $JAVA_HOME line assumes you are using default OS Java package.<br />
b. To use a different version of Java than the default look at the versions in the<br />
/System/Library/Frameworks/JavaVM.framework/Versions/ folder and set the $JAVA_HOME<br />
variable to the appropriate version<br />
c. I highly recommend using the scripts you create to startup and shutdown tomcat because<br />
I have notices that the $JAVA_HOME variables can be set very weirdly if it is done on<br />
the command line if it is not.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Portal de Informações Embratel]]></title>
<link>http://raphaelrodrigues.wordpress.com/2009/11/13/portal-de-informacoes-embratel/</link>
<pubDate>Fri, 13 Nov 2009 17:21:58 +0000</pubDate>
<dc:creator>raphaelrodrigues</dc:creator>
<guid>http://raphaelrodrigues.wordpress.com/2009/11/13/portal-de-informacoes-embratel/</guid>
<description><![CDATA[Portal de Informações da Via Embratel. Os dados são carregados de forma massiva por arquivo, e visua]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div id="attachment_113" class="wp-caption aligncenter" style="width: 460px"> </dt>
</dl>
</div>
<p>Portal de Informações da Via Embratel. Os dados são carregados de forma massiva por arquivo, e visualizados no WebSite. Conta com visualização de Notícias e download de Arquivos.</p>
<div>
<dl>
<dt><img title="portal1" src="http://raphaelrodrigues.wordpress.com/files/2009/11/portal1.png" alt="portal1" width="450" height="337" /></dt>
<dd>login</dd>
</dl>
</div>
<div class="mceTemp mceIEcenter">
<dl class="wp-caption aligncenter">
<dt class="wp-caption-dt"><img class="size-full wp-image-114" title="portal2" src="http://raphaelrodrigues.wordpress.com/files/2009/11/portal2.png" alt="portal2" width="450" height="337" /><p class="wp-caption-text">main</p></div>
<div id="attachment_115" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-115" title="portal3" src="http://raphaelrodrigues.wordpress.com/files/2009/11/portal3.png" alt="portal3" width="450" height="337" /><p class="wp-caption-text">Noticia</p></div>
<div id="attachment_116" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-116" title="portal4" src="http://raphaelrodrigues.wordpress.com/files/2009/11/portal4.png" alt="portal4" width="450" height="337" /><p class="wp-caption-text">busca</p></div>
<p><em>..: Atuação</em></p>
<p>Atuação como Analista/Desenvolvedor JEE.</p>
<p><em>..: Cliente</em></p>
<p>Via Embratel</p>
<p><em>..: Tipo / Ano<br />
</em></p>
<p>Sistema Web / 2009</p>
<p><em>..: Tecnologias</em></p>
<p>Java, JEE, Oracle DB, Apache Tomcat, JPA/Hibernate, JSF/Jboss Rich-Faces,  Jboss Seam</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Weblogic, sql-taglib and JNDI: DataSource invalid: No suitable driver found]]></title>
<link>http://mycontainer.wordpress.com/2009/11/12/weblogic-sql-taglib-and-jndi-datasource-invalid-no-suitable-driver-found/</link>
<pubDate>Thu, 12 Nov 2009 15:19:46 +0000</pubDate>
<dc:creator>wirbelschleppe</dc:creator>
<guid>http://mycontainer.wordpress.com/2009/11/12/weblogic-sql-taglib-and-jndi-datasource-invalid-no-suitable-driver-found/</guid>
<description><![CDATA[On a Weblogic 10 environment, you may get an error like javax.servlet.ServletException: javax.servle]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>On a Weblogic 10 environment, you may get an error like<br />
<em>javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: &#8220;java.sql.SQLException: No suitable driver found for jndi_ds</em><br />
if you are using the sql-taglib to access your JNDI name from the Weblogic application server, configured via the Weblogic console.</p>
<p>The solution is quiet simple, but not that good documented. It is <strong>not</strong> possible to use the paramter &#8220;driver&#8221; inside the sql:setDataSource &#8211; tag. You rather have to promote the JNDI name in your web.xml like this:</p>
<pre>&#60;resource-ref&#62;
&#60;res-ref-name&#62;jndi_ds&#60;/res-ref-name&#62;
&#60;res-type&#62;javax.sql.DataSource&#60;/res-type&#62;
&#60;res-auth&#62;Container&#60;/res-auth&#62;
&#60;/resource-ref&#62;
</pre>
<p>Than you can set the dataSource with the sql:setDataSource &#8211; tag like this:</p>
<pre>&#60;sql:setDataSource dataSource="jndi_ds" /&#62;
</pre>
<p>and finally use the sql-taglib as you did in any other environment like Tomcat server and so on.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[:: Error de inicio automatico de Tomcat con Windows XP &amp; Vista ::]]></title>
<link>http://ricknr.wordpress.com/2009/11/11/error-de-inicio-automatico-de-tomcat-con-windows-xp-vista/</link>
<pubDate>Thu, 12 Nov 2009 01:52:32 +0000</pubDate>
<dc:creator>Ricardo Nuñez</dc:creator>
<guid>http://ricknr.wordpress.com/2009/11/11/error-de-inicio-automatico-de-tomcat-con-windows-xp-vista/</guid>
<description><![CDATA[Siempre, al instalar el Tomcat, cualquier version, tenia el problema de que no podia iniciarse solo,]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img class="alignleft" title="tomcat" src="http://manchitrax0.files.wordpress.com/2008/08/apache-tomcat.gif?w=100&#038;h=71" alt="" width="100" height="71" />Siempre, al instalar el Tomcat, cualquier version, tenia el problema de que no podia iniciarse solo, lo terminaba iniciando mediante el Eclipse u otro programa por el estilo. Se instalaba bien, hacia todo correcto, pero al configurarlo para ke arrancara solo me marcaba un error al tratar de iniciar el servicio. Me di cuenta que solo me lo mostrraba cuando lo instalaba en Windows XP SP2 y en algunas ocasiones con Windows Vista Home Premium, buscando, di con el error.</p>
<p>El error esta en una libreria que falta y que Tomcat no instala, dicha libreria es necesaria para arrancar el Tomcat automaticamente al encender Windows. Para aquellos que tienen este mismo problema, aqui esta la solución.</p>
<p>La solución es muy sencilla, solo tienes que bajar la libreria que se llama msvcr71.dll de <a title="Descargar libreria MSVCR71.DLL" href="http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71" target="_blank">aqui</a> y pegarla dentro de la carpeta de Windows/System32.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Tomcat Native Library not found]]></title>
<link>http://gwinnem.wordpress.com/2009/11/10/tomcat-native-library-not-found/</link>
<pubDate>Tue, 10 Nov 2009 19:25:13 +0000</pubDate>
<dc:creator>gwinnem</dc:creator>
<guid>http://gwinnem.wordpress.com/2009/11/10/tomcat-native-library-not-found/</guid>
<description><![CDATA[Have you ever seen this when you are starting up tomcat ? This is because your tomcat installation i]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Have you ever seen this when you are starting up tomcat ?<br />
<img src="http://gwinnem.wordpress.com/files/2009/11/tomcat-error.gif" alt="tomcat error" title="tomcat error" width="803" height="62" class="aligncenter size-full wp-image-33" /></p>
<p>This is because your tomcat installation is not installed with the native apache portable runtime.<br />
Although this is ok in a development environment, its not recomended for production.<br />
In order to have a optimized server with proper scalabillity you should install this on a production server.</p>
<p>For more reading about the subject: <a href="http://tomcat.apache.org/tomcat-6.0-doc/apr.html">Tomcat 6.0 documentation</a></p>
<p><strong>How to install it</strong><br />
Download the correct dll from one of the links:<br />
<a href="http://www.powertech.no/apache/dist/tomcat/tomcat-connectors/native/1.1.16/binaries/win32/">Windows 32 dll</a><br />
<a href="http://www.powertech.no/apache/dist/tomcat/tomcat-connectors/native/1.1.16/binaries/win64/">Windows 64 dlls</a></p>
<p>Copy the dll to the bin directory of your tomcat server:<br />
<img src="http://gwinnem.wordpress.com/files/2009/11/tomcatnative3.gif" alt="tomcatnative" title="tomcatnative" width="800" height="600" class="aligncenter size-full wp-image-42" /></p>
<p>Make sure that the bin directory is in the path before starting up tomcat again.<br />
<img src="http://gwinnem.wordpress.com/files/2009/11/tomcatnativeok1.gif" alt="tomcatnativeok" title="tomcatnativeok" width="837" height="220" class="aligncenter size-full wp-image-43" /></p>
<p>Voila <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How to get a thread-dump from Tomcat or JBoss]]></title>
<link>http://freddyandersen.wordpress.com/2009/11/10/how-to-get-a-thread-dump-from-tomcat-or-jboss/</link>
<pubDate>Tue, 10 Nov 2009 18:21:17 +0000</pubDate>
<dc:creator>Freddy</dc:creator>
<guid>http://freddyandersen.wordpress.com/2009/11/10/how-to-get-a-thread-dump-from-tomcat-or-jboss/</guid>
<description><![CDATA[Getting a thread-dump is one of the first steps in troubleshooting a misbehaving Java application. T]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Getting a thread-dump is one of the first steps in troubleshooting a misbehaving Java application. There are a few good ways todo this task but the easiest of them all is</p>
<h3><strong>kill -3 &#60;PID&#62;</strong></h3>
<p>This will send the thread-dump to your stdout logs.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Do you know JFastCGI ?]]></title>
<link>http://jrialland.wordpress.com/2009/11/10/do-you-know-jfastcgi/</link>
<pubDate>Tue, 10 Nov 2009 12:56:38 +0000</pubDate>
<dc:creator>jrialland</dc:creator>
<guid>http://jrialland.wordpress.com/2009/11/10/do-you-know-jfastcgi/</guid>
<description><![CDATA[JFastCGI est un projet sous licence BSD démarré il y a quelques mois maintenant. Le but est de perme]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://sourceforge.net/projects/jfastcgi">JFastCGI</a> est un projet sous licence BSD démarré il y a quelques mois maintenant. Le but est de permettre a un container de servlet (type tomcat ou jetty) de servir des pages générées par une application compatible <a href="http://www.fastcgi.com">fastCGI</a>.</p>
<p>Cela permet par exemple de servir des pages PHP interprétées par le moteur PHP officiel sans avoir a utiliser un serveur apache.</p>
<p>La version 1.1 est &#8220;en prod&#8221;, et la version 2.0, qui introduit la notion de pool de connexion entre une application tomcat et plusieurs &#8220;serveurs&#8221; fastcgi est en cours de tests (j&#8217;en ai profité pour créer un ensemble de tests unitaires, utilisant <a href="http://mockrunner.sourceforge.net/">mockrunner</a>). Elle permettra un énorme gain de performance pour les applications fortement sollicitées !</p>
<p>La version 2.0 ajoute aussi une meilleur intégration avec Spring, en implémentant <a href="http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/web/HttpRequestHandler.html">HttpRequestHandler</a>.</p>
<p>&#160;</p>
<p>Des contacts ont même étés pris avec l&#8217;équipe de développement de <a href="https://glassfish.dev.java.net/">Glassfish</a>, dont jfastcgi pourrait devenir un module optionnel de la version 3 &#8230;</p>
<p>Bref, cette librairie semble promise a un bel avenir, et permet d&#8217;utiliser les serveurs en java de manière moins &#8220;fermée&#8221; mais ce projet demande à gagner en maturité, <strong>votre aide est la bienvenue !</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Apache frontend Tomcat]]></title>
<link>http://wuhai.wordpress.com/2009/11/10/apache-frontend-tomcat/</link>
<pubDate>Tue, 10 Nov 2009 07:10:53 +0000</pubDate>
<dc:creator>wuhai</dc:creator>
<guid>http://wuhai.wordpress.com/2009/11/10/apache-frontend-tomcat/</guid>
<description><![CDATA[For Apache to be front end of Tomcat: Say appname is at http://servername:8080/appname 1. Redirect /]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>For Apache to be front end of Tomcat:</p>
<p>Say appname is at http://servername:8080/appname</p>
<p>1.<br />
Redirect / http://servername/appname/<br />
ProxyPass /appname/ http://localhost:8080/appname/<br />
ProxyPassReverse /appname/ http://localhost:8080/appname/</p>
<p>2.<br />
LoadModule jk_module modules/mod_jk.so<br />
JkWorkersFile /etc/httpd/conf/workers.properties<br />
JkShmFile /var/log/httpd/mod_jk.shm<br />
JkLogFile /var/log/httpd/mod_jk.log<br />
JkLogLevel info<br />
JkLogStampFormat &#8220;[%a %b %d %H:%M:%S %Y]&#8220;</p>
<p>$ cat /etc/httpd/conf/workers.properties<br />
# Define 1 real worker using ajp13<br />
worker.list=worker1<br />
# Set properties for worker1 (ajp13)<br />
worker.worker1.type=ajp13<br />
worker.worker1.host=localhost<br />
worker.worker1.port=8009</p>
<p>(virtual host config)<br />
RewriteEngine on<br />
Rewriterule ^/$ /appname/ [R=301]<br />
JkMount /appname/ worker1<br />
JkMount /appname/* worker1</p>
<p>3. conf.d/proxy_ajp.conf:<br />
uncomment:<br />
ProxyPass /appname/ ajp://localhost:8009/appname/</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[nadszedł czas na porządną naukę JSP i nie tylko]]></title>
<link>http://threemode.wordpress.com/2009/11/09/nadszedl-czas-na-porzadna-nauke-jsp-i-nie-tylko/</link>
<pubDate>Mon, 09 Nov 2009 16:23:31 +0000</pubDate>
<dc:creator>m4ck7</dc:creator>
<guid>http://threemode.wordpress.com/2009/11/09/nadszedl-czas-na-porzadna-nauke-jsp-i-nie-tylko/</guid>
<description><![CDATA[W końcu zabrałem się za czytanie książek o JSP. Póki co ustawiłem Tomcat&#8217; a i bazę danych MySQ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>W końcu zabrałem się za czytanie książek o JSP. Póki co ustawiłem Tomcat&#8217; a i bazę danych MySQL. Mam zamiar stworzyć galerię zdjęć dodawanych za pomocą komórki tzn. jeszcze będę musiał napisać aplikacje J2ME by móc cokolwiek wysyłać z komórki ale mam nadzieje że się uda dość szybko to zrobić. Przede mną jeszcze rozwikłanie zagadki jak to ze sobą połączyć i jak wykorzystuje się połączenie z internetem w komórkach do przesyłania danych. A potem jak aplikacja ma odbierać te dane i gdzie je składować. Tak więc troszkę jest :] Ale przynajmniej ciekawi mnie to.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Windows 7 + Tomcat]]></title>
<link>http://coffeearmy.wordpress.com/2009/11/08/windows-7-tomcat/</link>
<pubDate>Sun, 08 Nov 2009 12:21:43 +0000</pubDate>
<dc:creator>alisblack</dc:creator>
<guid>http://coffeearmy.wordpress.com/2009/11/08/windows-7-tomcat/</guid>
<description><![CDATA[Para el proyecto que estoy realizando para una de mis asignaturas, he tenido que intalar Tomcat para]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Para el proyecto que estoy realizando para una de mis asignaturas, he tenido que intalar Tomcat  para hacer unos servidores Web con SOAP.<br />
Aunque aun mi odisea no a terminado, he tenido algunos problemas y algunas soluciones:</p>
<ul>
<li> Es mejor no instalar tomcat con ejecutable, es mejor bajarse el zip, ya que netbeans necesita unos archivos que instalador no instala.</li>
<li>Si da problemas del tipo no se ha encontrado archivo en /conf/catalina/localhot es por que teneis mal los permisos darle permisos a todo . Cuando probe el Tomcat con Eclipse con esta solución ya funcionaba, pero con Netbeans no.</li>
<li>Si dando permisos aun no conseguis que funcione el Tomcat con Neatbeans, lo mejor que podeis hacer es copiarlo a la C: donde al fin he conseguido que vaya.</li>
</ul>
<p>Proximamente como pude crear un SW en netbeans, en Eclipse me he dado por vencida.</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
