Tuesday, August 26, 2014

EXP 4: Recovery data on ext4 partition

Problem
Delete all on ext4 partition, cannot recover them using default commands of linux.

Cause
Some programs can delete your data over control.

Solution
Use PhotoRec to recover deleted data. I tried and recover about 95% text files (total over 200 files) when deleted on accident. It can use for NTFS or others supported partition type;

Reference
http://www.cgsecurity.org/wiki/PhotoRec
http://www.cgsecurity.org/wiki/PhotoRec_Step_By_Step
http://www.cgsecurity.org/wiki/After_Using_PhotoRec

Download PhotoRec (included in ubuntu-rescue live cd)
http://ubuntu-rescue-remix.org

EXP 3: Cannot update some packages from Debian 7.5

Problem
Cannot update some official packages when fresh install Debian 7.5

Cause
Maybe default repositories are not enough.

Solution
nano /etc/apt/sources.list

Add following repositories into sources.list file:

deb http://ftp.debian.org/debian/ wheezy main
deb-src http://ftp.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
deb http://ftp.debian.org/debian/ wheezy-updates main
deb-src http://ftp.debian.org/debian/ wheezy-updates main



Save file, and update repos again.

apt-get update

EXP 2: org.postgresql.util.PSQLException: ERROR: prepared transaction with identifier

Problem
org.postgresql.util.PSQLException: ERROR: prepared transaction with identifier

Cause
some configs of postgresql incorrect, especially for XA transaction

Solution
in postresql.conf file, set 2 parameter same value, max_prepared_transaction and max_connections

You can consider increase share_buffers larger (ex: 512MB)

Example
max_connections = 100
max_prepared_transaction = 100 

EXP 1: Local transaction already has 1 non-XA Resource: cannot add more resources

Problem
Local transaction already has 1 non-XA Resource: cannot add more resources

Cause
JavaEE cannot handle transactions which have 2 more resource and one of them is non-XA resource

Solution
Config all resource into XAResource

Example
Config XAResource for Postgresql on Glassfish, using JDBC Connection Pool

Resource Type: javax.sql.XADataSource
Datasource Classname: org.postgresql.xa.PGXADataSource