<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bruno Pereira &#187; jboss</title>
	<atom:link href="http://brunopereira.org/tag/jboss/feed/" rel="self" type="application/rss+xml" />
	<link>http://brunopereira.org</link>
	<description>Open source, Java, web, python, client-side e outros hobbies :)</description>
	<lastBuildDate>Thu, 20 Oct 2011 00:47:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException</title>
		<link>http://brunopereira.org/2010/07/16/com-mysql-jdbc-exceptions-jdbc4-mysqlnontransientconnectionexception/</link>
		<comments>http://brunopereira.org/2010/07/16/com-mysql-jdbc-exceptions-jdbc4-mysqlnontransientconnectionexception/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 03:27:40 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[autoreconnect]]></category>
		<category><![CDATA[datasource]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=362</guid>
		<description><![CDATA[O título deste post é uma exceção do driver do MySql que ocorre em algumas situações e pode ser difícil de diagnosticar a causa. A mensagem completa é: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
Tive este problema em um ambiente de QA essa semana e vou deixar aqui informações que devem [...]]]></description>
			<content:encoded><![CDATA[<p>O título deste post é uma exceção do driver do MySql que ocorre em algumas situações e pode ser difícil de diagnosticar a causa. A mensagem completa é: <strong>com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.</strong></p>
<p>Tive este problema em um ambiente de QA essa semana e vou deixar aqui informações que devem solucionar a maioria dos problemas relacionados. Há 2400 resultados no Google sobre MySQLNonTransientConnectionException, deve ter ocorrido muito já.</p>
<p>Esta exceção é lançada quando uma aplicação Java tenta utilizar uma conexão, mas ela já foi fechada no MySql. Os cenários mais comuns para isso são:</p>
<ul>
<li>MySql foi reiniciado</li>
<li>Problema de rede na conexão com MySql</li>
<li>Conexão ficou ociosa tempo demais, e o MySql fechou-a</li>
</ul>
<p>Estes cenários podem ser raros na sua infra, mas é importante que sua aplicação consiga lidar com isso. Minha aplicação usa o Hibernate, conectado a um pool de conexões do JBoss. O datasource em QA estava configurado assim:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;datasources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;local-tx-datasource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jndi-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>NomeDS<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jndi-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;connection-url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jdbc:mysql://servidormysql:3306/nome_schema<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/connection-url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;driver-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.mysql.jdbc.Driver<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/driver-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;user-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>usuario<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/user-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>senha<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;min-pool-size<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/min-pool-size<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;max-pool-size<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>20<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/max-pool-size<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exception-sorter-class-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exception-sorter-class-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mySQL<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/local-tx-datasource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/datasources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>A solução no meu caso foi incluir um novo parâmetro no datasource indicando uma query para o JBoss checar se a conexão é válida ou não: <strong>&lt;check-valid-connection-sql&gt;select 1&lt;/check-valid-connection-sql&gt;</strong>. Este elemento é filho de <strong>&lt;local-tx-datasource&gt;</strong>. Com a introdução deste parâmetro, o JBoss consegue identificar que a conexão já não é válida e então obtém uma nova conexão.</p>
<p>Nas minhas buscas vi muitas pessoas com esse problema rodando no Tomcat sem um pool de conexões. A solução para eles foi criar um pool com C3P0, como <a href="http://seamframework.org/Community/JDBCCommitFailed">nesse exemplo</a>. É importante prestar atenção na configuração para que seja feita a renovação das conexões em caso de falha. Isto parece ser feito com o parâmetro no C3P0: <strong>&lt;property name=&#8221;connection.provider_class&#8221;&gt;org.hibernate.connection.C3P0ConnectionProvider&lt;/property&gt;</strong></p>
<p>Observação importante: colocar o parâmetro ?autoReconnect=true na URL jdbc NÃO resolve o problema, só muda a exceção. Além disso, <a href="http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html">o parâmetro autoReconnect é deprecated e não é recomendada a utilização</a>.</p>
<p>That&#8217;s all folks!</p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2010/07/16/com-mysql-jdbc-exceptions-jdbc4-mysqlnontransientconnectionexception/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>A importância do open source profissional</title>
		<link>http://brunopereira.org/2009/05/18/a-importancia-do-open-source-profissional/</link>
		<comments>http://brunopereira.org/2009/05/18/a-importancia-do-open-source-profissional/#comments</comments>
		<pubDate>Mon, 18 May 2009 05:28:23 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[posts em português]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[spring source]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=340</guid>
		<description><![CDATA[Continuando o tema do meu artigo anterior, agora quero falar sobre a importância do open source profissional.
Na última quinta-feira eu fui na palestra do Bruno Borges no RioJUG, sobre Apache Camel. A palestra em si foi bem legal, pois eu já conhecia um pouco do Apache Camel e pude ver algumas coisas a mais. Mas [...]]]></description>
			<content:encoded><![CDATA[<p>Continuando o tema do <a href="http://brunopereira.org/2009/05/18/as-diferentes-culturas-open-source-ubuntu-x-debian/" target="_blank">meu artigo anterior</a>, agora quero falar sobre a importância do open source profissional.</p>
<p>Na última quinta-feira eu fui na palestra do <a href="http://blog.brunoborges.com.br/" target="_blank">Bruno Borges</a> no <a href="http://www.riojug.org" target="_blank">RioJUG</a>, <a href="http://www.riojug.org/blog/?p=79" target="_blank">sobre Apache Camel</a>. A palestra em si foi bem legal, pois eu já conhecia um pouco do <a href="http://camel.apache.org/" target="_blank">Apache Camel</a> e pude ver algumas coisas a mais. Mas o ponto específico que eu quero abordar é um comentário que o Bruno fez, que diverge da minha postura em relação a open source.</p>
<p>Ele comentou que tenta sempre utilizar produtos <a href="http://www.apache.org" target="_blank">Apache</a>, evitando produtos open source que tenham vínculo com alguma empresa, como <a href="http://www.jboss.org/" target="_blank">JBoss</a>, <a href="http://www.springsource.com/" target="_blank">SpringSource</a>, entre outras. Não me recordo do motivo exato, mas a razão principal que ele explicou é o fato da Apache Software Foundation ser uma fundação composta de pessoas, em vez de ser uma empresa com fins comerciais.</p>
<p>Eu tenho uma postura diferente da dele em relação a open source. Eu gosto muito e tenho um respeito enorme pela fundação Apache. Já usei inúmeros produtos Apache e certamente continuarei usando por muito tempo. Entretanto, já usei vários produtos <a href="http://www.jboss.org" target="_blank">JBoss</a> e vários componentes do <a href="http://www.springsource.org/" target="_blank">Spring</a>, e acho muito importante e saudável a existência dessas empresas.</p>
<p>A história do movimento open source tem vários elementos &#8220;românticos&#8221; e &#8220;filosóficos&#8221;, e essa característica ainda é muito presente em várias comunidades hoje em dia. Entretanto, com o crescimento do Linux, Java, Python, Ruby e outras tecnologias, existe hoje um mercado enorme de trabalho e negócios em torno do software livre.</p>
<p>O surgimento desse mercado naturalmente trouxe a participação de muitas empresas que vivem de software livre atualmente. Sei que há pessoas que enxergam open source e capitalismo como coisas opostas, mas na minha opinião essa visão é míope. Open source é um modelo de desenvolvimento de software e oferta de produtos e serviços. A busca do lucro é o que move nossas empresas, e isso não é diferente para quem atua com software livre.</p>
<p>O surgimento das empresas profissionais open source foi importantíssimo para o amadurecimento das tecnologias e dos profissionais. Se o movimento open source continuasse restrito ao meio acadêmico, o nível de competição no mercado de software seria muito menor, e o avanço tecnológico teria sido bem mais lento.</p>
<p>Além disso, minha postura profissional é de tentar sempre entregar os melhores resultados para os clientes e para a empresa em que trabalho. Em algumas situações pode ser mais adequado usar open source, em outras pode ser necessário usar software proprietário. Temos que nos adequar às necessidades dos clientes, em vez de esperar que eles se adeqüem às nossas preferências.</p>
<p>No meu ponto de vista, empresas como JBoss e SpringSource contribuíram e contribuem muito no processo de profissionalização do software livre. A existência delas criou um mercado fortíssimo em torno do software livre, e eu só tenho a agradecer por isso.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2009/05/18/a-importancia-do-open-source-profissional/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Várias vagas na Concrete</title>
		<link>http://brunopereira.org/2009/04/16/varias-vagas-na-concrete/</link>
		<comments>http://brunopereira.org/2009/04/16/varias-vagas-na-concrete/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 00:16:54 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[carreira]]></category>
		<category><![CDATA[posts em português]]></category>
		<category><![CDATA[bea]]></category>
		<category><![CDATA[concrete solutions]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[weblogic]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=310</guid>
		<description><![CDATA[Pessoal, a Concrete fechou mais projetos, e estamos com várias vagas, para todos os níveis de experiência. Os principais projetos que temos feito envolvem desenvolvimento de portais colaborativos de internet/intranet, integração de aplicações e soluções móveis.
No momento atual, temos de 8 a 10 vagas, todas para início imediato e horizonte de longo prazo. Queremos profissionais [...]]]></description>
			<content:encoded><![CDATA[<p>Pessoal, a <a title="Concrete Solutions" href="http://www.concretesolutions.com.br" target="_blank">Concrete</a> fechou mais projetos, e estamos com várias vagas, para todos os níveis de experiência. Os principais projetos que temos feito envolvem desenvolvimento de portais colaborativos de internet/intranet, integração de aplicações e soluções móveis.</p>
<p>No momento atual, temos de 8 a 10 vagas, todas para início imediato e horizonte de longo prazo. Queremos profissionais que tenham paixão por software e auto-motivados, buscando evolução contínua. Profissionais deste perfil encontrarão um ambiente ótimo para seu crescimento dentro da Concrete. A descrição técnica dos perfis pode ser vista a seguir.</p>
<p>Os níveis de experiência são variados, então entre em contato se você se julgar dentro do perfil de profissional que buscamos. Quem quiser mais informações, não deixe de entrar em contato.</p>
<p><strong>Desenvolvedor Java (preferencialmente com experiência em Web e/ou Mobile)</strong></p>
<p>Java SE 5 e/ou 6. Java EE 1.4 e/ou 5.</p>
<p>JPA e/ou Hibernate são bastante desejáveis. Importante conhecer banco de dados relacionais e mapeamento objeto-relacional.</p>
<p>Experiência de uso com alguns dos seguintes application servers: BEA Weblogic 9 ou 10, Jboss AS, Jetty, Apache Tomcat  e Geronimo.</p>
<p>Struts, Spring MVC ou outro framework para web em Java. Boa experiência com Grails, Ruby on Rails ou Django também são válidos, e podem nos interessar mesmo se você não conhecer um framework web Java.</p>
<p>Inglês para leitura e estudo de material técnico.</p>
<p><strong>Desejável</strong></p>
<p>Graduação em Ciência da Computação, Engenharia da Computacão ou Informática</p>
<p>Conhecimento e interesse em outras linguagens de programação é bastante apreciado: Python, Scala, Ruby, Rhino, Javascript, Perl, OCAML, Common Lisp.</p>
<p>Bons conhecimentos de client-side (HTML, CSS, Javascript) são muito positivos.</p>
<p>Conhecimento de plataforma Linux é desejável, mas não obrigatório.</p>
<p>Conhecimento em shellscripting para Unix/ Linux é muito bem-vindo.</p>
<p>Os interessados devem enviar um e-mail com currículo para marcia.cataldi@concretesolutions.com.br com cópia para bruno.pereira@concretesolutions.com.br</p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2009/04/16/varias-vagas-na-concrete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dificuldades da Sun com o seu modelo de negócios open source</title>
		<link>http://brunopereira.org/2008/12/16/dificuldades-da-sun-com-o-seu-modelo-de-negocios-open-source/</link>
		<comments>http://brunopereira.org/2008/12/16/dificuldades-da-sun-com-o-seu-modelo-de-negocios-open-source/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 02:57:57 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[posts em português]]></category>
		<category><![CDATA[bea]]></category>
		<category><![CDATA[eds]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[hp]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Sun]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=270</guid>
		<description><![CDATA[Hoje o Sacha Labourey (CTO da JBoss) publicou um post interessante sobre as dificuldades que a Sun vem encontrando, em especial com seu modelo de negócios open source. Como eu já pensei um bocado sobre isso e conversei com algumas pessoas, vou deixar aqui algumas opiniões.
Na minha opinião, a Sun fez e vem fazendo um [...]]]></description>
			<content:encoded><![CDATA[<p>Hoje o <a href="http://sacha.labourey.com/" target="_blank">Sacha Labourey</a> (CTO da JBoss) publicou um <a href="http://sacha.labourey.com/2008/12/16/sun-sound-open-source-business-model/" target="_blank">post interessante</a> sobre as dificuldades que a <a href="http://www.sun.com" target="_blank">Sun</a> vem encontrando, em especial com seu modelo de negócios open source. Como eu já pensei um bocado sobre isso e conversei com algumas pessoas, vou deixar aqui algumas opiniões.</p>
<p>Na minha opinião, a Sun fez e vem fazendo um excepcional trabalho mantendo a plataforma Java como um todo. O problema todo está no contexto que girou em torno disso.</p>
<p>Em um determinado momento a Sun lutava bastante contra a <a href="http://www.microsoft.com" target="_blank">Microsoft</a> e suas soluções Windows/.NET, e de fato parecia que as empresas seriam adversárias. O que ocorre é que a Sun gastou tantas energias combatendo a Microsoft que não dedicou o esforço necessário para conquistar espaço dentro do próprio mercado Java.</p>
<p>O <a href="https://glassfish.dev.java.net/" target="_blank">Glassfish V2</a> foi o primeiro bom servidor de aplicações da Sun, mas ele chegou bem tarde. Muito antes a <a href="http://www.bea.com" target="_blank">BEA</a> e a <a href="http://www.ibm.com" target="_blank">IBM</a> já tinham um vasto portfólio de produtos Java Enterprise, e servidores de aplicação bem melhores do que o antigo Sun Application Server. Com isso, mesmo com o enorme sucesso da plataforma Java, a Sun não estava muito bem posicionada no mercado de software.</p>
<p>Creio que em decorrência deste primeiro problema (a falta de um bom app server), veio o problema que eu acho o mais grave. Na minha opinião o que fez mais falta à Sun é um bom modelo de serviços em torno da plataforma que ela desenvolveu tão bem. A Sun tem muitos grandes engenheiros, mas não conseguiu traduzir isso em muito lucro com Java. Penso que um modelo de serviços semelhante ao da IBM teria sido adequado à Sun, mas para isso eles precisariam de um portfólio de produtos melhor.</p>
<p>O grande (e bem-sucedido) esforço no desenvolvimento da plataforma Java consumiu energias que poderiam ter sido aplicadas na construção de uma linha de produtos mais rica, e com isso o sucesso do Java acabou drenando muito da saúde da Sun.</p>
<p>Mais recentemente a Sun tentou mudar a sua estratégia, e passou a abraçar ainda mais o modelo open-source. Embora isso tenha sido muito bem recebido pela comunidade de desenvolvedores, não podemos dizer que essa mudança tenha trazido mais sucesso para a empresa.</p>
<p>Eu tenho a clara impressão de que a Sun abraçou este modelo sem ter muita noção do que a esperava, mas talvez a sensação fosse de que não havia uma outra alternativa óbvia. A verdade é que a Sun está há anos lutando, mas sem encontrar a estratégia correta. O modelo de negócios em torno de open source foi mais uma tentativa da empresa, mas não estou vendo muitas perspectivas da Sun conseguir deste modelo as receitas necessárias para cobrir seus custos.</p>
<p>Eu fico triste por essas dificuldades da Sun, pois eles fizeram um excelente trabalho desenvolvendo a plataforma Java, mas isso custou a própria saúde da empresa.</p>
<p>E o que poderá vir em conseqüência? Difícil dizer, mas me parece inevitável que a Sun seja comprada por um player de maior porte, como a HP ou a SAP.</p>
<p>Como a Oracle agora é um concorrente direto da SAP em várias linhas, e a SAP começou a investir em Java, talvez faça sentido que a gigante alemã compre a Sun.</p>
<p>Quanto à HP, seria um movimento muito mais coerente do que a <a href="http://brunopereira.org/2008/05/14/hp-compra-eds-mas-isso-faz-algum-sentido/" target="_blank">compra da EDS</a>, que ocorreu esse ano. Comprando a Sun, a HP teria a stack completa, com hardware HP, sistema operacional e middleware da Sun, e serviços provenientes da EDS. Isto a deixaria em situação semelhante à da IBM, e acho que faria sentido nesse contexto atual.</p>
<p>Não sei qual será o futuro da Sun, mas sinceramente torço muito para que seja próspero, pois seu legado de contribuições ao cenário mundial de software é valioso demais para que a empresa tenha um final agonizante.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2008/12/16/dificuldades-da-sun-com-o-seu-modelo-de-negocios-open-source/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>À procura de uma maneira produtiva de trabalhar com web services SOAP</title>
		<link>http://brunopereira.org/2008/12/08/a-procura-de-uma-maneira-produtiva-de-trabalhar-com-web-services-soap/</link>
		<comments>http://brunopereira.org/2008/12/08/a-procura-de-uma-maneira-produtiva-de-trabalhar-com-web-services-soap/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 00:28:03 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[posts em português]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache cxf]]></category>
		<category><![CDATA[aqualogic]]></category>
		<category><![CDATA[axis]]></category>
		<category><![CDATA[axis 2]]></category>
		<category><![CDATA[bea]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[metro]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=262</guid>
		<description><![CDATA[Com a minha mudança de alocação da Globo.com para a Globosat, continuo trabalhando bastante com integração de aplicações, mas agora com um ferramental e paradigmas diferentes.
Na Globo.com eu trabalhei muito com open source, e estava acostumado a montar as aplicações a partir de componentes &#8220;crus&#8221;, em vez de usar ferramentas sofisticadas. Open source faz parte [...]]]></description>
			<content:encoded><![CDATA[<p>Com a minha <a href="http://brunopereira.org/2008/11/28/adeus-globocom-foi-um-grande-prazer/" target="_blank">mudança de alocação</a> da <a href="http://www.globo.com" target="_blank">Globo.com</a> para a <a href="http://globosat.globo.com/" target="_blank">Globosat</a>, continuo trabalhando bastante com integração de aplicações, mas agora com um ferramental e paradigmas diferentes.</p>
<p>Na Globo.com eu trabalhei muito com open source, e estava acostumado a montar as aplicações a partir de componentes &#8220;crus&#8221;, em vez de usar ferramentas sofisticadas. Open source faz parte da cultura da empresa, e tínhamos uma boa liberdade de escolha de tecnologias e arquiteturas.</p>
<p>Como falei algumas vezes no passado, nós migramos boa parte da arquitetura legada com EJBs para serviços <a href="http://brunopereira.org/tag/rest/" target="_blank">REST</a> usando por baixo o <a href="https://jersey.dev.java.net/" target="_blank">Jersey</a>, <a href="http://www.springframework.org/" target="_blank">Spring</a> e <a href="http://ibatis.apache.org/" target="_blank">Ibatis</a>. A produtividade no desenvolvimento de serviços REST me agrada muito, e mesmo alguém que não conheça muito de serviços REST consegue desenvolver um serviço sem tanto esforço.</p>
<p>Agora vou trabalhar mais com serviços SOAP, mas usando ferramentas muito produtivas, como o <a href="http://www.bea.com/framework.jsp?CNT=index.htm&amp;FP=/content/products/aqualogic/service_bus/" target="_blank">Aqualogic ESB</a> e o <a href="http://www.bea.com/framework.jsp?CNT=index.htm&amp;FP=/content/products/weblogic/workshop/" target="_blank">Workshop</a>, entre outros. Essas ferramentas facilitam muito o trabalho oferecendo <a href="http://brunopereira.org/2008/12/04/abstracoes-transparentes-e-abstracoes-opacas/" target="_blank">Abstrações Opacas</a>. Como ainda estou muito ligado ao trabalho com Open Source, eu venho tentando no meu tempo vago encontrar ferramentas open source com a mesma proposta.</p>
<p>Neste momento estou tentando encontrar a maneira mais produtiva de se trabalhar com web services SOAP usando open source. No passado eu desenvolvi serviços com o <a href="http://xfire.codehaus.org/" target="_blank">XFire</a>, com o <a href="http://ws.apache.org/axis2/" target="_blank">Axis 2</a> e com o <a href="https://jax-ws.dev.java.net/" target="_blank">JAX-WS</a>, mas achei interessante reavaliar as opções existentes atualmente.</p>
<p>Nos últimos dias eu fiz testes com o Axis 2, com o <a href="http://cxf.apache.org/" target="_blank">Apache CXF</a> e com o JAX-WS.</p>
<p>Eu não gosto muito do Axis 2. Você até consegue desenvolver serviços rapidamente com ele, mas ele gera um código tão sujo que é muito triste colocar qualquer coisa em produção com ele, sabendo que você vai ter que manter depois aquele código. Além disso, para utilizá-lo você precisa levar nada menos que 51 jars para sua aplicação, o que transforma qualquer aplicação em um mastodonte. Um outro problema dessa lista massiva de dependências é que a chance de uma aplicação pré-existente ter conflitos de dependências com o Axis é grande.</p>
<p>Na prática, eu só utilizaria o Axis 2 (e mesmo assim com má vontade) para desenvolver serviços se fosse numa estrutura como o <a href="http://wso2.org/projects/wsas/java" target="_blank">WSO2 Web Services Application Server</a>, que é um servidor de aplicações &#8220;dedicado&#8221; a serviços Axis.</p>
<p>O Apache CXF oferece um &#8220;front-end&#8221; com JAX-WS (que é o mais recomendado) e um &#8220;front-end&#8221; alternativo, que usa o Aegis Databinding. Por enquanto olhei apenas o front-end com JAX-WS, mas não vi nenhuma vantagem em utilizar o CXF em vez da implementação de referência presente no <a href="https://glassfish.dev.java.net/" target="_blank">Glassfish</a>. Se pintar disposição eu darei uma olhada no front-end com Aegis Databinding, mas por enquanto não tenho grandes expectativas em relação a ele não.</p>
<p>Para finalizar, fiz muitos experimentos com a implementação de referência do JAX-WS, embutido no Glassfish V2. A forma de trabalho que achei mais produtiva nestes meus testes foi desenvolvendo com JAX-WS no <a href="http://www.netbeans.org" target="_blank">Netbeans</a> (utilizei a versão 6.5).</p>
<p>Tentei desenvolver a partir de classes Java, e a partir do <a href="http://www.w3.org/TR/wsdl" target="_blank">WSDL</a>, e esta última me trouxe melhores resultados.A melhor forma que achei foi começar desenhando os schemas XML com o editor do Netbeans:</p>
<p><a href="http://brunopereira.org/wp-content/uploads/2008/12/xml_schema_editor.jpg"><img class="alignnone size-full wp-image-263" title="xml_schema_editor" src="http://brunopereira.org/wp-content/uploads/2008/12/xml_schema_editor.jpg" alt="" width="471" height="586" /></a></p>
<p>Criei um Complex Type para cada classe de domínio, e 1 Complex Type para o Request de cada operação e 1 Complex Type para o Response de cada operação. Tendo feito isso, criei depois 1 Element para o Request de cada operação e 1 Element para o Response de cada operação. Com o schema XML criado dessa forma, criei em seguida o WSDL, com o editor do Netbeans também:</p>
<p><a href="http://brunopereira.org/wp-content/uploads/2008/12/wsdl_editor.jpg"><img class="alignnone size-full wp-image-264" title="wsdl_editor" src="http://brunopereira.org/wp-content/uploads/2008/12/wsdl_editor.jpg" alt="" width="418" height="702" /></a></p>
<p>Na criação do WSDL, coloquei nas mensagens de Request/Response das operações os <strong><em>Elementos</em></strong> declarados no schema XML anterior. É importante prestar atenção nisso. Usando Elementos nas mensagens, você está criando serviços no modelo <em><strong>Document/Literal</strong></em>. Se você colocar nas mensagens um <em><strong>Complex Type</strong></em> diretamente, em vez de colocar um <em><strong>Elemento</strong></em>, você estará criando um serviço no modelo <strong><em>RPC/Literal</em></strong>. Eu particularmente prefiro Document/Literal, e o código gerado pelo JAX-WS neste modelo me agrada mais.</p>
<p>A implementação do serviço com JAX-WS ficou parecida com isso aqui:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">org.brunopereira.cadastro</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jws.WebService</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.brunopereira.schema.cadastroclientes.CadastroClienteRequestType</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.brunopereira.schema.cadastroclientes.CadastroClienteResponseType</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.brunopereira.schema.cadastroclientes.Cliente</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.brunopereira.wsdl.cadastrocliente.CadastroClientePortType</span><span style="color: #339933;">;</span>
&nbsp;
@WebService<span style="color: #009900;">&#40;</span>serviceName <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CadastroClienteService&quot;</span>, portName <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CadastroClientePort&quot;</span>,
endpointInterface <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;org.brunopereira.wsdl.cadastrocliente.CadastroClientePortType&quot;</span>,
targetNamespace <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://brunopereira.org/wsdl/CadastroCliente&quot;</span>,
wsdlLocation <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;WEB-INF/wsdl/CadastroCliente/CadastroCliente.wsdl&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CadastroCliente <span style="color: #000000; font-weight: bold;">implements</span> CadastroClientePortType <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">public</span> CadastroClienteResponseType cadastrarCliente<span style="color: #009900;">&#40;</span>CadastroClienteRequestType request<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cadastro de cliente foi invocado!! Será feito o roteamento para o serviço adequado!!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Cliente cliente <span style="color: #339933;">=</span> request.<span style="color: #006633;">getCliente</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
CadastroClienteResponseType response <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CadastroClienteResponseType<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
response.<span style="color: #006633;">setCliente</span><span style="color: #009900;">&#40;</span>cliente<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">return</span> response<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>O código do cliente foi gerado bem facilmente a partir do WSDL também, e ficou bem limpo. O que achei bem fraco foi a parte de teste dos serviços tanto no Netbeans como no Eclipse. No Eclipse você só consegue usar os plugins de teste se você tiver desenvolvido os serviços dentro do Eclipse, o que inviabilizou o meu uso. E o Netbeans tem um suporte que só serve pra HelloWorld, pra aqueles serviços de Calculadora, que você passa uns parâmetros primitivos e recebe um resultado simples. A interface do testador do meu serviço ficou dessa forma:<br />
<a href="http://brunopereira.org/wp-content/uploads/2008/12/web_services_tester.jpg"><img class="alignnone size-full wp-image-265" title="web_services_tester" src="http://brunopereira.org/wp-content/uploads/2008/12/web_services_tester.jpg" alt="" width="800" height="500" /></a></p>
<p>Dá pra ver que não serve para nada além de um HelloWorld basicão.</p>
<p>Bom, de uma maneira geral, o suporte a Web Services no Netbeans é muito melhor do que no Eclipse, que pra piorar só suporta a criação de serviços com o Axis. Até agora a maneira mais produtiva que encontrei de trabalhar com serviços SOAP foi essa que descrevi. Nos próximos dias olharei o que tem de interessante no projeto Metro e no JBoss ESB. Se encontrar coisas interessantes falarei mais por aqui. Ah, e se alguém tiver dicas para melhorar esta forma de trabalho que descrevi, por favor me avisem, pois estou avaliando muita coisa e não dá tempo de dedicar tanto tempo a cada opção dessas.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2008/12/08/a-procura-de-uma-maneira-produtiva-de-trabalhar-com-web-services-soap/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>JSR-311 finally approved!</title>
		<link>http://brunopereira.org/2008/09/24/jsr-311-finally-approved/</link>
		<comments>http://brunopereira.org/2008/09/24/jsr-311-finally-approved/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 02:10:44 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[jboss resteasy]]></category>
		<category><![CDATA[jersey]]></category>
		<category><![CDATA[jsr-311]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=214</guid>
		<description><![CDATA[Yesterday the JSR-311 (Java API for RESTFul Web Services &#8211; JAX-RS) was finally approved!
I&#8217;m using Jersey (the JSR&#8217;s reference implementation) for more than 6 months and I was anxious to have the specification approved.
In my team we&#8217;re currently using Jersey 0.7 in production, and were waiting for the JSR to be approved to analyse the [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday the <a href="https://jsr311.dev.java.net/" target="_blank">JSR-311</a> (Java API for RESTFul Web Services &#8211; JAX-RS) was finally <a href="http://jcp.org/en/jsr/results?id=4715" target="_blank">approved</a>!</p>
<p>I&#8217;m using <a href="https://jersey.dev.java.net/" target="_blank">Jersey</a> (the JSR&#8217;s reference implementation) for more than 6 months and I was anxious to have the specification approved.</p>
<p>In my team we&#8217;re currently using Jersey 0.7 in production, and were waiting for the JSR to be approved to analyse the final version of its implementations. Now we&#8217;ll wait for both Jersey and <a href="http://wiki.jboss.org/wiki/RESTeasyJAXRS" target="_blank">JBoss RESTEasy</a> to release their final versions and we&#8217;ll analyse both to see which one we&#8217;ll use in our RESTFul services.</p>
<p>If anyone wants to give me good reasons to use either one of the implementations, now it&#8217;s the perfect time! I&#8217;m hearing&#8230; <img src='http://brunopereira.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2008/09/24/jsr-311-finally-approved/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WSO2 Registry now working in JBoss 4.0.5</title>
		<link>http://brunopereira.org/2008/09/24/wso2-registry-now-working-in-jboss-405/</link>
		<comments>http://brunopereira.org/2008/09/24/wso2-registry-now-working-in-jboss-405/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 01:26:56 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[log4j]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[wso2]]></category>
		<category><![CDATA[wso2 registry]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=213</guid>
		<description><![CDATA[After some extra effort today, I did manage to get WSO2 Registry working in JBoss 4.0.5
The huge amount of jdbc error messages in the server logs were not actually errors. JBoss datasources have a configuration element called &#60;track-statements&#62;. When this option is turned on, JBoss logs massively when there are Statements or ResultSets that are [...]]]></description>
			<content:encoded><![CDATA[<p>After some extra effort today, I did manage to get <a href="http://wso2.org/projects/registry" target="_blank">WSO2 Registry</a> working in <a href="http://www.jboss.org/jbossas/" target="_blank">JBoss 4.0.5</a></p>
<p>The huge amount of jdbc error messages in the server logs were not actually errors. <a href="http://wiki.jboss.org/wiki/ConfigDataSources" target="_blank">JBoss datasources</a> have a configuration element called <span>&lt;track-statements</span>&gt;. When this option is turned on, JBoss logs massively when there are Statements or ResultSets that are left open. The application server closes the Statements and the ResultSets, and shows many many logs indicating this. The log messages I was seeing were not errors in the Registry, they were only JBoss warnings.</p>
<p>All our datasources in my team have this option turned on, and we always take care to close the ResultSets and Statements in all our applications. But since the server closes the ResultSets and Statements, I can live with the way the Registry does <img src='http://brunopereira.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I had to do some things to get the Registry working in JBoss. First, I had to remove the log4j the Registry had packed inside its war file. Our JBoss servers use the <a href="http://wiki.jboss.org/wiki/ClassLoadingConfiguration" target="_blank">Unified Classloader</a>, for several years already. This setup was there before I even joined the company, and it&#8217;d complicated to change this now, because it&#8217;d make us modify several applications. Not being able to change the Classloader, the log4j packed inside the Registry (1.2.13) would conflict with the one present in JBoss itself (1.2.8), so I had to remove it from the Registry&#8217;s war. The application worked just fine using log4j 1.2.8, so it&#8217;s ok to do this.</p>
<p>After fixing this, I had to enable Java 1.5 code in the jsps. JBoss by default does not allow Java 1.5 code in the jsps, and to modify this, I had to uncomment the code below inside JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml:</p>
<p><code>&lt;init-param&gt;<br />
&lt;param-name&gt;compilerSourceVM&lt;/param-name&gt;<br />
&lt;param-value&gt;1.5&lt;/param-value&gt;<br />
&lt;/init-param&gt;</code></p>
<p>This init-param belongs to &lt;servlet-class&gt;org.apache.jasper.servlet.JspServlet&lt;/servlet-class&gt;, and solves the jsp compilation problem.</p>
<p>Well, that&#8217;s what I had to do to make WSO2 Registry work in JBoss. Most of the problems I faced were not Registry&#8217;s fault, so I&#8217;m sorry for having a wrong impression after some setup problems this week.</p>
<p>I&#8217;m currently integrating WSO2 Registry in our architecture and once I finish, I&#8217;ll document our architecture here, so that other people can see what uses we&#8217;re making of the product.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2008/09/24/wso2-registry-now-working-in-jboss-405/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RESTFul Registry update</title>
		<link>http://brunopereira.org/2008/09/23/restful-registry-update/</link>
		<comments>http://brunopereira.org/2008/09/23/restful-registry-update/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 02:25:54 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[atompub]]></category>
		<category><![CDATA[dan diephouse]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[mule]]></category>
		<category><![CDATA[mule galaxy]]></category>
		<category><![CDATA[mulesource]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[wso2]]></category>
		<category><![CDATA[wso2 registry]]></category>

		<guid isPermaLink="false">http://brunopereira.org/?p=212</guid>
		<description><![CDATA[Well, as I said recently, we want to use a registry to keep URIs of our services and also some configurations that are currently in properties files.
After looking better at WSO2 Registry, I figured out how to do what I need with the product. I had a very short time to evaluate properly WSO2 Registry [...]]]></description>
			<content:encoded><![CDATA[<p>Well, as <a href="http://brunopereira.org/2008/09/08/restful-services-registry/" target="_self">I said recently</a>, we want to use a registry to keep URIs of our services and also some configurations that are currently in properties files.</p>
<p>After looking better at <a href="http://wso2.org/projects/registry" target="_blank">WSO2 Registry</a>, I figured out how to do what I need with the product. I had a very short time to evaluate properly WSO2 Registry and <a href="http://www.mulesource.org/display/GALAXY/Home" target="_blank">Mule Galaxy</a> before my last post, but after another evaluation of them, I concluded I can use them in this case.</p>
<p>Last week I developed a Java client to consume my publications from WSO2 Registry. It wasn&#8217;t much fun to develop, because I had to make it compatible with JDK 1.4. This prevented me from using their client API, which runs only on JDK 1.5 and above.</p>
<p>Since I had to use JDK 1.4, I used <a href="http://xstream.codehaus.org/" target="_blank">XStream</a> for my Java &lt;-&gt; XML mappings. Not being able to use the Registry&#8217;s Java client, I also had to consume data from their <a href="http://www.atompub.org/" target="_blank">AtomPub</a> API. I used <a href="http://incubator.apache.org/abdera/" target="_blank">Apache Abdera</a> 0.3 for this task, which was their last version supporting JDK 1.4 (through retroweaver).</p>
<p>So far so good. Last week I had a prototype client consuming stuff from the Registry, so I moved on to some other tasks. Well, today I started integrating the Registry in my application. That meant moving from Tomcat 6 to JBoss 4.0.5. And that&#8217;s when I got in trouble.</p>
<p>Unfortunately I hadn&#8217;t seen <a href="http://wso2.org/wiki/display/registry/Registry+1.1" target="_blank">this page</a> before. It turns out that the only application server they have tested enough is Tomcat. And not any Tomcat, only Tomcat 6. Since their distribution format is a .war file, I never would think they support only Tomcat. In their <a href="http://wso2.org/downloads/registry/" target="_blank">download page</a> it says: <strong>&#8220;This distribution includes the Webapp module with relevant JAR files and other resources to be deployed in the servlet container, providing a Web UI and an APP interface.&#8221;</strong></p>
<p>Well, I&#8217;m probably just dumb. They didn&#8217;t say &#8220;<strong>a servlet container</strong>&#8220;. They said &#8220;<strong>the servlet container</strong>&#8220;. This certainly means &#8220;the servlet container we support, which is Tomcat 6&#8243;. But this is not written there, so dumb people like me will be subject to mistakes.</p>
<p>&#8220;Heck, this is open source, I&#8217;m gonna make it work on JBoss!&#8221;. This was my first thought. And then I started setting up the Registry in JBoss, right after lunch today.</p>
<p>The first thing I noticed is that the Registry packs a newer version (1.2.13) of log4j than the one present in JBoss (1.2.8). This shouldn&#8217;t be a problem, but anyone who has experienced some of the JBoss Classloader Hell knows that it&#8217;s not a wise decision to bring a newer version of log4j inside your application if you&#8217;re going to run on JBoss. This is not a Registry fault, so I gladly fixed the problem by removing the log4j they had packed inside the .war file.</p>
<p>After fixing this, I was gettings errors trying to open the Registry&#8217;s index page on JBoss. I quickly found out that their jsps had scriptlets using JDK 1.5 code, and JBoss was not able to compile the jsps. This was easy to fix by uncommenting a init-param in the web.xml in the Tomcat module inside JBoss. However, the amount of scriplets inside their pages was the first symptom that something didn&#8217;t smell right.</p>
<p>After fixing the jsp problem, I configured the Registry to connect to MySql through a JBoss datasource. I then could open their index page and even use some features. However, when I started checking the server logs I was shocked. A huge amount of errors in jdbc operations. I had no clue of what was going wrong, because the UI was apparently working normally and the database was being manipulated.</p>
<p>Well, since it&#8217;s an open source product, I promptly checked out their code and started looking for problems. Most errors occured in simple jdbc operations like the creation of a prepared statement. The application logs were not very helpful, and I couldn&#8217;t figure out where the problem was.</p>
<p>However, something scared me a lot. Between the zillions of jdbc errors, I saw JBoss screaming for help, saying that the PreparedStatements were left open. I went to look at their jdbc code, and it definitely needs care. There were a LOT of jdbc operations inside <strong>try/catch</strong> blocks, where they treated SQLExceptions. I didn&#8217;t see the <strong>finally</strong> blocks closing the PreparedStatements and the ResultSets. This explains JBoss&#8217;s complaints about the PreparedStatements.</p>
<p>After several hours trying to use WSO2 Registry inside JBoss and looking at their code, I must say I am VERY discouraged to put anything in production right now using the product.</p>
<p>I just downloaded Mule Galaxy and now I&#8217;m gonna try to integrate it in my application. A very good sign is that they say I can use it with ANY servlet container, including Tomcat and Jetty. I think it&#8217;ll be a successful effort, but it&#8217;s hard to say anything after my problems with WSO2 Registry today.</p>
<p>But knowing <a href="http://netzooid.com/blog/" target="_blank">Dan Diephouse</a>&#8217;s work for several years, I&#8217;m pretty confident in this new attempt. I&#8217;ll post the results later this week.</p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2008/09/23/restful-registry-update/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Java Server Faces x Wicket: great framework of old paradigm vs new paradigm</title>
		<link>http://brunopereira.org/2008/01/16/java-server-faces-x-wicket-great-framework-of-old-paradigm-vs-new-paradigm/</link>
		<comments>http://brunopereira.org/2008/01/16/java-server-faces-x-wicket-great-framework-of-old-paradigm-vs-new-paradigm/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 02:27:15 +0000</pubDate>
		<dc:creator>blpsilva</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[apache wicket]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java server faces]]></category>
		<category><![CDATA[java web frameworks]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[struts]]></category>
		<category><![CDATA[taglibs]]></category>
		<category><![CDATA[wicket]]></category>

		<guid isPermaLink="false">http://blpsilva.wordpress.com/2008/01/16/java-server-faces-x-wicket-great-framework-of-old-paradigm-vs-new-paradigm/</guid>
		<description><![CDATA[Just beginning 2008, I went to a new area, new team at Globo.com. There are several promising projects for this year, and this team switch will make it easier for me to properly evaluate and judge what I consider the 2 leading Java web frameworks nowadays.Like I said here, on my spare time I (try [...]]]></description>
			<content:encoded><![CDATA[<p>Just beginning 2008, I went to a new area, new team at <a href="http://www.globo.com" target="_blank">Globo.com</a>. There are several promising projects for this year, and this team switch will make it easier for me to properly evaluate and judge what I consider the 2 leading Java web frameworks nowadays.Like I said <a href="http://brunopereira.org/2007/11/28/dvogadocom-aprovado-no-javanet/" target="_blank">here</a>, on my spare time I (try to) develop a lawyer application which uses <a href="http://wicket.apache.org" target="_blank">Apache Wicket</a> as its web framework. One of the projects I&#8217;m now working at Globo.com uses Java Server Faces. This should be a great opportunity to finally go deeply on both frameworks and see in which cases each one is better than the other. Based on what i have already studied and used of both, i do have some opinions that may or may not change several months from now.</p>
<p>First, a little background. When i was studying to pass the <a href="http://www.sun.com/training/certification/java/scwcd.xml" target="_blank">SCWCD</a> exam, I saw enough of tag libraries to get really sick of them <img src='http://brunopereira.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  JSTL, Struts 1.x Taglib, Expression Language, etc etc etc. Every new taglib was a new syntax to learn, and the result of using taglibs to implement complex web pages is the famous tag soup. Not being a purist, although I don&#8217;t like scriptlets in general, I do think that in some cases they produce much cleaner code than the heavy use of taglibs.</p>
<p>Having said that, let&#8217;s start talking about JSF. Being a standard technology backed by Sun, and present on Java EE 5 specifications, you know that you&#8217;re gonna find plenty of support by development tools, many examples on the web and an already mature community of users to help you. JSF offers a huge set of components ready to use, and many of them are very pretty and easy to use. In my case, we&#8217;re using JBoss Tools + Rich Faces, and the Eclipse plugins avaiable here are just awesome.</p>
<p>Most of the web applications I have worked until now used Struts 1.x, and although Struts is by far the most successful Java web framework til now, developing with JSF is reasonably easier and more pleasant. However, even considering the clear evolution of JSF over Struts 1.x, I still qualify both within the same paradigm. That is, both have a massive dose of non-markup code in their views, and if you&#8217;re gonna work with them, you better have your spoon ready to dig into the tag soup <img src='http://brunopereira.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Ok, ok, JSF offers very nice components and manages a lot of the work that was left to the developer in the old times, such as managing the application state and offering a beautiful presentation layer without requiring the direct manipulation of javascript. But you&#8217;re still going to have your view layer full of taglibs, coding in a special syntax (the custom tags syntax) that will make it tough to track for problems when they happen within the tag soup. You better have a magical spoon to manipulate it <img src='http://brunopereira.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Rather new in the Java web frameworks field is the very innovative Apache Wicket project. Wicket allows Java programmers to focus on what they do best: write Java code. No taglibs, how refreshing! <img src='http://brunopereira.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Wicket also uses componentized development, and it isolates the view from your model in the best manner I have seen til now in Java frameworks. It does not seem so intuitive in the beginning, because you code for a web application in a similar way as you would code a Swing application. Specifically the component&#8217;s event handling code in Wicket reminds me a lot of the approach used in Swing applications.</p>
<p>Being a new framework that went out of the Apache incubation just several months ago, you can&#8217;t expect great tooling support at this point. Drag and drop tools to design screens? Forget about it! Component options similar to JSF ones? You&#8217;re not gonna find it either. However, Wicket has a very active community and it&#8217;s evolving fast. The second book on Wicket will be avaiable in a few months and the number of users and successful implementations is growing steadily. The set of avaiable components is growing and it&#8217;s becoming much easier to find support in their forums.</p>
<p>As I said, I&#8217;m far from an expert in both frameworks, and I hope this year I&#8217;ll have a long enough exposure to them and probably in a few months I&#8217;ll have more valuable opinions. Something I think about is that perhaps knowing Wicket and JSF well can be really useful, because it doesn&#8217;t seem like we have a &#8220;one size fits all&#8221; choice here. Wicket seems great for a company to base its developments and have good and maintainable code that will be easy to build over for several years. JSF certainly can offer that too, but i find it tough to consider taglib code as easy to maintain. However, JSF offers such great components that even a Java developer like me with no talent to create good looking pages is able to generate a very decent user interface.</p>
<p>I&#8217;ll confess I have a natural preference for Wicket since the beginning, but I promise I&#8217;ll try to evaluate these 2 options without any passion during this year and later this year I&#8217;ll post again telling my conclusions (if any) <img src='http://brunopereira.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://brunopereira.org/2008/01/16/java-server-faces-x-wicket-great-framework-of-old-paradigm-vs-new-paradigm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

