cancel
Showing results for 
Search instead for 
Did you mean: 

Porting open source application to SAP WAS

Former Member
0 Kudos

Hi,

I'm porting jZForum ( http://www.jzforum.org ) to integrate it with SAP WAS and SAP Dictionary instead of internally used

HypersonicSQL database. I mainly changed obtaining connection to the database directly through JDBC:

jdbc:hsqldb:hsql://localhost:1476

into connection obtained through JNDI with Spring Framework (more precisely through org.springframework.jndi.JndiObjectFactoryBean class) :

jdbc/MY_DATABASE

with connection pooling parameters:

initial connections: 1

maximum connections: 50

maximum time to wait for connection: 120

expiration: yes

connection lifetime: 600

cleanup thread: 300

Unfortunately ported jzForum seems to "hang on". I see in Log Viewer (Visual Administrator) log that it is quering database with a lot of SELECTs,

I assume that it is indexer which on startup is indexing all objects from the forum to speed up searching this objects in the future.

After about 2-3 minutes hanging on, application shows generated page, but every subsequent request to

the server cause hanging on in the same way.

I assume that it might be the case that application is obtaining through JNDI connection to the database, but is

not releasing it. I have examined entire jzForum code, and closed all unnecesary Connection in final Java statements,

but it unfortunately didn't help.

Original jzForum (not ported to SAP Dictionary) works on SAP WAS just perfectly.

Have someone else experience with porting open source application from some database (eg. HSQL) to SAP Dictionary ?

Maybe it is a problem with Spring Framework implementation ? Maybe it is a problem with wrongly configured connection pool ?

I have no idea at the moment. Every help will be appreciated.

Kind regards,

Marcin Zduniak

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member184385
Active Participant
0 Kudos

Hi Marcin,

from what you are describing, the port to JNDI obtained connections and your "research" in visual admin uncovered some issues with the original code ( not closing open connection ).

My attempt to explain your difficulties:

1. Working with hsqldb in direct mode, where hsqldb connection are obtained by driver.getConnection(), works well, becuse GC "reclaims" unused but not closed

connections. Things seems to work out this way.

2. Getting connections through JNDI involves a datasource with its associated db pool. Not closed connections are then "trapped" in the pool as long as is specified by the "connection lifetime" DS parameter. Things get worse by the time, becuse the application leaks constantly connections.

Remedy for the problems described in 2:

- middle term: fix the application: here spring might be useful, consider using its JDBC support classes!

- short term: set the connection lifetime to a small value to let pool reclaim the unclosed connections

Hope it helps a bit,

Gregor

Former Member
0 Kudos

I had some similiar problems using another Open Source persistence layer (OpenQuasar) with the Web AS (and MaxDB) using a stateless Session Bean and CMT.

The persistence framework registers a javax.transaction.Synchronization callback to the current transaction and flushes all modified objects in the beforeCompletion() method.

But when calling DataSource.getConnection() in beforeCompletion() another connection than the one in the bean's business method is returned.

This leads to the following scenario: a database row is locked in the bean method (using SELECT FOR UPDATE) on the first connection, but the flush (UPDATE) on the same row is performed in beforeCompletion() using a second connection. This of course leads to a deadlock in the database.

I couldn't find out why the Web AS returns another connection here (the first connection has been closed properly).

You could try to switch off the flushing at the end of transaction and immediately write back changes to the database. E.g. Hibernate allows to configure this.

Eric