On 15-1-2012 19:06, Daniel Ruan wrote:
Hi Marcus,
I found another way to get this to work while keeping the jdbc/roller JDNI
data source name. I placed commons-pool and commons-dbcp jars in
WEB-INF/lib, and added the following lines to roller-custom.properties:
openjpa.ConnectionDriverName=org.apache.commons.dbcp.BasicDataSource
openjpa.ConnectionProperties="\
DriverClassName=oracle.jdbc.OracleDriver,\
Url=jdbc:oracle:thin:@localhost:1521:XE,\
Username=scott,\
Password=tiger,\
initialSize=10,\
maxActive=40,\
maxIdle=10,\
maxWait=10000,\
removeAbandoned=true,\
removeAbandonedTimeout=60,\
logAbandoned=true\
"
openjpa.DataCache=true(CacheSize=5000) # default CacheSize=1000
openjpa.IgnoreChanges=true
openjpa.RetainState=true
Roller will use the Tomcat JNDI data source to do the initial handshake
(e.g., checking db version). If you set [ maxActive="1" maxIdle="0" ] in
the JDNI data source, that connection will be soon released. After that,
the OpenJPA pool is used in the application.
Cheers,
Daniel
Versie: 2012.0.1901 / Virusdatabase: 2109/4738 - datum van uitgifte:
01/12/12
Hi Daniel,
I had another look at this and I have seen that if you define your
context datasource prefixed with the jndi namespace then it works.
ie use java:comp/env/jdbc/rollerdb instead of just jdbc/rollerdb. That
will then be all you need,
cheers
Marcus
-----
Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 2012.0.1901 / Virusdatabase: 2109/4744 - datum van uitgifte: 01/15/12
Hi Daniel,
thanks for the tip on the above. I think we've got it cracked now ! I
looke din the source code and found the initial test of the connect
where you get success appends the javanamespace for jndi but the
properities for OpenJpa is not updated accordingly. It is this that
stops it working. It gives the message that it needs the drivername but
in fact this is just a general error message. The error it has is in
fact it cannot find your jndi name. For me it means I know it is now
using the Tomcat Pooling supplied for the context datasource.
My site is up and running now. I posted a comment for the datasource
setup in the link to the java blog roll You can add your comments there
as well if you want ?
link is www.javamarcus.com , click on the javaposts and you can add
your solution,
cheers Mate and have a good week,
Marcus