openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthieu Riou" <matthieu.r...@gmail.com>
Subject Re: Configuration: either / or ?
Date Tue, 09 Jan 2007 21:07:13 GMT
So if I do:

        propMap.put("openjpa.ConnectionDriverName",
org.apache.derby.jdbc.EmbeddedDriver.class.getName());
        propMap.put("openjpa.ConnectionFactoryName",
org.apache.derby.jdbc.EmbeddedDriver.class.getName());
        propMap.put("openjpa.ConnectionFactory", _datasource);

It tries to lookup ConnectionFactoryName in JNDI which doesn't work. If I
remove ConnectionFactoryName and keep the other 2 it instantiates the
EmbeddedDriver itself and ignores the datasource instance I provided.

Another idea?

On 1/9/07, Marc Prud'hommeaux <mprudhom@apache.org> wrote:
>
> Matthieu-
>
> We may not be expecting you to just manually set the DataSource. Try
> setting the "openjpa.ConnectionFactory" property to the DataSource
> object you are using, and then set "openjpa.ConnectionFactoryName" to
> some bogus string and see what happens.
>
> If there is an error, be sure to post the complete stack trace.
>
>
>
> On Jan 9, 2007, at 9:11 AM, Matthieu Riou wrote:
>
> > If I don't set "openjpa.ConnectionDriverName" (and even if I set "
> > openjpa.ConnectionFactory" with my datasource instance) I get the
> > "A JDBC
> > Driver or DataSource class name must be specified in the
> > ConnectionDriverName property" error. So I'm getting more and more
> > confused
> > as to which properties I should set...
> >
> > On 1/8/07, Marc Prud'hommeaux <mprudhom@apache.org> wrote:
> >>
> >> Matthieu-
> >>
> >> I think you want "openjpa.ConnectionFactory", not
> >> "openjpa.ConnectionDriverName".
> >>
> >>
> >>
> >> On Jan 8, 2007, at 9:45 AM, Matthieu Riou wrote:
> >>
> >> > Hi,
> >> >
> >> > I've just tried your fix after compiling the OpenJPA trunk. I'm
> >> > getting a
> >> > ClassCastException as the openjpa.ConnectionDriverName is set as a
> >> > StringValue. Should I use another property instead?
> >> >
> >> > My code:
> >> >
> >> >        propMap.put("openjpa.jdbc.DBDictionary", "
> >> > org.apache.openjpa.jdbc.sql.DerbyDictionary");
> >> >        propMap.put("openjpa.ManagedRuntime", new TxMgrProvider());
> >> >        propMap.put("openjpa.ConnectionDriverName", _datasource);
> >> >        propMap.put("openjpa.Log", "DefaultLevel=TRACE");
> >> >        EntityManagerFactory emf =
> >> > Persistence.createEntityManagerFactory("ode-dao",
> >> > propMap);
> >> >        EntityManager em = emf.createEntityManager();
> >> >
> >> > The exception:
> >> >
> >> > <0|true|0.9.7-incubating-SNAPSHOT>
> >> > org.apache.openjpa.persistence.PersistenceException: There was an
> >> > error when
> >> > invoking the static newInstance method on the named factory class "
> >> > org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory".  See the nested
> >> > exception
> >> > for details.
> >> >        at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
> >> > Bootstrap.java:62)
> >> >        at
> >> >
> >> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityMa
> >> n
> >> > agerFactory
> >> > (PersistenceProviderImpl.java:70)
> >> >        at
> >> >
> >> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityMa
> >> n
> >> > agerFactory
> >> > (PersistenceProviderImpl.java:78)
> >> >        at javax.persistence.Persistence.createEntityManagerFactory(
> >> > Persistence.java:83)
> >> >        at org.apache.ode.axis2.ODEServerJPA.initJPA
> >> > (ODEServerJPA.java:345)
> >> >        at org.apache.ode.axis2.ODEServerJPA.init
> >> (ODEServerJPA.java:96)
> >> >        at org.apache.ode.axis2.hooks.ODEAxisServlet.init(
> >> > ODEAxisServlet.java:50)
> >> >        at org.apache.catalina.core.StandardWrapper.loadServlet(
> >> > StandardWrapper.java:1105)
> >> >        at org.apache.catalina.core.StandardWrapper.load(
> >> > StandardWrapper.java:932)
> >> >        at org.apache.catalina.core.StandardContext.loadOnStartup(
> >> > StandardContext.java:3917)
> >> >        at org.apache.catalina.core.StandardContext.start(
> >> > StandardContext.java:4201)
> >> >        at org.apache.catalina.core.ContainerBase.addChildInternal(
> >> > ContainerBase.java:759)
> >> >        at org.apache.catalina.core.ContainerBase.addChild(
> >> > ContainerBase.java:739)
> >> >        at org.apache.catalina.core.StandardHost.addChild
> >> > (StandardHost.java
> >> > :524)
> >> >        at org.apache.catalina.startup.HostConfig.deployWAR
> >> > (HostConfig.java
> >> > :809)
> >> >        at org.apache.catalina.startup.HostConfig.deployWARs
> >> > (HostConfig.java
> >> > :698)
> >> >        at org.apache.catalina.startup.HostConfig.deployApps
> >> > (HostConfig.java
> >> > :472)
> >> >        at org.apache.catalina.startup.HostConfig.start
> >> (HostConfig.java
> >> > :1122)
> >> >        at org.apache.catalina.startup.HostConfig.lifecycleEvent(
> >> > HostConfig.java:310)
> >> >        at
> >> > org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
> >> > LifecycleSupport.java:119)
> >> >        at org.apache.catalina.core.ContainerBase.start
> >> > (ContainerBase.java
> >> > :1021)
> >> >        at org.apache.catalina.core.StandardHost.start
> >> > (StandardHost.java
> >> > :718)
> >> >        at org.apache.catalina.core.ContainerBase.start
> >> > (ContainerBase.java
> >> > :1013)
> >> >        at org.apache.catalina.core.StandardEngine.start
> >> > (StandardEngine.java
> >> > :442)
> >> >        at org.apache.catalina.core.StandardService.start(
> >> > StandardService.java:450)
> >> >        at org.apache.catalina.core.StandardServer.start
> >> > (StandardServer.java
> >> > :709)
> >> >        at org.apache.catalina.startup.Catalina.start(Catalina.java:
> >> > 551)
> >> >        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.catalina.startup.Bootstrap.start
> >> > (Bootstrap.java:294)
> >> >        at org.apache.catalina.startup.Bootstrap.main
> >> (Bootstrap.java:
> >> > 432)
> >> > Caused by: org.apache.openjpa.lib.util.ParseException:
> >> > ConnectionDriverName:
> >> > org.opentools.minerva.connector.jdbc.JDBCDataSource@dfbb43
> >> >        at org.apache.openjpa.lib.conf.Value.setObject(Value.java:
> >> 298)
> >> >        at
> >> > org.apache.openjpa.lib.conf.ConfigurationImpl.fromProperties(
> >> > ConfigurationImpl.java:627)
> >> >        at
> >> > org.apache.openjpa.lib.conf.MapConfigurationProvider.setInto(
> >> > MapConfigurationProvider.java:82)
> >> >        at
> >> > org.apache.openjpa.persistence.PersistenceProductDerivation
> >> > $ConfigurationProviderImpl.setInto
> >> > (PersistenceProductDerivation.java:406)
> >> >        at
> >> > org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newInstance(
> >> > JDBCBrokerFactory.java:56)
> >> >        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.openjpa.kernel.Bootstrap.invokeFactory
> >> > (Bootstrap.java
> >> > :117)
> >> >        at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(
> >> > Bootstrap.java:57)
> >> >        ... 32 more
> >> > Caused by: java.lang.ClassCastException:
> >> > org.opentools.minerva.connector.jdbc.JDBCDataSource
> >> >        at
> >> org.apache.openjpa.lib.conf.StringValue.setInternalObject(
> >> > StringValue.java:63)
> >> >        at org.apache.openjpa.lib.conf.Value.setObject(Value.java:
> >> 294)
> >> >        ... 42 more
> >> >
> >> > Thanks!
> >> >
> >> > Matthieu
> >> >
> >> > On 1/3/07, Abe White <awhite@bea.com> wrote:
> >> >>
> >> >> SVN revision 492368 no long ignores non-String values for
> >> openjpa.*
> >> >> keys in the Map passed to Persistence.createEntityManagerFactory.
> >> >>
> >> _____________________________________________________________________
> >> >> __
> >> >> Notice:  This email message, together with any attachments, may
> >> >> contain
> >> >> information  of  BEA Systems,  Inc.,  its subsidiaries  and
> >> >> affiliated
> >> >> entities,  that may be confidential,  proprietary,  copyrighted
> >> >> and/or
> >> >> legally privileged, and is intended solely for the use of the
> >> >> individual
> >> >> or entity named in this message. If you are not the intended
> >> >> recipient,
> >> >> and have received this message in error, please immediately return
> >> >> this
> >> >> by email and then delete it.
> >> >>
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message