Wednesday, October 6, 2010

OpenJPA 1.2.2 in RAD 7.5

PROBLEM #1:

org.apache.openjpa.util.UserException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.

at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:74)

..

..

[10/6/10 8:43:48:255 CDT] 00000017 SystemErr R Caused by: java.lang.RuntimeException: There were errors initializing your configuration: org.apache.openjpa.util.UserException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.

at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:74)


RESOLUTION:

The link between WAS and OpenJPA is the "datasource" name specified in "persistence.xml". The above error indicates that such a link does not exist i.e., the datasource speficied in persistence.xml can not be found as JNDI resource on the WAS server. Therefore configure a matching JDBC resource (datasource). Further details on the link between two is found in OpenJPA-1.2.2 Manual.pdf - Section 4.2. Using a Third-Party DataSource.


PROBLEM #2:

[10/6/10 9:21:30:773 CDT] 00000019 SystemErr R org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "null" and URL "null". You may have specified an invalid URL.

at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:256)


RESOLUTION:

In the Data Source Configuration, I need to select the "Component-managed Authentication Alias". If it had a value of "None' which is the default, I was witnessing the above problem.