Hello to everybody….. If you like open source world …stay tuned
Install Jboss on Ubuntu from source
21 01 2012mbiancalani@mbiancalani:~$ sudo apt-get install libaio-dev mbiancalani@mbiancalani:~$ git config --global user.name "Massimo Biancalani" mbiancalani@mbiancalani:~$ git config --global user.email massimo.biancalani@gmail.com mbiancalani@mbiancalani:~$ git config --global merge.tool vimdiff mbiancalani@mbiancalani:~$ git config --list mbiancalani@mbiancalani:~$ cd Downloads/java/application_server mbiancalani@mbiancalani:~/Downloads/java/application_server$ git clone -b 7.1 https://github.com/jbossas/jboss-as.git
mbiancalani@mbiancalani:~/Downloads/java/application_server$ cd jboss-as/ mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ export M2_HOME=/opt/apache-maven-3.0.4 mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ PATH=$M2_HOME/bin:$PATH mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ export JAVA_HOME=/opt/jdk1.6.0_31
change the maven settings.xml for glassfish
mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ cat ~/.m2/settings.xml <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers/> <!-- <mirrors> <mirror> <id>maven-central</id> <url>http://repo1.maven.org/maven2/</url> <mirrorOf>*,!eclipselink.repository,!glassfish-repo-archive,!netbeans.repository</mirrorOf> </mirror> <mirror> <id>maven-eclipse</id> <url>http://maven.eclipse.org/nexus/content/repositories/central/</url> <mirrorOf>glassfish-repo-archive</mirrorOf> </mirror> </mirrors> --> <proxies/> <profiles> <profile> <id>standard-extra-repos</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> <releases><enabled>true</enabled> <updatePolicy>always</updatePolicy></releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> <repository> <id>eclipselink.repository</id> <name>EclipseLink Repo</name> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <url>http://download.eclipse.org/rt/eclipselink/maven.repo/</url> <layout>default</layout> </repository> <repository> <id>netbeans.repository</id> <name>Maven Repo containing NetBeans artifacts</name> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <url>http://dev.nightlabs.org/maven-repository/repo/</url> <layout>default</layout> </repository> <repository> <id>jboss.repo</id> <name>JBoss Maven 2 Repository</name> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <url>http://repository.jboss.org/nexus/content/groups/public/</url> <layout>default</layout> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-plugins</id> <url>http://repository.jboss.org/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>jboss-snapshot-plugins</id> <url>http://repository.jboss.org/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> </settings>
mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ mvn install mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ sudo cp -R build/target/jboss-as-7.1.3.Final-SNAPSHOT /opt/ mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ sudo chown -R mbiancalani:mbiancalani /opt/jboss-as-7.1.3.Final-SNAPSHOT
* create init script
mbiancalani@mbiancalani:~/Downloads/java/application_server/jboss-as$ cat /etc/init.d/jboss #! /bin/sh #to prevent some possible problems export JAVA_HOME=/opt/jdk1.6.0_31 JBOSS_HOME=/opt/jboss-as-7.1.3.Final-SNAPSHOT case "$1" in start) echo "starting jboss from $JBOSSPATH" sudo -u mbiancalani $JBOSSPATH/standalone.sh & ;; restart) $0 stop $0 start ;; stop) echo "stopping jboss from $JBOSSPATH" sudo -u mbiancalani $JBOSSPATH/jboss-cli.sh --connect command=:shutdown & ;; *) echo $"usage: $0 {start|stop|restart}" exit 3 ;; esac : mbiancalani@mbiancalani:~$ sudo chmod +x /etc/init.d/jboss
Comments : Leave a Comment »
Categories : Application Server
Install glassfish on Ubuntu from source
14 01 2012* Java installation
wget http://download.oracle.com/otn-pub/java/jdk/6u26-b03/jdk-6u26-linux-x64.bin mv jdk-6u26-linux-x64.bin?e=1310474539&h=ffda65b99c253dcaf95b217d25a03ffb jdk-6u26-linux-x64.bin chmod +x jdk-6u26-linux-x64.bin ./jdk-6u26-linux-x64.bin ..... export JAVA_VERSION=1.6.0_31 sudo mv jdk${JAVA_VERSION} /opt/
* Install maven
mkdir maven cd maven wget http://mirror.nohup.it/apache/maven/source/apache-maven-2.2.1-src.tar.gz tar -xzvf apache-maven-2.2.1-src.tar.gz cd apache-maven-2.2.1 export M2_HOME=/opt/apache-maven-2.2.1 PATH=$M2_HOME/bin:$PATH export JAVA_HOME=/opt/jdk1.6.0_31 export ANT_HOME=/opt/apache-ant-1.8.3 PATH=$PATH:${ANT_HOME}/bin sudo env PATH=$PATH ANT_HOME=$ANT_HOME JAVA_HOME=$JAVA_HOME M2_HOME=$M2_HOME ant
change the maven mirror for glassfish
vi ~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <pluginGroups/> <servers/> <mirrors> <mirror> <id>maven-central</id> <url>http://repo1.maven.org/maven2/</url> <mirrorOf>*,!eclipselink.repository,!glassfish-repo-archive,!netbeans.repository</mirrorOf> </mirror> <mirror> <id>maven-eclipse</id> <url>http://maven.eclipse.org/nexus/content/repositories/central/</url> <mirrorOf>glassfish-repo-archive</mirrorOf> </mirror> </mirrors> <proxies/> <profiles> <profile> <id>gf-repo</id> <repositories> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> <releases><enabled>true</enabled> <updatePolicy>always</updatePolicy></releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> <repository> <id>eclipselink.repository</id> <name>EclipseLink Repo</name> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <url>http://download.eclipse.org/rt/eclipselink/maven.repo/</url> <layout>default</layout> </repository> <repository> <id>netbeans.repository</id> <name>Maven Repo containing NetBeans artifacts</name> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <url>http://dev.nightlabs.org/maven-repository/repo/</url> <layout>default</layout> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>gf-repo</activeProfile> </activeProfiles> </settings>
* Creating OS user
#Add a new user called glassfish sudo adduser --home /home/glassfish --system --shell /bin/bash glassfish #add a new group for glassfish administration sudo groupadd glassfishadm #add your users that shall be Glassfish adminstrators sudo usermod -a -G glassfishadm $myAdminUser #in case you want to delete a group some time later (ignore warnings): #delgroup glassfishadm
* Install glassfish
cd cd Downloads/java/application_server svn checkout https://svn.java.net/svn/glassfish~svn/tags/3.1.2 cd 3.1.2 PATH=${JAVA_HOME}/bin:$PATH:/opt/apache-maven-2.2.1/bin mvn install .... [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 15 minutes 7 seconds [INFO] Finished at: Mon Apr 23 14:25:49 CEST 2012 [INFO] Final Memory: 294M/924M [INFO] ------------------------------------------------------------------------ sudo mkdir -p /opt/glassfish-3.1.2 sudo unzip ./distributions/glassfish/target/glassfish.zip -d /opt/glassfish-3.1.2/ #change group of glassfish home directory to glassfishadm sudo chgrp -R glassfishadm /opt/glassfish-3.1.2 #just to make sure: change owner of glassfish home directory to glassfish sudo chown -R glassfish /opt/glassfish-3.1.2 #make sure the relevant files are executable/modifyable/readable for owner and group sudo chmod -R ug+rwx /opt/glassfish-3.1.2 #others are not allowed to execute/modify/read them sudo chmod -R o-rwx /opt/glassfish-3.1.2 sudo su glassfish /opt/glassfish-3.1.2/glassfish3/bin/asadmin start-domain domain1 /opt/glassfish-3.1.2/glassfish3/bin/asadmin stop-domain domain1
* create init script
sudo vi /etc/init.d/glassfish #! /bin/sh #to prevent some possible problems export AS_JAVA=/opt/jdk1.6.0_31 GLASSFISHPATH=/opt/glassfish-3.1.2/glassfish3/bin case "$1" in start) echo "starting glassfish from $GLASSFISHPATH" sudo -u glassfish $GLASSFISHPATH/asadmin start-domain domain1 ;; restart) $0 stop $0 start ;; stop) echo "stopping glassfish from $GLASSFISHPATH" sudo -u glassfish $GLASSFISHPATH/asadmin stop-domain domain1 ;; *) echo $"usage: $0 {start|stop|restart}" exit 3 ;; esac :
chmod +x /etc/init.d/glassfish
Comments : Leave a Comment »
Categories : Application Server, Linux
Install tomcat on ubuntu from source
10 01 2012* Java installation
wget http://download.oracle.com/otn-pub/java/jdk/6u26-b03/jdk-6u26-linux-x64.bin mv jdk-6u26-linux-x64.bin?e=1310474539&h=ffda65b99c253dcaf95b217d25a03ffb jdk-6u26-linux-x64.bin chmod +x jdk-6u26-linux-x64.bin ./jdk-6u26-linux-x64.bin ..... export JAVA_VERSION=1.6.0_26 sudo mv jdk${JAVA_VERSION} /opt/
Comments : Leave a Comment »
Categories : Application Server, Linux
Spring 3: Configuring data Source with tomcat
3 01 2012First of all click on Project Explorer of eclipse and open the file context.xml
Read the rest of this entry »
Comments : Leave a Comment »
Tags: tomcat
Categories : Application Server, Spring
Linux raid 1: remove failure disk and mount the healthy disk
26 12 2011Hi,
if you’re using this guide mean you’re in trouble 😦 ….
Suppose you have raid 1 with two partition in two different disks an one of them it’s failing. Before to go ahead make a backup of the healthy disk.
Suppose you have a partion
/dev/sdd
Now you want to remove the raid and eject the healthy disk
massimo@massimo-desktop:~$ sudo dmsetup remove_all massimo@massimo-desktop:~$ sudo eject sdd massimo@massimo-desktop:~$ sudo dmsetup status 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370-part3: 0 486175095 linear 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370-part2: 0 3903795 linear 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370: 0 490234752 multipath 2 0 0 0 1 1 A 0 1 0 8:48 A 0 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370-part1: 0 144522 linear massimo@massimo-desktop:~$ sudo dmsetup remove 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370-part1 massimo@massimo-desktop:~$ sudo dmsetup remove 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370-part2 massimo@massimo-desktop:~$ sudo dmsetup remove 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370-part3 massimo@massimo-desktop:~$ sudo dmsetup remove 1ATA_WDC_WD2500YD-01NVB1_WD-WCANK9057370 massimo@massimo-desktop:~$ sudo dmsetup status No devices found massimo@massimo-desktop:~$ sudo mount -t ext3 /dev/sdd3 /mnt/hd massimo@massimo-desktop:~$ ls /mnt/hd/ backup cdrom home initrd.img.old media proc srv tmp vmlinuz bin dev initrd lib mnt root sys usr vmlinuz.old boot etc initrd.img lost+found opt sbin temp var
Comments : Leave a Comment »
Tags: recovering
Categories : Linux
eclipse: recovering a workspace
23 12 2011Sometime it happens that eclipse hangs on splash screen…. very bad !!!
You can try even with
eclipse --clean
but it doesn’t work
A Solution it’s to delete
.metadata.pluginsorg.eclipse.core.runtime
Next open eclipse
Ops all the project are gone….. no problem
click on
File->Import....
and
Read the rest of this entry »
Comments : Leave a Comment »
Tags: recovering
Categories : eclipse
Glassfish: Create Oracle jdbc resources
16 12 2011Hi everyone,
this time we’re going to create two oracle’s jdbc: one normal and one XA. XA connection allows to have a global transaction in a multi database context.
First of all we need to include oracle driver in glassfish server.
Copy the ojdbc14.jar file into the domain-dir/lib/ext directory and restart glassfish.
Now connect to glassfish admin console http:://localhost:4848 and click on Connection Pool to create a new one
Read the rest of this entry »
Comments : Leave a Comment »
Categories : Linux, Oracle
Flex4: Using XMLListCollection in a list
27 11 2011In this blog I’m going to show how to handle a xml list and how to show it
First add resultFormat="e4x"
<s:HTTPService id="categoryService" url="http://www.flexgrocer.com/category.xml" resultFormat="e4x" result="handleCategoryResult(event)"/>
After declare a bindable variable.The Bindable metadata tag tells Flex to watch this particular collection for changes.
<![CDATA[ import mx.events.FlexEvent; import mx.rpc.events.ResultEvent; import mx.collections.XMLListCollection; [Bindable] private var categories:XMLListCollection; private function handleCategoryResult(event:ResultEvent):void{ categories = new XMLListCollection( event.result.category ); } ]]>
Now Create a s:List
in the s:controlBarContent
<s:List left="200" height="40" dataProvider="{categories}" labelField="name"> <s:layout> <s:HorizontalLayout/> </s:layout> </s:List>
Comments : Leave a Comment »
Categories : Flex
GWT: create a combo filled by database data
20 11 2011In this blog I’m going to show how to display a combo filled with database data.
First of all create a simple presenter
package com.biancama.test.gwt.webapp.client.presenter; import java.util.List; import com.biancama.test.gwt.webapp.client.ServiceLocator; import com.biancama.test.gwt.webapp.shared.dto.EmployeeDTO; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.HasWidgets; public class ComboBoxPresenter extends AbstractPresenter { private final Display display; public ComboBoxPresenter(ServiceLocator serviceLocator, HandlerManager eventBus, final Display display) { super(serviceLocator, eventBus); this.display = display; } public interface Display extends TopDisplay { void setData(List<EmployeeDTO> data); } @Override public void go(HasWidgets container) { bind(); container.clear(); container.add(display.asWidget()); serviceLocator.getEmployeesService().getAllEmployees( new AsyncCallback<List<EmployeeDTO>>() { @Override public void onSuccess(List<EmployeeDTO> data) { display.setData(data); } @Override public void onFailure(Throwable arg0) { Window.alert("Error getting all employees"); } }); } private void bind() { // TODO Auto-generated method stub } }
Comments : Leave a Comment »
Categories : GWT
Spring 3: Managing Transactions Programmatically without template
10 11 2011In this blog I’m going to show how to manage a transactional code with the simplest feature of spring.
First of all have a look to Spring 3: Implement CRUD pattern using hibernate session factory.
Now I’m going to build a simple interface to add a new Employee
package com.biancama.spring3.service.hibernate; import com.biancama.spring3.model.hibernate.Employees; public interface EmployeesService { public boolean addNewEmployee(Employees employee); }
Comments : Leave a Comment »
Categories : hibernate, Spring