If you are using the movie example, you'll need to configure the
movieDatabase pool and not the SchedulerDB pool. You'll need
something like this:
p.put("movieDatabase", "new://Resource?type=DataSource");
p.put("movieDatabase.JdbcDriver", "oracle.jdbc.OracleDriver");
p.put("movieDatabase.JdbcUrl",
"jdbc:oracle:thin:user1/[EMAIL PROTECTED]:1522:ListenerID"");
The key is the pool name, movieDatabase above, needs to match the
first part of the property name. This page explains how to correctly
setup JPA datasources.
http://openejb.apache.org/3.0/openjpa.html
-dain
On Nov 19, 2008, at 5:58 PM, ericp56 wrote:
Hello,
I'm using Eclipse and OpenEjb3.1, testing my OpenJPA application.
I am connecting to an Oracle database using the JdbcUrl
When I use code:
p = System.getProperties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
p.put("SchedulerDB.JdbcDriver", "oracle.jdbc.OracleDriver");
p.put("SchedulerDB.JdbcUrl",
"jdbc:oracle:thin:user1/[EMAIL PROTECTED]:1522:ListenerID");
I am getting the error message invalid logon.
If I put this same info in openejb.xml, it works fine.
Hmmm, the funny thing is I didn't change the resource id from the
demo, and
it still connected to the DB OK.
<Resource id="movieDatabase" type="DataSource">
JdbcDriver = oracle.jdbc.OracleDriver
JdbcUrl = jdbc:oracle:thin:user1/[EMAIL PROTECTED]:
1522:ListenerID
</Resource>
ScrapEjbTest
com.twcable.ivr.test.ScrapEjbTest
test1(com.twcable.ivr.test.ScrapEjbTest)
javax.ejb.EJBException: The bean encountered a non-application
exception;
nested exception is:
<openjpa-1.1.0-r422266:659716 fatal general error>
org.apache.openjpa.persistence.PersistenceException: Cannot create
PoolableConnectionFactory (ORA-01017: invalid username/password; logon
denied
)
at
org
.apache
.openejb
.core
.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:
363)
at
org
.apache
.openejb
.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:291)
at $Proxy42.Echo(Unknown Source)
at com.twcable.ivr.test.ScrapEjbTest.test1(ScrapEjbTest.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org
.junit
.internal
.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at
org
.junit
.internal
.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:
34)
at
org
.junit
.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at
org
.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at
org
.junit
.internal
.runners
.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:
66)
at
org
.junit
.internal
.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner
$1.runUnprotected(TestClassRunner.java:42)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:
34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:
52)
at
org
.eclipse
.jdt
.internal
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
196)
Caused by: <openjpa-1.1.0-r422266:659716 fatal general error>
org.apache.openjpa.persistence.PersistenceException: Cannot create
PoolableConnectionFactory (ORA-01017: invalid username/password; logon
denied
)
at
org
.apache
.openjpa
.jdbc
.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:101)
at
org
.apache
.openjpa
.jdbc
.conf
.JDBCConfigurationImpl
.getDBDictionaryInstance(JDBCConfigurationImpl.java:554)
at
org
.apache
.openjpa
.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:
1250)
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:843)
at
org
.apache
.openjpa
.conf
.OpenJPAConfigurationImpl
.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:834)
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:56)
at
org
.apache
.openejb
.persistence
.JtaEntityManagerRegistry
.getEntityManager(JtaEntityManagerRegistry.java:105)
at
org
.apache
.openejb
.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:
61)
at
org
.apache
.openejb.persistence.JtaEntityManager.persist(JtaEntityManager.java:
97)
at com.twcable.ivr.test.ScrapClass.Echo(ScrapClass.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext
$Invocation.invoke(ReflectionInvocationContext.java:158)
at
org
.apache
.openejb
.core
.interceptor
.ReflectionInvocationContext
.proceed(ReflectionInvocationContext.java:141)
at
org
.apache
.openejb
.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
at
org
.apache
.openejb
.core.stateless.StatelessContainer._invoke(StatelessContainer.java:
211)
at
org
.apache
.openejb
.core.stateless.StatelessContainer.invoke(StatelessContainer.java:169)
at
org
.apache
.openejb
.core
.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:
217)
at
org
.apache
.openejb
.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:77)
at
org
.apache
.openejb
.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
... 22 more
Caused by: java.lang.Exception:
org.apache.commons.dbcp.SQLNestedException:
Cannot create PoolableConnectionFactory (ORA-01017: invalid
username/password; logon denied
)
at
org
.apache
.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:249)
at
org
.apache
.openjpa
.persistence
.PersistenceException.writeObject(PersistenceException.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:
917)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:
1339)
at
java
.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:
1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:
1079)
at
java
.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:
1375)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:
1347)
at
java
.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:
1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:
1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:
302)
at
org
.apache
.openejb
.core.ivm.BaseEjbProxyHandler.copyObj(BaseEjbProxyHandler.java:506)
at
org
.apache
.openejb.core.ivm.BaseEjbProxyHandler.copy(BaseEjbProxyHandler.java:
306)
at
org
.apache
.openejb
.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:290)
... 22 more
--
View this message in context:
http://www.nabble.com/OpenEJB-issue-with-Oracle-Driver-tp20592289p20592289.html
Sent from the OpenEJB User mailing list archive at Nabble.com.