Archive for July, 2010

iRobot Android Tablet (APad)

| July 20th, 2010

aPad

I found this interesting gadget called iRobot Android Tablet a.k.a APad from this link and this link

With very very reasonable price, this gadget can be a threat to iPad if they keep selling with that high price.

I hope, many company out there will produce the same gadget with android inside and good price.

iPad is still not worth to buy with that high price. Only to open eBook (mostly pdf) and internet cost me more than $450 ?? Hell No !!

I think similiar gadget like Amazon kindle, iPad, or this APad will become populer gadget in the future.

I have 2 models with one to many relationships

Policy to Documents

When i tried to execute this sql

String sql = select doc from Document doc where doc.policy =:policyId and doc.templateId=112 and doc.status=3
Query query = entityManager.createQuery(sql);
query.setParameter("policyId", policy.getPolicyId());
List result = query.getResultList();

I got the following error

15:55:14,315 ERROR [TxPolicy] javax.ejb.EJBTransactionRolledbackException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.ace.project.model.Policy.policyId

After googling, i found the problem was at the SQL above i set policyId parameter with policyId (policyId is PK of Policy object) instead of Policy Object.

The correct SQL should be

String sql = select doc from Document doc where doc.policy =:policyId and doc.templateId=112 and doc.status=3
Query query = entityManager.createQuery(sql);
query.setParameter("policyId", policy); //THIS LINE IS THE FIXED
List result = query.getResultList();

In my seam application that running on Jboss 5.1.0 GA, i have a process that retrieves a big data and the process takes more than 6 minutes now.

Last time i got error

2010-07-12 09:44:37,617 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (Thread-9) [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX 7f000001:aa82:4c3a8008:9c in state  RUN
2010-07-12 09:44:37,640 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (Thread-10) [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id 7f000001:aa82:4c3a8008:9c invoked while multiple threads active within it.
2010-07-12 09:44:37,641 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (Thread-10) [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action 7f000001:aa82:4c3a8008:9c aborting with 1 threads active!
2010-07-12 09:44:37,647 ERROR [STDERR] (http-127.0.0.1-8080-4) org.jboss.util.NestedSQLException: Transaction TransactionImple < ac, BasicAction: 7f000001:aa82:4c3a8008:9c status: ActionStatus.ABORTING > cannot proceed STATUS_ROLLING_BACK; - nested throwable: (javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: 7f000001:aa82:4c3a8008:9c status: ActionStatus.ABORTING > cannot proceed STATUS_ROLLING_BACK)
2010-07-12 09:44:37,647 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (Thread-10) [com.arjuna.ats.arjuna.coordinator.TransactionReaper_7] - TransactionReaper::doCancellations worker Thread[Thread-10,5,jboss] successfully canceled TX 7f000001:aa82:4c3a8008:9c
2010-07-12 09:44:37,648 ERROR [STDERR] (http-127.0.0.1-8080-4)  at org.jboss.resource.adapter.jdbc.WrapperDataSource.checkTransactionActive(WrapperDataSource.java:165)
2010-07-12 09:44:37,648 ERROR [STDERR] (http-127.0.0.1-8080-4)  at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransactionActive(WrappedConnection.java:833)
2010-07-12 09:44:37,648 ERROR [STDERR] (http-127.0.0.1-8080-4)  at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:848)
2010-07-12 09:44:37,648 ERROR [STDERR] (http-127.0.0.1-8080-4)  at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:825)
2010-07-12 09:44:37,648 ERROR [STDERR] (http-127.0.0.1-8080-4)  at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:240)

This error happened because the process of retrieving data is longer than the transaction time out that i have in my Jboss Appplication.

To change transaction time out, in Jboss 5.1.0 you can find the config file in

/JbossRoot/server/default/deploy/transaction-jboss-beans.xml

And search configuration as shown below

<property name=”transactionTimeout”>900</property>
<property name=”objectStoreDir”>${jboss.server.data.dir}/tx-object-store</property>
<property name=”mbeanServer”><inject bean=”JMXKernel” property=”mbeanServer”/></property>

There are 3 ways to change HttpSession time out in Jboss.

  • 1) To change the global default HttpSession of Jboss. (This will effect to every web app that running in the Jboss AS

In Jboss 5: Edit deployers/jbossweb.deployer/web.xml

In Jboss 4.3: Edit deploy/jboss-web.deployer/conf/web.xml

Earlier Versions: Edit deploy/jbossweb-tomcat55.sar/conf/web.xml

<session-config>
<session-timeout>30</session-timeout>
</session-config>

  • 2) To change default HttpSession per web application

Add the same tag above in WEB-INF/web.xml

If the timeout value is 0, it means session never time out.

  • 3) To override the Global and Web App value  for a single client

In centos, if you dont want to use the default crontab you can create your own scheduler.

The options are

  1. Create a crontab by crontab -e
  2. Create your crontab in a file and put it in /etc/cron.d folder

I choosed option 2 because from my opinion, putting your crontab in a file is more manageable and looks more prettier. For example i can create multiple crontabs that run using multiple user level in the file instead of login to every user and create crontab for each user.

So i created a file called myCrontab and put