Thursday Jun 11, 2015

JavaOne, Oracle OpenWorld, e JUG Tour Brasil 2015

As palestras selecionadas para o JavaOne Brasil, e também para o Oracle OpenWorld Brasil, foram publicadas no site. O catálogo pode ser visto nos links abaixo:

Além de centenas de palestras, o evento contará também com 2 laboratórios práticos por dia, sobre diferentes temas como Java EE, JavaFX, e Java SE 8. Aqueles que adquirirem os pacotes do JavaOne poderão se inscrever sem custo adicional aos Hands-On Labs. Também teremos o NetBeans Day, no dia 22 de Junho durante todo o dia com diferentes palestras sobre desenvolvimento em Java e Cloud com a plataforma NetBeans. Para fechar toda a programação, encontros em mais de 15 JUGs por todo o Brasil também acontecerão, com palestras de speakers nacionais e internacionais, durante o 20 Days of Java Brazil JUG Tour 2015. Confira no site se o seu JUG faz parte do tour, e inscreva-se!

Inscreva-se no JavaOne!

Sunday May 31, 2015

Trip Report: Porto Tech Hub 2015

Porto Tech Hub is a new initiative by the city of Porto, in Portugal. A smart and very well organized and combined effort between the local Government and companies to push forward the Technology Industry in the region. And I was extremely happy to be part of this. The conference happened for one and a half day, and you can see by the Program that it held different topics, enabling and feeding the community with many different areas of interest.

The City of Porto is amazing. It was my first time in Portugal, and I must be thankful for you all people, or else I wouldn't exist. Second, I lived in Rio de Janeiro for 4 great years (now back in Sao Paulo though), so when I arrived in the region of Ribeira I found myself again in Rio by feeling the great atmosphere and seafood gastronomy. Whenever you go to Porto, make sure you go to the wineries to taste Port Wine (brought a few bottles back home)

I delivered the session Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX. Watch this demonstration if you don't know what's this about. It was fun to deliver a session in Portuguese outside Brazil. I did doublecheck with the audience if they could understand me, since Brazilian Portuguese is not exactly the same thing (Spanish though is different! Talking to you Americans... :-)

PS: after I delivered the session, I found out I was supposed to speak in English, since all speakers even the locals, were speaking English. I guess I got too excited with the idea of speaking with Portuguse audience :-)

The conference also had the presence of the awesome Christoph Engelbert (@noctarius2k) from Hazelcast, talking about In-Memory Distributed Computing. Dude, thanks for being an awesome travel companion, and for the two first pictures above.

Mensagem aos Amigos Lusitanos!

Obrigado a todos da organização pelo carinho especial, principalmente à Silvia e ao Jorge. Fui muito bem recebido e assistido por todos os envolvidos no evento. Muito legal também a participação da audiência durante a live demo do Tweet4Beer, enviando tweets e ganhando cervejas fictícias! E estou ansioso pela próxima edição. Sucesso a todos e até 2016!

Monday Apr 13, 2015

Nashorn Maven: Easy Library Classpath Setup

Nashorn is a great technology that comes embedded with Java 8. It is a Javascript engine that allows developers to code for the Java Platform, but using the Javascript language. What does that gives to you? Well, you can basically do whatever the Java Platform allows you to do, except you don't need to set a Java project, compile, and package with a JAR to do something cool.

For example, let's say you want to test the Streams API in JDK 8. In traditional Java development, even without an IDE, you'd have to open a text editor, create a Java class, then compile it with javac, and finally run it with java command. But you just want to try an API, right? So you'd rather prefer to skip that code/compile/run and just do... code/run!

Nashorn itself can be executed by different ways: you can use JSR 223 from within a Java program, and invoke the ScriptEngine API to eval Javascript code using Nashorn, or you can use the jjs command line tool. If you have JDK 8 installed, go to your prompt line, and type jjs, and play with the Nashorn console.

Now that you have got an idea of what Nashorn is and what jjs is, and you have realized you can use any Java API programming in Javascript, what about using 3rd-party libraries? Or your own libraries? Nashorn jjs accepts a parameter -cp to configure a classpath, just like java. But libraries are usually published as Maven artifacts, and have dependencies. You can of course download all the JARs necessary to run the library, and manually setup the classpath with old school jar1:jar2:jar3, but that's not optimal! So what would be the easiest way to code a Nashorn Javascript application that depends on a Maven artifact?

Introducing you project Nasven.js

nasven.js is a tiny Nashorn script that will invoke Maven on top of a POM generated based on a configuration file. It will then call the Dependency Plugin to download all the dependency tree of your application, setup the classpath, and then invoke jjs of your actual application with the full classpath properly configured for you, automatically!

Here's how it works:

1) First you setup a configuration file, for example appdef.js:

1 2 3 4 5 6
var appdef = {
main: "jaxrs.js",
options: "-scripting",
dependencies: ["org.glassfish.jersey.core:jersey-client:2.17",
view raw gistfile1.js hosted with ❤ by GitHub

 2) Then you code your application, that in this case depends on the JAX-RS Client API implemented by GlassFish's Jersey. For example jaxrs.js:

1 2 3 4 5
var ClientBuilder =;
var client = ClientBuilder.newClient();
var target ="");
var response = JSON.parse(target.request().get(java.lang.String.class));
print("Your IP address is ${response.ip}");
view raw gistfile1.js hosted with ❤ by GitHub

3) Finally you just need to invoke nasven.js. But make sure you have Maven properly installed and configured (in your PATH) as well JDK 8 of course.

    $ jjs -scripting nasven.js -- appdef.js 


    $ ./nasven.js -- appdef.js

Docker Image

You can also use the Docker image nasven/nasven.js to run right out of the box. The image contains OpenJDK 8 and comes with Nasven.js and their samples, as well Maven installed and with most common dependencies already downloaded for you. Here's how you run on your laptop the JAX-RS Sample (confirm you have Docker already installed);

# docker run -it nasven/nasven.js /nasven/samples/jaxrs

And that's it! Let me know if you liked this! :-)

Learn more about Nashorn

Friday Nov 28, 2014

Oracle Linux Docker Base Image on Ubuntu 14.10

Oracle Linux team has been working hard to provide Docker support. You will be glad to see that they, since August, are releasing Docker binaries in Oracle Linux YUM repositories. Now recently they are also publishing the Oracle Linux Docker Base Images for OL6 and OL7! The documentation of Oracle Linux (OL6 and OL7) and Docker is also well advanced and explanatory. Keep track of everything about Docker and Oracle Linux from this yum page.

And why is this important you may ask? Well because it's definitely a required step if at some point the Fusion Middleware product teams move forward in certifying their products, such as WebLogic, on Docker as well. So if you want to work with Oracle products on Docker right now, although yet not certified nor supported, make sure you use the OL base images.

As a developer, I like to use Ubuntu Linux on my laptop. To use the OL7 Docker Base Image for example, I had to follow the following very short and easy steps:

  1. Make sure you have Docker installed on your Ubuntu environment

  2. Download the OL7 Base Image.

  3. Uncompress the file first with xz. You may find an issue where docker can't find the xz binary.
    $ sudo docker load -i oraclelinux-7.0.tar.xz
    2014/11/28 18:36:08 Error: Untar exit status 1 exec: "xz": executable file not found in $PATH

    $ unxz oraclelinux-7.0.tar.xz

  4. Load the image in your local Docker repository, as root, after extracting with xz (but keeping tar)
    $ sudo docker load -i oraclelinux-7.0.tar

  5. Check installation
    $ sudo docker images
    oraclelinux    7.0  5f1be1559ccf   2 weeks ago    265.2 MB

  6. Create and run a container based on this image
    $ sudo docker run -t -i oraclelinux:7.0 bash
Now have fun with Docker and Oracle Linux, and let me know if you create something cool with Fusion Middleware products!

Monday Oct 20, 2014

The Developers Conference 2014

Chegou ao fim a edição 2014 do The Developers Conference, com a última parada em Porto Alegre, que aconteceu entre os dias 16 e 18 de Outubro. E colocando na conta as cidades de Florianópolis, com 4 dias de evento no mês de Maio, e São Paulo com 5 dias de evento no mês de Agosto, a participação da Oracle no evento contou com 23 palestras de 15 papers em 12 trilhas, realizadas com muito empenho e dedicação por 5 palestrantes da Oracle.

A Oracle esteve presente nas seguintes trilhas de cada cidade:

Florianópolis - 15 a 18 de Maio  São Paulo - 5 a 9 de Agosto Porto Alegre - 16 a 18 de Outubro
Internet of Things  Internet of Things  Internet of Things
 Java  Arquitetura Java  Java University
 SOA & BPM  NoSQL  Mobile
 Games  Cloud  Cloud & DevOps
 Javascript  Javascript  Javascript
 Java EE  Java EE  Java EE

Fotos da participação da Oracle no TDC 2014

The Developer's Conference 2014 Florianopolis Edition
The Developer's Conference 2014 São Paulo
The Developer's Conference 2014 Porto Alegre

Palestras dos mais diversos assuntos, sempre alinhados com Padrões Abertos e Open Source. Veja abaixo todo o material apresentado pela Oracle no The Developers Conference 2014.

Palestras apresentadas

Foi sem dúvida, a maior participação da Oracle já registrada no TDC! E fica aqui meu muito obrigado aos amigos Marco Maciel, Denis Abrantes,  Fernando Ribeiro, e Giovani Bassan, que completaram o time de palestrantes desta edição. Todas as fotos do evento você pode encontrar diretamente nos álbums do próprio #TDC2014 no Facebook! Separei algumas fotos da Oracle no TDC 2014 Florianópolis, e que venha TDC2015!

Valeu pessoal!

JavaOne 2014 - Java Is What Java Does

Sunday Sep 21, 2014

WebLogic Encrypt Tool Script for Remote and Cloud Servers

One of the upcoming offerings of Oracle Java Cloud Service is a fully manageable instance of Oracle WebLogic in the Cloud. The service allows customers to manage a full instance of WebLogic the way they want. To do some tasks though, customers must connect through SSH to the server. Since security is important to us, WebLogic server is running Production Mode, and thus developers and operators are by default not allowed to use plain text passwords when executing WLST scripts, or deploying artifacts such as JDBC resources containing such plain text sensitive informations (you know... like... passwords!).

I've created this script to facilitate the encryption, and I'm quite sure it will be very useful to those Cloud operators and developers, but also for On Premise deployments where plain text passwords shouldn't be stored around on scripts and XML files. 

1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Util script to encrypt a password on a remote WebLogic domain through SSH
DIR="$( cd "$( dirname "$0" )" && pwd )"

Let me know what you think! 

Thursday Jul 17, 2014

O Futuro do Java no Windows XP

Aviso Legal: Este texto foi traduzido do inglês para a sua conveniência. O texto original pode ser encontrado no post de Henrik Stahl, VP of Product Management for Java, "The Future of Java on Windows XP". Se houver qualquer discrepância entre esta versão e a versão original, dê prioridade para o texto original. Para outras dúvidas, consulte meu post Java FAQ Brasil.

Em Abril deste ano de 2014, a Microsoft anunciou o fim do suporte ao Windows XP. Como resultado direto, a Oracle anunciou que não mais dará suporte oficial para o Java no Windows XP. O que isso resulta é que um cliente com um contrato de suporte junto à Oracle pode ter que reproduzir um problema encontrado no Windows XP numa versão recente do Windows, e caso o problema seja específico ao Windows XP a Oracle não é obrigada (ou pode não ter os meios) para corrigir o problema ou oferecer uma solução de contorno (workaround).

 Este anúncio do fim do suporte tem sido interpretado incorretamente como "Java não funciona mais no Windows XP" ou "Oracle não irá disponibilizar mais atualizações para o Java no Windows XP". Estas afirmativas estão incorretas.

Nossa expectativa é que todas as versões do Java, que eram suportadas antes do anúncio de fim de suporte da Microsoft, continuarão funcionando no Windows XP num futuro próximo. Em particular, nossa expectativa é que o JDK 7 continuará funcionando no Windows XP. Atualizações de segurança lançadas pela Oracle continuarão sendo disponibilizadas para desktops com Windows XP. Usuários que fizerem o download do JDK 7 no ou continuarão podendo instalar no Windows XP.

JDK 8 não é suportado no Windows XP, e existem problemas conhecidos com o instalador para Windows XP que impedem de instalar o Java sem intervenção manual. Nós estamos buscando possíveis formas para resolver este problema mas talvez não o faremos - caso você esteja usando Windows XP talvez não valha a pena atualizar para o Java 8 sem atualizar também para uma versão recente do Sistema Operacional Windows.

O ponto importante aqui é que nós não podemos mais oferecer completa garantia do Java no Windows XP, já que este SO não é mais atualizado pela Microsoft. Nós fortemente recomendamos que usuários atualizem para uma versão recente do Windows que seja suportada pela Microsoft para manter um ambiente estável e seguro.

P: Eu recentemente li na Internet que a próxima atualização de segurança da Oracle para o JDK 7 não funcionará no Windows XP. Isto está correto?
R: Não. Não acredite em tudo que você lê na Internet.

P: Eu tenho um desktop/laptop com Windows XP. Continuarei recebendo atualizações automáticas do JDK 7 quando a Oracle lançar uma nova atualização de segurança?
R: Sim, ao menos até o End of Public Updates para o JDK 7 que no momento está agendado para Abril de 2015. Leia mais em Java Support Roadmap.

P: O que acontecerá após o End of Public Updates para o JDK 7?
R: Nós continuaremos monitorando as aplicações das atualizações no Windows XP. Se o uso continuar alto quanto chegarmos perto desta data, nós tomaremos medidas para manter usuários do Java seguros. Existem opções disponíveis ao nosso alcance caso isso se torne necessário.

P: Posso instalar JDK 8 no Windows XP? Vai funcionar? 
R: O instalador não funciona no Windows XP. Você pode descompactá-lo manualmente e provavelmente irá funcionar.

P: Minha empresa está usando Windows XP Embedded, que ainda é suportado pela Microsoft. A Oracle irá suportar neste caso?
R: Nós nunca suportamos oficialmente Windows XP Embedded para qualquer versão do Java. No entanto, desde que a Microsoft forneça suporte para o Windows XP Embedded, poderemos considerar isso. Entre em contato com um representante de vendas do Java na sua região se você tem uma necessidade para isso.

Monday Jun 30, 2014

Docker, Java EE 7, and Maven with WebLogic 12.1.3

UPDATE March 2015 - We now officially certify and support WebLogic 12.1.3 on Docker Containers! For more information see this blog post and this whitepaper on OTN. The Docker configuration files are also now maintained on the official Oracle GitHub Docker repository.

WebLogic 12.1.3 was released and with it the support for perhaps the most important Java EE 7 APIs for database-backed Web Applications development. These are the specifications supported in this release:
As you can see above, WebLogic is bundled with the same implementations used by GlassFish 4.0, which gives you a compatible application server if you have already started developing Java EE 7 applications (well, of course limited to these APIs) and now seek for a commercially supported environment.

There are also some improvements in the Apache Maven Plugin, which makes developers' life much easier, allows for much better automated testing (Arquillian!), Continuous Integration and Delivery. IDEs that support Maven-based projects also benefit from this.

Does this makes WebLogic the best Java EE application server to run modern web HTML5/Javascript applications with RESTful and WebSockets services? Sure yes! So to give you a great way to test WebLogic, I created a Dockerfile for you to in order to create a WebLogic domain on your development environment to test it as you wish. Go to the weblogic-docker for the Developer ZIP Distro Dockerfile on the WebLogic Community GitHub repository.

Getting started with WebLogic 12.1.3, Java EE 7, Maven, and Docker

Now let's get it started. First go to and download WebLogic 12.1.3 ZIP Distro for Developers. Save that file for later use.

Installing WebLogic 12.1.3 without Docker (easy)
WebLogic ZIP is very easy to install:
  1. Extract the content in a folder where you want to hold the wls12130 directory that comes inside the ZIP file. On my Linux machine, I use /home/bruno/Work/tools/.
  2. Go to the wls12130 folder and run the configure.cmd (Windows) or (Unix).
    • Creating the domain may take too long and may be seen as the installer is freezed. Make sure to configure this if you are on Linux:
      $ export
  3. When the installer asks you if you want to create a domain, type [Y]
  4. Installer will ask you for username/password. On dev environments, I usually use weblogic/welcome1
  5. Installer will start WebLogic right away and you can check it running at http://localhost:7001/console

Installing WebLogic 12.1.3 with Docker (easier)

If you work on a Linux-based machine as your development environment and you aren't familiar with Docker yet, check the What is Docker, then give it a try. Long story short: Docker is a Linux container; it is like a virtual machine, but it is not (there are people running Docker on top of Vagrant virtual machines, for example). The most important thing for us here is that it will create a virtual network interface with a virtual IP address.

My laptop runs Ubuntu 14.04, so I used this Docker Installation Instruction to set it up. I will assume you will have Docker installed on your computer somehow, following instructions for your own operational system.
  1. Download the ZIP or checkout the weblogic-docker Git repository and extract somewhere on your computer. I will use $DOCKER_HOME as a reference to that location.
  2. Copy the you download previously into $DOCKER_HOME/weblogic-docker/weblogic12c-zip/
  3. Call the script (as sudo) and wait for Docker to do its magic
  4. Call and see WebLogic going up and running on a Docker container. 
    • It will attach port 7001 to your host interfaces
  5. Open http://localhost:7001/console. Username/password are weblogic/welcome1
** Please be aware: we don't provide support for WebLogic on Docker in any environment so use this at your own risk. The developer distribution (ZIP) is only for development environments and also unsupported, as it is not patchable. If you still really want to run WebLogic 12c Full Distribution on top of Docker, here's a way to set it up.

Configuring your local Maven repository

It is now possible to use Maven without a local installation of WebLogic, which is perfect for CI environments (Hudson/Jenkins). You will still require a installation though to set up the Maven Plugin initially, but as soon you install this to your remote Maven repository for example, other developers and CI envs won't need to have WebLogic installed locally, if deploying to a remote server. For local development, you can also point to WebLogic as a "remote" server, of course. 

The steps to configure Maven are well documented and it is done by the Maven Synchronization Plug-in. After installing it to your local repository, you can call the sync goal to populate a local or remote repository. Here are the steps for a local environment:
  1. Go to the WebLogic home installation directory. For example:
    $ cd /home/bruno/Work/wls12130/
  2. Go to the subdir
    $ cd oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3/
  3. Execute the following command:
    $ mvn install:install-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar
  4. Finally you call the push command to upload all Maven artifacts (plugins, archetypes, etc) to your repository (local in this case)
    $ mvn -DoracleHome=/home/bruno/Work/wls12130/
If you want to setup a remote repository, check the documentation.

Create Java EE applications with WebLogic Maven Archetypes

WebLogic provides a set of archetypes that come with the Maven Plug-in pre-configured. Let's create a simple Web project by using the Basic WebApp Maven Archetype
mvn archetype:generate
Now of course you can open this Maven project on your NetBeans, IntelliJ IDEA, Eclipse, and then setup WebLogic in your IDE. Or you can just issue the command below to build, package, and deploy this WAR artifact to the WebLogic server you have running on your computer (either using Docker or the normal installation):
mvn package pre-integration-test 
Here we make sure to use -Dupload=true since I'm not sure if you are using Docker or not. If you are, then upload is required since the container has no access to your local file system (although possible!)

Description of wls_02.jpg follows

Now open http://localhost:7001/basicWebapp and see this sample application up and running!


By the way if you are an IntelliJ IDEA user you may want to watch this recent Webinar I did with JetBrains team: Developing Java EE Applications for WebLogic 12c with IntelliJ IDEA. The slides are available as well:

Check Bruno Borges slideshare repository

Monday May 26, 2014

Java FAQ: Tudo o que você precisa saber

Com frequência recebo e-mails de clientes com dúvidas sobre "quando sairá a próxima versão do Java?", ou então "quando vai expirar o Java?" ou ainda "quais as mudanças da próxima versão?". Por isso resolvi escrever aqui um FAQ, respondendo estas dúvidas e muitas outras. Este post estará sempre atualizado, então se você possui alguma dúvida, envie para mim no Twitter @brunoborges.

Qual a diferença entre o Oracle JDK e o OpenJDK?

O projeto OpenJDK funciona como a implementação de referência Open Source do Java Standard Edition. Empresas como a Oracle, IBM, e Azul Systems suportam e investem no projeto OpenJDK para continuar evoluindo a plataforma Java. O Oracle JDK é baseado no OpenJDK, mas traz outras ferramentas como o Mission Control, e a máquina virtual traz algumas features avançadas como por exemplo o Flight Recorder. Até a versão 6, a Oracle oferecia duas máquinas virtuais: JRockit (BEA) e HotSpot (Sun). A partir da versão 7 a Oracle unificou as máquinas virtuais, e levou as features avançadas do JRockit para dentro da VM HotSpot. Leia também o OpenJDK FAQ.

Onde posso obter binários beta Early Access do JDK 7, JDK 8, JDK 9 para testar?

A partir do projeto OpenJDK, existe um projeto específico para cada versão do Java. Nestes projetos você pode encontrar binários beta Early Access, além do código-fonte.

Quando acaba o suporte do Oracle Java SE 6, 7, 8?

Somente produtos e versões com release oficial são suportados pela Oracle (exemplo: não há suporte para binários beta do JDK 7, JDK 8, ou JDK 9). Existem duas categorias de datas que o usuriário do Java deve estar ciente: 
  • EOPU - End of Public Updates
    Momento em que a Oracle não mais disponibiliza publicamente atualizações
  • Oracle Support
    Política de suporte da Oracle para produtos, incluindo o Oracle Java SE
O Oracle Java SE é um produto e portando os períodos de suporte são regidos pelo Oracle Lifetime Support Policy. Consulte este documento para datas atualizadas e específicas para cada versão do Java. O Oracle Java SE 6 já atingiu EOPU (End of Public Updates) e agora é mantido e atualizado somente para clientes através de contrato comercial de suporte. Para maiores informações, consulte a página sobre Oracle Java SE Support.  O mais importante aqui é você estar ciente sobre as datas de EOPU para as versões do Java SE da Oracle.

Consulte a página do Oracle Java SE Support Roadmap e busque nesta página pela tabela com nome Java SE Public Updates. Nela você encontrará a data em que determinada versão do Java irá atingir EOPU.

Como funciona o versionamento do Java?

Em 2013, a Oracle divulgou um novo esquema de versionamento do Java para facilmente identificar quando é um release CPU e quando é um release LFR, e também para facilitar o planejamento e desenvolvimento de correções e features para futuras versões.

  • CPU - Critical Patch Update
    Atualizações com correções de segurança. Versão será múltipla de 5, ou com soma de 1 para manter o número ímpar. Exemplos: 7u45, 7u51, 7u55.
  • LFR - Limited Feature Release
    Atualizações com correções de funcionalidade, melhorias de performance, e novos recursos. Versões de números pares múltiplos de 20, com final 0. Exemplos: 7u40, 7u60, 8u20.

Qual a data da próxima atualização de segurança (CPU) do Java SE?

Lançamentos do tipo CPU são controlados e pré-agendados pela Oracle e se aplicam a todos os produtos, inclusive o Oracle Java SE. Estes releases acontecem a cada 3 meses, sempre na Terça-feira mais próxima do dia 17 dos meses de Janeiro, Abril, Julho, e Outubro. Consulte a página Critical Patch Updates, Security Alerts and Third Party Bulleting para saber das próximas datas. Caso tenha interesse, você pode acompanhar através de recebimentos destes boletins diretamente no seu email. Veja como assinar o Boletim de Segurança da Oracle.

Qual a data da próxima atualização de features (LFR) do Java SE?

A Oracle reserva o direito de não divulgar estas datas, assim como o faz para todos os seus produtos. Entretanto é possível acompanhar o desenvolvimento da próxima versão pelos sites do projeto OpenJDK. A próxima versão do JDK 7 será o update 60 e binários beta Early Access já estão disponíveis para testes. A próxima versão doJDK 8 será o update 20 e binários beta Early Access já estão disponíveis para testes.

Onde posso ver as mudanças e o que foi corrigido para a próxima versão do Java?

A Oracle disponibiliza um changelog para cada binário beta Early Access divulgado no portal

Quando o Java da minha máquina (ou do meu usuário) vai expirar?

Conheçendo o sistema de versionamento do Java e a periodicidade dos releases de CPU, o usuário pode determinar quando que um update do Java irá expirar. De todo modo, a cada novo update, a Oracle já informa quando que este update deverá expirar diretamente no release notes da versão. Por exemplo, no release notes da versão Oracle Java SE 7 update 55, está escrito na seção JRE Expiration Date o seguinte:
The JRE expires whenever a new release with security vulnerability fixes becomes available. Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on Critical Patch Updates, Security Alerts and Third Party Bulletin. This JRE (version 7u55) will expire with the release of the next critical patch update scheduled for July 15, 2014.
For systems unable to reach the Oracle Servers, a secondary mechanism expires this JRE (version 7u55) on August 15, 2014. After either condition is met (new release becoming available or expiration date reached), the JRE will provide additional warnings and reminders to users to update to the newer version. For more information, see JRE Expiration Date.
Ou seja, a versão 7u55 irá expirar com o lançamento do próximo release CPU, pré-agendado para o dia 15 de Julho de 2014. E caso o computador do usuário não possa se comunicar com o servidor da Oracle, esta versão irá expirar forçadamente no dia 15 de Agosto de 2014 (através de um mecanismo embutido na versão 7u55). O usuário não é obrigado a atualizar para versões LFR e portanto, mesmo com o release da versão 7u60, a versão atual 7u55 não irá expirar.

Veja o release notes do Oracle Java SE 8 update 5.

Encontrei um bug. Como posso reportar bugs ou problemas no Java SE, para a Oracle?

Sempre que possível, faça testes com os binários beta antes da versão final ser lançada. Qualquer problema que você encontrar com estes binários beta, por favor descreva o problema através do fórum de Project Feebdack do JDK.

Caso você encontre algum problema em uma versão final do Java, utilize o formulário de Bug Report. Importante: bugs reportados por estes sistemas não são considerados Suporte e portanto não há SLA de atendimento. A Oracle reserva o direito de manter o bug público ou privado, e também de informar ou não o usuário sobre o progresso da resolução do problema.

Tenho uma dúvida que não foi respondida aqui. Como faço?

Se você possui uma pergunta que não foi respondida aqui, entre em contato pelo meu Twitter @brunoborges e eu tentarei responder neste artigo.

Wednesday May 14, 2014

Oracle no #TDC2014 Florianópolis

Este ano a presença da Oracle no The Developers Conference 2014 - Edição Florianópolis vai fazer a diferença! Sem contar que fomos até mencionados pelo Cacau Menezes, grande figura da região da Ilha da Magia. Vejam só o que ele disse em seu blog:
"Já pensou em controlar uma torneira de chopp via dispositivos móveis e ser avisado pelo Twitter quando você já tomou todas? Pois é, essa ideia se tornou realidade pelos profissionais da gigante tecnológica Oracle Bruno Borges (@brunoborges) e Marco Antonio Maciel (@marcomaciel)." - Cacau Menezes

Enfim, estaremos presente no evento com as seguintes palestras e trilhas:

Trilha Games - Quinta
15:40 - Como criar o game 2048 em JavaFX

Trilha Javascript - Quinta
17:40 - Nashorn: novo motor Javascript no Java

Trilha Java EE - Sexta
10:10 - Criando uma aplicação HTML5 com Java EE 7 e WebSockets

Trilha SOA & BPM - Sexta
15:40 - Integrando Oracle BPM com Java EE e WebSockets

Trilha Java - Sábado
10:10 - Migrando de Applets para JavaFX, e novos modelos de distribuição de aplicativos Java

Trilha Internet das Coisas - Domingo
15:40 - Controle de Eventos em Tempo Real através de Java Embarcado
17:40 - Tweet para cerveja! Torneira de chopp controlada por Java, JavaFX, e IoT!

Se você quiser saber mais sobre os palestrantes da Oracle que estarão presentes no evento, acompanhe o Giovani Bassan, o Marco Maciel, e o Bruno Borges (eu) no LinkedIn :-) E acompanhe no Twitter com a hashtag #TDC2014!

Este post foi originalmente publicado em Just Blogging by Bruno Borges

Tuesday Apr 08, 2014

JavaOne 2014 na faixa, 0800, grátis!

Existem muitas coisas interessantes sobre o JavaOne, a maior conferência de Java deste planeta. Talvez a oportunidade de ficar sabendo em primeira mão sobre grandes lançamentos, ou ouvir sobre novas formas de utilizar a tecnologia, ou ainda conversar com desenvolvedores de todo o mundo, ou melhor: conhecer pessoalmente aqueles com quem conversamos somente por redes sociais e mailing lists. E é claro, a oportunidade de conhecer San Francisco, e o Vale do Silício: os escritórios da Oracle, do Google, da Apple, ou até da Microsoft. :D

Se você nunca foi ao JavaOne, mas tem muito interesse, curiosidade, e muita disposição (são várias sessões, e muitos eventos pós-sessões como happy hours, shows musicais, hackathons, etc!), e quer uma ajudinha para ir no evento, um bom patrocínio, existem duas formas de você fazer isso. A melhor opção é participar do JavaOne 2014 IoT Developer Challenge!.

Continue lendo o post...

Saturday Mar 29, 2014

Get all countries using Java SE 8 Locale

I saw this blog post "Get all the country using Java Locale List" and then I thought about posting something similar, but using Lambda and the Stream API of Java SE 8. Here's my "fork", including a call to sort the locales based on "display country" property.

Continue reading...

Wednesday Mar 26, 2014

Migrating JDBC Resources from GlassFish to WebLogic

Following up with my series of articles about Migrating from GlassFish to WebLogic, this time I want to cover the migration of a very common resource used by every Java EE developer: JDBC resources, or simply, DataSources. And in case you haven't read yet the first article, here it is: Migrating a Java EE App from GlassFish to WebLogic. That one will walk you through redeploying a simple yet almost complete Java EE 6 application on WebLogic, without any code change nor specific deployment descriptors, and still taking advantage of the enhanced Maven Plugin in WebLogic 12c.

It is easy to migrate resources by using the Web consoles of both WebLogic and GlassFish. Just open one browser window for each server, put them side-by-side, and follow the UI menus. Most of the properties are the same. But if you walkthrough the full article below, you will not only learn the concepts and what is required to migrate JDBC resources, but also how to migrate things using Command-line Interface (asadmin from GlassFish; wlst from WebLogic). So in order to understand what I'm doing here, I strongly recommend you to read, at least the introduction of, these two docs below in case you are not familiar with asadmin or wlst:

Oracle WebLogic Types of JDBC Data Sources

WebLogic offers three types of DataSources. For this migration, the type we will use will be "Generic". To know more about each type, click on the links below:

  • Generic Data Source
    • the type you are most familiar with; we will focus on this one
  • GridLink Data Source
    • in case you have an Oracle RAC Database, this is an optimal data source with HA and Failover features
  • Multi Data Source
    • abstracts two or more Generic Data Sources; works like a 'pool of data sources' so you can use it for either failover or load balancing

JDBC Resources: DataSources and Connection Pools

In the first article this was sort of covered from a Java EE Standard point of view. I simply took advantage of the @DataSourceDefinition annotation type, which allows developers to define JDBC DataSources directly from the Java source code, and requires no vendor-specific deployment descriptors nor manual previous configuration of the application server.

Now in case you have a legacy application or you are not using @DataSourceDefinition, you will be required to migrate these resources by hand. This will require three (plus one optional) simple steps:

  1. List JDBC resources from a GlassFish domain
  2. (optional; see below) Install 3rd-party JDBC drivers in WebLogic
  3. Extract and convert relevant and required information by WebLogic
  4. Create datasources inside WebLogic
Oracle WebLogic 12c already comes with JDBC drivers for Oracle DB 11g, MySQL 5.1.x, and Derby DB, so you won't need to do anything for these databases. For more information, read the docs JDBC Drivers Installed with WebLogic Server. In this doc you will also learn how to update the versions already provided by WebLogic, for example if you want to take advantage of the new features in Oracle DB 12c

If you are using Microsoft SQL Server, PostgreSQL, or any other database, check the Setting the Environment for a Thirdy-Party JDBC Driver for more information on how to install these drivers.

Concepts of JDBC Resources

We should also learn one difference between the concept of JDBC Resources in GlassFish 3 versus WebLogic 12c. In GlassFish, there are two types of JDBC Resources:
  • JDBC Connection Pools
  • JDBC Resources (aka DataSources)
On the other hand, WebLogic treats JDBC Resources as one single thing: Data Sources. The connection pool is part of the data source definition where in GlassFish, the Data Source is a separate artifact, which allows enabling/disabling the object, and also provides the JNDI name to a specific Connection Pool. In few words, when migrating a data source from GlassFish to WebLogic, you will only care about the JDBC Connection Pool and the JNDI name given at the JDBC Resource item.

Listing JDBC Resources from a GlassFish domain

First, let's list all JDBC Resources (datasources) in our GlassFish server. Connect with asadmin and execute thelist-jdbc-resources command:

asadmin> list-jdbc-resources
Command list-jdbc-resources executed successfully.

Let's focus on our example: the jdbc/gf2wls datasource. This will be the DataSource we will migrate from GlassFish to WebLogic. Now let's list all Connection Pools in this GlassFish domain by using asadmin list-jdbc-connection-pools:

asadmin> list-jdbc-connection-pools
Command list-jdbc-connection-pools executed successfully.

Now of course in case you have dozens of connection pools created in your GlassFish domain, it would be easier to issue a command that shows you which connection pool is associated to the Data Source you want to migrate. To do this, let's use the asadmin get command:

asadmin> get resources.jdbc-resource.jdbc/gf2wls.*

We not only got which connection pool is associated to this data source but also its JNDI name, because the name of the resource may not be exactly the same as the JNDI name. 

Extracting GlassFish's JDBC Connection Pool data

Next step is to get all properties of your Connection Pool. Let's issue the asadmin get command again:

asadmin> get resources.jdbc-connection-pool.mysql_gf2wls_gf2wlsPool.*
Command get executed successfully.

Easy, isn't? Now, let's focus on the minimum required properties we need to create this DataSource in WebLogic 12c. They are under* , so if you want to list only these, change the asadmin method above to the following: asadmin get*

Create the Data Source in WebLogic using WLST

To help you witht he final step, I've created a sample WLST script to create a Data Source in WebLogic. In this script, there are a few variables you must define. To call this script, go to your WebLogic installation directory and, if you are on Linux, call $ source (or the proper script for your environment). Then execute the WLST script: $ java weblogic.WLST

You should see the following output:

$ java weblogic.WLST
Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connecting to t3://localhost:7001 with userid weblogic ...
Starting an edit session ...
Started edit session, please be sure to save and activate your 
changes once you are done.
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ... 
The edit lock associated with this edit session is released 
once the activation is completed.
Activation completed

That's it. Check your WebLogic Console, by going to the Data Sources page.

Extending and improving the migration process

Now you may be wondering how to improve the process by automating everything, right? Yes you can do that! Since we have been using CLI commands, it all depends now on you by tweaking and coding some bash scripts. For example, you can use asadmin to get the information of all Data Sources, generate a bunch of files, usesed to, you know, hack the output files, then loop through them and call a more dynamic WLST script. If you want to read files from WLST, here's a fragment you can use:

from import FileInputStream

propIS = FileInputStream("")
configDS = Properties()


Migrating Advanced Settings

If you want to migrate advanced settings of the Connection Pool, take a look at the full list of properties I extracted from GlassFish in my sample Data Source. To change for example the Max Pool Size, tweak the WLST script and add the following:


cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCConnectionPoolParams/' + dsName)

Again, you can do whatever you want in WLST.

There you go! If you come up with a super awesome script to automate the whole process, let me know!

Monday Mar 03, 2014

Migrating a Java EE App from GlassFish to WebLogic

WebLogic is Oracle's strategic application server for the Java EE Platform. Since Oracle decided to focus on it for commercial support, and decided to leave GlassFish free of any ties with commercial decisions, I decided to bring this type of content to help GlassFish customers as well users to experiment, try, and evaluate Oracle WebLogic 12c (Java EE 6 certified).

But before getting down to the migration part, first thing you should learn is How to Install WebLogic 12c. For this migration tutorial in a developer environment, we will be using the Developer installation, but for production environments, we recommend the Full installation.

Full Installation
For full installation that can be used either in a production environment or in a developer environment, download the WebLogic Generic Installer and follow the steps descriped in the documentation for 12.1.2 on how to install WebLogic.

The difference between full and dev, is that full is targeted for any environment, and dev is well, for developers only. Oracle always recommend the full installation, but usually and specially for Java EE applications in a dev environment, the Development installation is enough. The good thing about it is the download size: less than 200Mb, and still you also get Oracle Coherence to play with. By the way, there is no licensing requirements for development purposes (either full or dev install), because WebLogic (and other Oracle products) are free for developers.

Required software

For this series of Migrating from GlassFish to WebLogic, I will be using NetBeans 8.0, GlassFish JDK 7, Oracle MySQL Community 5.6, and WebLogic 12.1.2. So make sure you have that software (except WLS for now) installed and configured in your system.

Developer Installation of WebLogic 12c

Let's get started by first installing WebLogic 12c for Developers. Instructions here are for Linux, but it is not that much different for Windows or Mac.
  1. Download WebLogic 12c ZIP Distribution for Developers (latest version: 12.1.2)
  2. Unzip it somewhere, for example:
    $ unzip -d /opt
  3. Go into the newly created directory
    $ cd /opt/wls12120
  4. Let's unpack the JAR files that were optimally compressed with pack200
    $ sh    // for Windows, call configure.cmd
  5. After the uncompression, configure script will ask you if you want to create a new domain. Say "yes" by pressing 'y', then [enter]
  6. Provide a username, a password, and then confirm again the password
  7. Wait for the domain to be created and started
In just a few minutes you will have WebLogic installed, configured, and running!

Test your WebLogic 12c Developer Installation

At this point, you should have a WebLogic domain configured, up, and running. You can access the Admin Web Console at the following URL: http://localhost:7001/console. It will ask for username/password you typed during install. Take a moment to explore the Admin Console. You can find more information at the official documentation for 12.1.2.

You may also find very useful to know you can manipulate all domain settings through the WebLogic Scripting Tool, a command-line interface for you to code in Python, and issue commands to view and edit all settings. In an upcoming version of WebLogic we will also provide a REST interface.

I will use WLST in the next posts in this series, so maybe you want to read more later.

How to Start/Stop WebLogic 12c

In order to start and stop correctly your WebLogic domain, you can either do that from an IDE such as NetBeans, or by running specific scripts. These scripts are located under the following path location:

  • $ sh
  • $ sh

The Beauty of Java EE 6

Now, instead of going through the process of creating a Java EE application, I coded a small application that covers a large set of Java EE 6 APIs and pushed it to this GitHub repository. It is an application using the following APIs:
  • CDI 1.0
  • JSF 2.1
  • Bean Validation 1.0
  • EJB 3.1
  • JPA 2.0
  • JAX-WS 2.2
  • JAXB 2.2
  • JAX-RS 1.1
The beauty of Java EE is that you will learn from this migration how good it is when you follow standards, and also the value of the platform. Simply put: we will migrate this application without touching any code. At least not for now. Let's first set some infrastructure requirements. For now, we must have a database.

JPA and Database setup

To facilitate things, and before you can run this application, make sure you have MySQL installed and running onlocalhost, and with a database named gf2wls with username/password gf2wls with all privileges. The project comes with a drop-and-create configuration when JPA (through EclipseLink) is initialized.

To setup this, connect as root to your local MySQL server and issue the following two commands:
  1. $ mysql -u root -p
  2. mysql> create database gf2wls;
  3. mysql> grant all privileges on gf2wls.* to gf2wls@localhost identified by 'gf2wls';
And you are set!

Import project to NetBeans, setup MySQL driver, and run it on GlassFish

Since this is an article about migrating from GlassFish to WebLogic, I will assume you know how to get this application running on GlassFish from NetBeans. But I will provide some highlights to make it work smoothless.

In order for the @DataSourceDefinition entry inside class InitializeSampleDataSessionBean work fine and connect to your MySQL database in GlassFish, make sure you have copied MySQL JDBC Driver into glassfish3/glassfish/domains/domain/domain1/lib/ext/ of course, before starting it up. In WebLogic, you don't need to do this since MySQL Connector/J is already part of the default installation.

Download the project 'bookmark-javaee6' to your local machine by either cloning the GitHub repository locally, or by downloading the zip and extracting somewhere. This is an Apache Maven project, so don't worry about environment. Just make sure you have this project up and running on a GlassFish domain.

Import the project bookmark-javaee6 into your NetBeans environment. Right click on bookmark-javaee6 project and select Run. Test the application by going to http://localhost:8080/bookmark-javaee6.

You should by now looking at the following screen:

Test the Bookmark WebService with a simple client

The sample Bookmark application comes with a JAX-WS WebService.

  1. You can test this WebService in many ways, but I will give you three main options: one is to try SoapUI
  2. Another option is to right click on the WebService in NetBeans, and select Test WebService
  3. Last option is to run the bookmark-javaee6-wsclient that comes with JUnit Test Cases. 
Make your choice, and see it working!

Running the sample Java EE 6 application in WebLogic 12c

Before we go to a pure Maven description on how to do this, let's give NetBeans a try. Now that you have everything ready (a Java EE 6 application running on GlassFish, with source code as a Maven project in NetBeans, let's add WebLogic as a Server to it.

  1. Go to the Services tab in NetBeans, and right click in Servers, then select Add Server....
  2. Select Oracle WebLogic Server
  3. Insert the path location of your recently installed WebLogic server. Remember to select the subfolderwlserver. If you installed as described in the beginning, you should try /opt/wls12120/wlserver
  4. Type your username and password of your WebLogic domain
  5. Finish this wizard
Now we must change from GlassFish to WebLogic in Project Properties. Select bookmark-javaee6 project and right click on it. Go to Run and select your newly created WebLogic 12.1.2 server. Press OK. See the picture below to understand what has to be done:

Start your project by right clicking in it, and select Run! Test your application running on WebLogic by going to the following location: http://localhost:7001/bookmark-javaee6

In case you had any problem, try these two articles:

Success! You have now the same application running on WebLogic 12c! Without any code change!

WebLogic understands GlassFish Deployment Descriptor

I haven't mentioned this before because I wanted you to see the sample application up and running on WebLogic, but what you can do in this application is to remove src/main/webapp/WEB-INF/weblogic.xml, and change the context-root inside glassfish-web.xml. What will happened if you redeploy this application without weblogic.xml, is that the application will start just fine, but in a different context-root: the one you typed inside glassfish-web.xml.

The reason for this is well documented on Support for GlassFish Deployment Descriptors. Give it a look in case you want to know what else does WebLogic understands from GlassFish's DD.

Now, let's try something different. Let's now use pure Apache Maven to compile and run the application on your WebLogic installation! For that, we will first need to configure the plugin.

Configuring the WebLogic Development Maven Plugin

Before you can use the plugin, you must install it in your local or remote Maven repository. Feel free to follow official instructions for WebLogic 12.1.2. But in case you want to just get it done, here's the short version:

  1. Go to your WLS installation. It is probably located here:
  2. Now change to the following directory:
    $ cd oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.2
  3. Issue the following command to sync WLS Maven Plugin into your local repository:
    $ mvn -Doracle-maven-sync.oracleHome=/opt/wls12120/oracle_home/.
You have now successfully installed WLS Maven Plugin. To validate the installation, type:
$ mvn help:describe -Dversion=12.1.2-0-0

To continue, let's configure the plugin onto our bookmark-javaee6 sample application, and then deploy the package into WebLogic
  1. Open the POM file of bookmark-javaee6 project
  2. Uncomment the WebLogic Maven Plugin definition
  3. Make sure to enter the same username and password as your domain when you installed and configured WebLogic
  4. Make sure WebLogic is running
  5. Make sure there's no other bookmark-jaavaee6 project deployed on your WebLogic instance
  6. Execute the following command:
    $ mvn package pre-integration-test
  7. Check your logs and try http://localhost:7001/bookmark-javaee6!


As you could see, if you are working with a Java EE 6 project 100% standardized, and perhaps Maven, you will find no problems at migrating this project to WebLogic 12c. In fact, if you are using Maven it will be as simple as adding a new plugin just to facilitate deployment. But even this you won't have to do in case you have a binary only. Just open the Admin Web Console, and fire a deployment from there!

And by the way, WebLogic is not that heavyweight and unproductive application server developers thought it still is. For more information about Developer Productivity with WebLogic 12c, read my entry "WebLogic in Comparison: RebelLabs and the Java App Server Debate".

Caveats for Java EE projects, road ahead for migrations

In the next blog posts of this series, I will cover how to work around some common issues when your project is not exactly following, or taking advantage of all standards defined in the Java EE 6 platform, or simply using extra features, customizations of GlassFish.

Here's a sneak peek of what's coming next:
  • How to Migrate JDBC DataSources from GlassFish to WebLogic
  • How to Define, Deploy, and Use JMS resources
  • How to Migrate JMS resources from GlassFish to WebLogic
  • How to Add and Isolate (classpath of) 3rd-party libraries (for example PrimeFaces)
And many more things to come!
  • Applying a GlassFish Domain Topology to a WebLogic Domain (clustering, etc)
  • Migrating Security Realms
  • Migrating Custom Login Modules
If there's any other subject you'd like to see, please post a comment!


Friday Jan 24, 2014

Hackathon de Java e Raspberry Pi na CPBr14

Você que é desenvolvedor Java e vai para a Campus Party na semana que vem de 27 de Janeiro a 2 de Fevereiro de 2014, não pode perder o Hackathon de Java e RaspberryPipromovido pelo SOUJava, com apoio da Oracle, trazendo kits, premiação, e mentoring! O objetivo é aprender, praticar e inovar, e todos os participantes ainda vão ganhar uma camiseta. Um dos projetos será selecionado para apresentação no palco principal!

Presença de grandes nomes da comunidade Java brasileira como:

Para maiores informações, consulte o site do SOUJava Hackathon de Java e Raspberry Pi na Campus Party.

Bruno has been having fun working with Java since 2000 and now helps Oracle on sharing the technology accross all Latin America. Also plays videogames, does trekking and loves beer.

Follow me on Twitter! @brunoborges


« November 2015