Re: Help Needed on Cayenne Geronimo Work

From: Lasantha Ranaweera (lasanth..pensource.lk)
Date: Mon Feb 26 2007 - 07:21:21 EST

  • Next message: Andrus Adamchik: "Re: Help Needed on Cayenne Geronimo Work"

    Thanks Andrus for your reply. I also thought like that after some more
    debugging too.

    Please let me know how can create/refer a Datasource for a cayenne JPA
    sample. Does it related to org.apache.cayenne.jpa.jpaDataSourceFactory
    property?

    Is there any resource refer?

    Thanks,
    Lasantha

    > Looks like some cross-ClassLoader issue in Geronimo. I don't think
    > this is Cayenne related.
    >
    > Andrus
    >
    > On Feb 25, 2007, at 5:04 AM, Lasantha Ranaweera wrote:
    >
    >> Hi Cayenne Experts,
    >>
    >> Currently I have been hitting with a problem of ClassCastException
    >> in my
    >> first JPA program of Geronimo/Caynne integration. I am unable to
    >> find out
    >> the exact problem since my knowledge of Cayenne architecture is pretty
    >> low. In the Geronimo side following is the line it gives this problem.
    >>
    >> Class clazz = classLoader.loadClass(persistenceProviderClassName);
    >> PersistenceProvider persistenceProvider =
    >> (PersistenceProvider)clazz.newInstance(); //here is the CCE Exception
    >>
    >> In Eclipse remote debugging enviroment it comes to Cayenne Provider
    >> class
    >> and it finishes default constructor without any errors. Does the
    >> Cayenne
    >> do anyting after creating the Provider instance when it comes to a
    >> server
    >> enviroment? I split two statements investigate more and list the
    >> interfaces in clazz variable. It lists PersistenceProvider interface
    >> correctly too. So I am wondering where is CCE occurs. I attached
    >> the error
    >> below but it doesn't give that much information. Any help please ...
    >>
    >> Additionally I didn't add any properties in persitence.xml file. I
    >> want to
    >> use Derby database to save JPA object too. Do I need to set
    >> org.apache.cayenne.jpa.jpaDataSourceFactory property, then what is the
    >> value it should be?
    >>
    >> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
    >> version="1.0">
    >>
    >> <persistence-unit transaction-type="RESOURCE_LOCAL"
    >> name="openjpa-itest">
    >> <provider>org.apache.cayenne.jpa.Provider</provider>
    >> <class>org.apache.geronimo.itest.jpa.AllFieldTypes</class>
    >> <exclude-unlisted-classes/>
    >>
    >> <properties>
    >> <!--
    >> <property
    >> name="org.apache.cayenne.jpa.jpaDataSourceFactory"
    >> value=""/>
    >> -->
    >> </properties>
    >> </persistence-unit>
    >> </persistence>
    >>
    >> Thanks,
    >> Lasantha Ranaweera
    >>
    >> java.lang.ClassCastException: org.apache.cayenne.jpa.Provider
    >> at
    >> org.apache.geronimo.persistence.PersistenceUnitGBean.<init>
    >> (PersistenceUnitGBean.java:102)
    >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0
    >> (Native
    >> Method)
    >> at
    >> sun.reflect.NativeConstructorAccessorImpl.newInstance
    >> (NativeConstructorAccessorImpl.java:39)
    >> at
    >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance
    >> (DelegatingConstructorAccessorImpl.java:27)
    >> at java.lang.reflect.Constructor.newInstance
    >> (Constructor.java:494)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance
    >> (GBeanInstance.java:936)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(
    >> GBeanInstanceState.java:267)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start
    >> (GBeanInstanceState.java:102)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive
    >> (GBeanInstanceState.java:124)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive
    >> (GBeanInstance.java:543)
    >> at
    >> org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean
    >> (BasicKernel.java:379)
    >> at
    >> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfiguration
    >> GBeans(ConfigurationUtil.java:434)
    >> at
    >> org.apache.geronimo.kernel.config.KernelConfigurationManager.start
    >> (KernelConfigurationManager.java:188)
    >> at
    >> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConf
    >> iguration(SimpleConfigurationManager.java:527)
    >> at
    >> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConf
    >> iguration(SimpleConfigurationManager.java:508)
    >> at
    >> org.apache.geronimo.kernel.config.SimpleConfigurationManager$
    >> $FastClassByCGLIB$$ce77a924.invoke(<generated>)
    >> at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
    >> at
    >> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke
    >> (FastMethodInvoker.java:38)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke
    >> (GBeanOperation.java:127)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke
    >> (GBeanInstance.java:855)
    >> at
    >> org.apache.geronimo.kernel.basic.BasicKernel.invoke
    >> (BasicKernel.java:239)
    >> at
    >> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
    >> at
    >> org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$
    >> $1cccefc9.invoke(<generated>)
    >> at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
    >> at
    >> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke
    >> (FastMethodInvoker.java:38)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke
    >> (GBeanOperation.java:127)
    >> at
    >> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke
    >> (GBeanInstance.java:855)
    >> at
    >> org.apache.geronimo.kernel.basic.BasicKernel.invoke
    >> (BasicKernel.java:239)
    >> at
    >> org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke
    >> (MBeanGBeanBridge.java:168)
    >> at
    >> com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke
    >> (DynamicMetaDataImpl.java:213)
    >> at com.sun.jmx.mbeanserver.MetaDataImpl.invoke
    >> (MetaDataImpl.java:220)
    >> at
    >> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke
    >> (DefaultMBeanServerInterceptor.java:815)
    >> at
    >> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
    >> at
    >> javax.management.remote.rmi.RMIConnectionImpl.doOperation
    >> (RMIConnectionImpl.java:1408)
    >> at
    >> javax.management.remote.rmi.RMIConnectionImpl.access$100
    >> (RMIConnectionImpl.java:81)
    >> at
    >> javax.management.remote.rmi.RMIConnectionImpl
    >> $PrivilegedOperation.run(RMIConnectionImpl.java:1245)
    >> at java.security.AccessController.doPrivileged(Native Method)
    >> at
    >> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation
    >> (RMIConnectionImpl.java:1348)
    >> at
    >> javax.management.remote.rmi.RMIConnectionImpl.invoke
    >> (RMIConnectionImpl.java:782)
    >> 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
    >> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
    >> at sun.rmi.transport.Transport$1.run(Transport.java:153)
    >> at java.security.AccessController.doPrivileged(Native Method)
    >> at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    >> at
    >> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:
    >> 466)
    >> at
    >> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run
    >> (TCPTransport.java:707)
    >> at java.lang.Thread.run(Thread.java:595)
    >>
    >>
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Feb 26 2007 - 07:21:50 EST