Aprenda como construir API JAX-RS e invocar RESTful Web Services. Veja como JMS ajuda desenvolvedores Java a enviar / receber mensagens. Descubra como usar CDI para gerenciar o ciclo-de-vida e iterações de componentes stateful e mais.
Category Archives: Java
How to Configure BitBucket Git Repository with eGit
Bitbucket is a distributed version control system (DVCS) code hosting site that supports Mercurial and Git. With Mercurial and Git, your data is distributed by definition but you still need a place to share it and keep track of your development. That is where Bitbucket comes in.
You may need to check why I choose bitbucket over github.
Bitbucket provides a fully-featured environment for managing your development project, including a code repository, a wiki (naturally backed by Mercurial and Git – you can clone it), a powerful issue tracker and easy collaboration with others.
Simply put, Bitbucket takes the pain out of sharing code and lets you focus on what you do best: Code. Bitbucket offers both commercial plans and free accounts. It offers free accounts with an unlimited number of private repositories (which can have up to five users in the case of free accounts).
Here are quick steps to setup BitBucket Repository to you Eclipse Environment.
Step-1
Register for Bitbucket.
Step-2
Create Private/Public repository
Step-3
On Overview page https://bitbucket.org/dashboard/overview
, look for your repository information.
Mouse hover will give you Repository URL
which we will use later to import project into Eclipse.
Step-4
Now let’s make Eclipse ready for Git.
- Open Eclipse
- Click on
Help
menu - Click
Install New Software
Step-5
Install eGit into Eclipse. Git version control with Eclipse (EGit) – Tutorial. How to use bitBucket with EGit in Eclipse.
URL: http://download.eclipse.org/egit/updates
Step-6
Select Eclipse Git Team Provider
and JGit
form option and click next
and finish
install.
Step-7
Now Open Perspective
and choose Git
from list.
Step-8
Click Clone Repository Button
Step-9
Enter your Bitbucket URL and User Information as mentioned in below diagram. Click Next
andFinish
. No need to change other configuration in next window.
Step-10
You should see your Bitbucket repository now in eclipse.
Step-11
Now you may want to import the project so you can work on the source code.
- Click
- ‘Windows’ >
- ‘Open Perspective’ >
- ‘Resource’
- Click
- ‘File’ >
- ‘Import’ >
- ‘Git’ >
- ‘Projects from Git’ >
- ‘Existing local repository’ >
- ‘Select a Git Repository’ >
- ‘Import as General Project’ >
- ‘Next’ >
- ‘Finish’
- The code should then appear in your ‘Project Explorer’ window as a normal project
- Now make changes to your file as you want
- Look at ‘Git Staging’ view to see your changed files and Click ‘
Commit and Push
‘
Configurando Datasource Module no JBoss 7
April 12, 2012, Posted in J2EE Comments: 0 Comments and 0 Reactions
Today I spent almost 4-5 hours figuring how to configure MySQL for JBoss. Since I am new to JEE world it was a real struggle for me. So hopefully this post will help newbies like me…
- Download and extract JBoss v7.1.1 (Download URL : http://www.jboss.org/jbossas/downloads/)
- Download and install MySQL (Download URL : http://dev.mysql.com/downloads/)
- Download MySQL JDBC driver (Download URL: http://dev.mysql.com/downloads/connector/j/)
Como fazer deploy do JAX-WS no Tomcat
Here’s a guide to show you how to deploy JAX-WS web services on Tomcat servlet container. See following summary steps of a web service deployment.
- Create a web service (of course).
- Create a sun-jaxws.xml, defines web service implementation class.
- Create a standard web.xml, defines
WSServletContextListener
,WSServlet
and structure of a web project. - Build tool to generate WAR file.
- Copy JAX-WS dependencies to “${Tomcat}/lib” folder.
- Copy WAR to “${Tomcat}/webapp” folder.
- Start It.
Continue reading Como fazer deploy do JAX-WS no Tomcat
Configurando Java no Ubuntu
Primeiramente, baixe a ultima versão do JDK no endereço:
Aceite os termos e escolha a opção: jdk-7u5-linux-i586.tar.gz
Após baixado, descompacte o pacote com o comando:
$ tar -zxvf jdk-7u5-linux-i586.tar.gz
Após executado o comando, será criado a pasta “jdk1.7.0_05”.
Depois de descompactado o arquivo, mova e renomeie o arquivo para a pasta “/opt” de seu sistema operacional, com o comando:
$ sudo mv jdk1.7.0_05/ /opt/jdk
Obs.: Será requisitado a sua senha de superusuário.
Configuração
Agora vamos configurar o sistema.
Primeiro, certifique-se de que não haja um plugin Java já instalado, para isso digite:
$ java -version
A saída deve ser:
O programa ‘java’ pode ser encontrado nos seguintes pacotes:
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headlessTente: sudo apt-get install <pacote selecionado>
Se a saída não for essa, você deve desinstalar pelo gerenciador de pacotes, qualquer programa que faça referencia ao Java.
Após feito isso, só falta configurar o classe path do Java e o plugin para o Firefox. Para configurar o classe path deve-se editar o arquivo “bash.bashrc” na pasta “/etc”.
Digite o comando:
$ sudo gedit /etc/bash.bashrc
Ao final do arquivo, acrescente as seguintes linhas:
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
A configuração do classe path está pronta, agora vamos configurar o plugin para o Firefox.
Digite o comando:
$ cd /usr/lib/firefox-addons/plugins/
Dentro desta pasta é onde devem ficar os plugins que o Firefox necessita, aqui devemos fazer um link simbólico para o plugin “libnpjp2.so”, que está na pasta do JDK, para isso, use o seguinte comando:
$ sudo ln -s /opt/jdk/jre/lib/i386/libnpjp2.so
Feito isso, reinicie o seu sistema para recarregar as variáveis de ambiente.
Após reiniciado, execute no terminal:
$ java -version
A saída deve ser semelhante a isso:
java version “1.7.0_05”
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) Server VM (build 23.1-b03, mixed mode)
Se aparecer isso, o classe path está OK.
Deployment externo no JBoss 6
Se você deseja utilizar diretórios externos do JBoss 6 para efetuar seus deployments, faça o seguinte:
- Abra o arquivo JBOSS_HOME/<servername>/conf/bootstrap/profile.xml
- Localize <property name=”applicationURIs”>
- Adicione a tag “value” dentro <list elementClass=”java.net.URI”>
Exemplo da configuração:
<property name=”applicationURIs”>
<list elementClass=”java.net.URI”>
<value>${jboss.server.home.url}deploy</value>
<!– Add your own deploy folder –>
<value>file:c:/deploy/ds</value>
<value>file:c:/deploy/lib</value>
<value>file:c:/deploy/default</value>
</list>