[ 
https://issues.apache.org/jira/browse/OPENJPA-848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660889#action_12660889
 ] 

Jeremy Bauer commented on OPENJPA-848:
--------------------------------------

Based on the error, I expect the failure to be caused by not having the dbcp 
[1] jar in your classpath.  Your comment "Now I need to configure it using 
openjpa.ConnectionProperties to specify the connection pool information, and It 
isn't working" and the order of the included persistence.xml's indicates they 
may have been pasted in reverse order (since the first uses dbcp and the second 
does not).  If they were pasted in reverse order my guess is that adding the 
dbcp jar to your classpath will correct the problem.  Otherwise, the dbcp 
driver is not specified in your persistence.xml so OpenJPA should/would not be 
trying to load it.

[1] http://commons.apache.org/dbcp/

> Pool configuration error
> ------------------------
>
>                 Key: OPENJPA-848
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-848
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.0
>         Environment: windows, db2
>            Reporter: Horacio Antonelli
>            Priority: Blocker
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> I'm using this persistence.xml configuration, and it works
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0">
>       <persistence-unit name="RP" transaction-type="RESOURCE_LOCAL">
>     
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>               <class>model.Address</class>
>               <class>model.Business</class>           
>               <properties>            
>                       <property name="openjpa.ConnectionProperties" 
>                               value="Url=jdbc:db2:RP,
>                               DriverClassName=COM.ibm.db2.jdbc.app.DB2Driver,
>                               Username=User,
>                               Password=User1"/>
>                       <property name="openjpa.ConnectionDriverName" 
>                               
> value="org.apache.commons.dbcp.BasicDataSource"/> 
>               </properties>
>       </persistence-unit>
> </persistence>
> Now I need to configure it using openjpa.ConnectionProperties to specify the 
> connection pool information, and It isn't working
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0">
>       <persistence-unit name="RP" transaction-type="RESOURCE_LOCAL">
>     
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>               <class>model.Address</class>
>               <class>model.Business</class>           
>               <properties>            
>                         <property name="openjpa.ConnectionURL" 
> value="jdbc:db2:RP"/>
>                       <property name="openjpa.ConnectionDriverName" 
> value="COM.ibm.db2.jdbc.app.DB2Driver"/>
>                       <property name="openjpa.ConnectionUserName" 
> value="User"/>
>                       <property name="openjpa.ConnectionPassword" 
> value="User1"/>
>                       <property name="openjpa.Log" value="DefaultLevel=WARN, 
> Tool=INFO"/>     
>               </properties>
>       </persistence-unit>
> </persistence>
> I get this
> 30188  ReportAndPay  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.2.0
> <openjpa-1.2.0-r422266:683325 fatal user error> 
> org.apache.openjpa.persistence.ArgumentException: A connection could not be 
> obtained for driver class "org.apache.commons.dbcp.BasicDataSource" and URL 
> "null".  You may have specified an invalid URL.
>       at 
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:256)
>       at 
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:125)
>       at 
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:784)
>       at 
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:561)
>       at 
> org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1265)
>       at 
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
>       at 
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
>       at 
> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
>       at 
> org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
>       at 
> org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
>       at 
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
>       at 
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:854)
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:638)
>       at 
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:183)
>       at 
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
>       at 
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
>       at 
> com.ibm.gatewayservices.util.TransactionManager.beginTransaction(TransactionManager.java:23)
>       at com.ibm.gatewayservices.test.Main.main(Main.java:65)
> Caused by: java.lang.ClassNotFoundException: 
> org.apache.commons.dbcp.BasicDataSource
>       at java.lang.Class.forName(Class.java:130)
>       at 
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:87)
>       ... 18 more
> Please, enlight me on this. thank you!

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

Reply via email to