Thanks for the pointers, Glen. No matter whether I put my context config in conf/<engine>/<hostname>/<context-name>.xml or in the WAR's META-INF/context.xml or in the host section of server.xml I get the same result.
I assume this is a Tomcat7 change that has impacted OpenJPA -- but I am not certain. On the bright side, I was able to get JNDI datasource working with the latest TomEE. For blogs.apache.org, I think we need to get some solution in place that uses a database connection pool. Using a JNDI datasource was one avenue. I wonder if there are other options. - Dave On Sun, May 4, 2014 at 2:55 PM, Glen Mazza <glen.ma...@gmail.com> wrote: > Hi Dave, section 6.2 of the trunk Install Guide shows how you can use > JNDI with Tomcat on Roller *trunk*. That's my writeup I did after getting > it to work, so I know it works at least for trunk, which uses EclipseLink > or Hibernate as you know. > > It's approach is somewhat different from yours below, it has you add the > context.xml file to META-INF within the WAR, *or* within the Tomcat > server.xml file: > http://svn.apache.org/viewvc/roller/trunk/app/src/main/ > webapp/META-INF/context.xml-example?revision=1502743&view=markup > (incidentally, that's a revision based on a 3/4 year old file done by you > earlier in SVN, which must have been for Roller 5.0.x, so you may have > working code if you look earlier in the SVN repo.) > > HTH, > Glen > > > On 5/3/2014 3:29 PM, Dave wrote: > >> I spent morning trying to figure out how to get Roller to use a JNDI >> DataSource, something that had worked in the past (perhaps with Tomcat 6), >> but now appears to be a problem. I'm doing this (in part) to allow ASF >> Infra to better tune the database connection pool. >> >> >> What I tried was this: >> >> 1) Edited roller's context config file (ROOT.xml) to add a DataSource like >> so: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <Context path="/roller" >> docBase="/Users/dave/src/roller_5.0/weblogger-webapp/target/roller"> >> <Resource name="jdbc/rollerdb" auth="Container" >> type="javax.sql.DataSource" >> driverClassName="com.mysql.jdbc.Driver" >> >> url="jdbc:mysql://localhost:3306/roller5test?autoReconnect=true& >> useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8" >> username="scott" password="tiger" >> maxActive="25" maxIdle="5" removeAbandoned="true" maxWait="3000" >> /> >> </Context> >> >> 2) Edited Roller's roller-custom.properties file to replace the existing >> JDBD properties with this: >> >> database.configurationType=jndi >> database.jndi.name=jdbc/rollerdb >> >> 3) Checked Roller's persistence.xml file to ensure that the DataSource >> JNDI >> is correctly referenced there. >> >> <persistence xmlns="http://java.sun.com/xml/ns/persistence" >> version="2.0"> >> <persistence-unit name ="RollerPU" >> transaction-type="RESOURCE_LOCAL"> >> <jta-data-source>java:comp/env/jdbc/rollerdb</jta-data- >> source> >> ... >> >> With that setup I get this error and Roller fails to start: >> >> java.lang.RuntimeException: <openjpa-2.3.0-r422266:1540826 fatal user >> error> org.apache.openjpa.persistence.ArgumentException: The persistence >> provider is attempting to use properties in the persistence.xml file to >> resolve the data source. A Java Database Connectivity (JDBC) driver or >> data >> source class name must be specified in the openjpa.ConnectionDriverName or >> javax.persistence.jdbc.driver property. The following properties are >> available in the configuration: >> "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@7d775f33". >> >> >> I also tried a bunch of other things to get things working: >> >> a) Added these properties to Roller's config (Roller passes them through >> to >> OpenJPA): >> >> >> openjpa.ConnectionDriverName=com.mysql.jdbc.jdbc2.optional. >> MysqlConnectionPoolDataSource >> openjpa.jdbc.DBDictionary=mysql >> >> b) Tried using com.mysql.jdbc.jdbc2.optional. >> MysqlConnectionPoolDataSource >> as the driverClassName in ROOT.xml >> >> c) Tried upgrading to OpenJPA 2.3.0 >> >> >> Apparently others have experienced this problem, but I have not seen any >> good solutions in response: >> >> http://stackoverflow.com/questions/13442978/openjpa-and-jndi >> >> http://mail-archives.apache.org/mod_mbox/roller-user/201402.mbox/% >> 3ccao5arlobcvpsgnn5+cwjpedal+hzn2bb8cws5jwvcz0gkju...@mail.gmail.com%3E >> >> http://stackoverflow.com/questions/13442978/openjpa-and-jndi >> >> >> Any ideas? >> >> Thanks, >> - Dave >> >> >