openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <>
Subject [jira] Commented: (OPENJPA-552) Do not recognize Connection* properties in persistence.xml in appl server container
Date Wed, 02 Apr 2008 18:25:25 GMT


Albert Lee commented on OPENJPA-552:

The cause of the problem sourced from: 

        private ClassTransformerImpl(ConfigurationProvider cp, String props, 
            final ClassLoader tmpLoader, OpenJPAConfiguration conf) {
            // don't allow connections
            conf.setConnectionUserName(null);  <<<<< Connection Properties
are removed
            conf.setConnectionPassword(null); <<<<< Connection Properties are
            conf.setConnectionURL(null); <<<<< Connection Properties are removed
            conf.setConnectionDriverName(null); <<<<< Connection Properties
are removed
            conf.setConnectionFactoryName(null); <<<<< Connection Properties
are removed
            // use the tmp loader for everything
            conf.setClassResolver(new ClassResolver() {
                public ClassLoader getClassLoader(Class context, 
                    ClassLoader env) {
                    return tmpLoader;
            MetaDataRepository repos = conf.getMetaDataRepositoryInstance();

So even the properties are defined in the configuration, they are removed before the MetaDataRepository
instance is created. Hence no data source can be found and the described exception is thrown.

This change is introduced in r452141.  We assert that these setConnection*(null) statements
are not needed because:
1) If the Connection* properties need to be nulled, why are the Connection2* properties are
not affected.'
2) The pu can override the intention of these setter(null) calls by specifying the <jta-data-source>
and make these operations irrevalent.

Albert Lee.

> Do not recognize Connection* properties in persistence.xml in appl server container
> -----------------------------------------------------------------------------------
>                 Key: OPENJPA-552
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.2, 1.0.3, 1.1.0
>            Reporter: Albert Lee
>            Assignee: Albert Lee
>             Fix For: 1.0.3, 1.1.0
> If Connection* properties are specified in a persistence unit and there is no <jta-data-source>,
<non-jta-data-source> or default data source defined, 
>         PU name : dweb24
>        Root URL : file:/D:/dev/jdk/runtimes/base_v7_i7/profiles/AppSrv01/installedApps/kingoftownNode03Cell/dweb24Ear.ear/dweb24.war/WEB-INF/classes/
>         Tx Type : JTA
>            desc : 
>        Provider : [WSJPA-1.1.0-SNAPSHOT-r1118:1345,
>          JTA DS : <<null>> | null
>       nonJTA DS : <<null>> | null
>     exclude Cls : false
>       file URLs : []
>       mappigFNm : []
>  managedClasses : [entities.Department,entities.Employee]
>      Properties : {, openjpa.ConnectionPassword=db2admin,
openjpa.ConnectionUserName=db2admin, openjpa.ConnectionURL=jdbc:db2://supermatrix:50000/SAMPLE:retrieveMessagesFromServerOnGetMessage=true;,
> then the following exception will be thrown from DataSourceFactory.newDataSource method:
>     <openjpa-1.1.0-SNAPSHOT-r420667:636531 fatal user error> 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(
> 	at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(
> 	at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(
> 	at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(
> 	at org.apache.openjpa.lib.conf.Configurations.configureInstance(
> 	at org.apache.openjpa.lib.conf.Configurations.configureInstance(
> This called path is initiated from PersistenceProviderImpl.createContainerEntityManagerFactory.
 Consequentially, transformer is not being registered in the appl server container and no
load time entity enhancement is performed.
> openjpa.Runtime: Warn: An error occurred while registering a ClassTransformer with dweb24.
The error is logged along with this warning. Load-time class transformation will not be available.
> Albert Lee.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message