Thursday, April 30, 2009

Java Transaction

Transaction processing should achieve a high degree of data integrity and consistency. This article, the first in a series on developing an effective transaction strategy for the Java platform, introduces common transaction pitfalls that can prevent you from reaching this goal. Using code examples from the Spring Framework and the Enterprise JavaBeans (EJB) 3.0 specification, series author Mark Richards explains these all-too-common mistakes.

Learn more:
http://www.ibm.com/developerworks/java/library/j-ts1.html?ca=dgr-jw22SafeJavaTrans&S_TACT=105AGX59&S_CMP=grsitejw22

Thursday, May 1, 2008

PPTP client config on Ubuntu 8.04

- install client program
sudo apt-get install pptp-linux
- create the /etc/ppp/options.pptp file, which sets options common to all tunnels :
lock noauth nobsdcomp nodeflate
Here is my smaple file :

# Lock the port
lock

# Authentication
# We don't need the tunnel server to authenticate itself
noauth

# We won't do EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2
refuse-eap
refuse-chap
refuse-mschap

# Compression
# Turn off compression protocols we know won't be used
nobsdcomp
nodeflate
- create or add lines to the /etc/ppp/pap-secrets file, which olds usernames and passwords :
$USERNAME $TUNNEL $PASSWORD *
Here is my smaple file :

# INBOUND connections

# Every regular user can use PPP and has to use passwords from /etc/passwd
* hostname "" *

# UserIDs that cannot use PPP at all. Check your /etc/passwd and add any
# other accounts that should not be able to use pppd!
guest hostname "*" -
master hostname "*" -
root hostname "*" -
support hostname "*" -
stats hostname "*" -

# OUTBOUND connections

# Here you should add your userid password to connect to your providers via
# PAP. The * means that the password is to be used for ANY host you connect
# to. Thus you do not have to worry about the foreign machine name. Just
# replace password with your password.
# If you have different providers with different passwords then you better
# remove the following line.

# * password
shams kw pass *


- Create a /etc/ppp/peers/$TUNNEL file :

pty "pptp $SERVER --nolaunchpppd"
name $USERNAME
require-mppe-128
file /etc/ppp/options.pptp
ipparam $TUNNEL

Here is my file :

# tunnel Internet, written by pptpconfig $Revision: 1.12 $


# name of tunnel, used to select lines in secrets files
remotename kw

# name of tunnel, used to name /var/run pid file
linkname kw

# name of tunnel, passed to ip-up scripts
ipparam kw

# data stream for pppd to use
pty "pptp 192.168.1.8 --nolaunchpppd "

# domain and username, used to select lines in secrets files
name shams

usepeerdns

# do not require the server to authenticate to our client
noauth

# adopt defaults from the pptp-linux package
file /etc/ppp/options.pptp

# end of tunnel file



- start your connection with pon command :

sudo pon kw


- stop your connection with poff command :

sudo poff kw

Saturday, April 12, 2008

What happening to Java EE ???

I was working with J2EE (specially EJB) from until 2003. because of J2EE performance issues and slow development I decide to switch to another solutions like lightweight containers.

After a while I chose Spring as a business framework and Hibernate as a ORM tool and in presentation layer Struts, WebWork and a little Tapestry.

From 2003 until 3 months ago Hibernate + Spring + (Webwork or Tapesty) was my favorites in all projects and I have very success story with these solutions.

About 3 months ago I was join to new team and began to work on a project with Java EE 5 standard specification again.

Weblogic has been chosen as an Application Server and JPA as a persistence mechanism.

Weblogic need high resources, and its not good for development environment.
we decide to chose another server for development environment. I began to test GlassFish and Geronimo.

there was a lot of problems during these tests and now I am really confused. I don't understand that what portability means in Java EE. what is standard in Java EE.

Here is a list of my problems

1 - JNDI naming is not standard in Java EE and each server has its naming convention for JNDI.
than you most change lookup code for each server.

2 - Hibernate does not understand Geronimo JTA Transaction and you most add some code to fix this issue.

3 - Open JPA (default JPA implementation in Geronimo) has its database model for OneToMany Relations. then you most change database and table relation for this server.

4 - Toplink (default JPA implementation for GlassFish) not support some kind of table mapping for class hierarchy.

5 - JAX WS Web Service Client for each server is unique. and you need to write deferent code for each server.


that was my Java EE tragic story.