Caynne with Geronimo NPE

From: Lasantha Ranaweera (lasanth..pensource.lk)
Date: Tue Feb 27 2007 - 09:37:45 EST

  • Next message: Jean T. Anderson: "Re: podling BIS notifications (jars in svn & crypto)"

    Hi All,

    Finally I could managed to figure out the class loading problem with the
    help of Andrus comment. Now we are almost there for Geronimo Cayenne
    integration and having a NPE in Cayenne side when I am deploying a sample
    given in the Geronimo testsuite. :)

    I have given error, Java class file & the persistence xml below. Think it
    is due to a one of these given files. Can somebody figure it out directly
    & let me know what is there anything missing here? (hope it is not a
    problem in Cayenne) :)

    BTW as a solution I changed the given lines in EntityMapLoader class, then
    it goes bit further and failed in Visitor classes again.

    ClassLoader loader = context.getTempClassLoader(); //caynne existing one
    ClassLoader loader = persistenceUnit.getClassLoader(); //my soultion since
    we need to pass class loader from G side

    Does both given lines will give exact same results from Cayenne side?

    Error :=>
    org.apache.cayenne.jpa.JpaProviderException: Error loading ORM descriptors
            at
    org.apache.cayenne.jpa.conf.EntityMapLoader.loadEntityMap(EntityMapLoader.java:105)
            at
    org.apache.cayenne.jpa.conf.EntityMapLoader.<init>(EntityMapLoader.java:77)
            at
    org.apache.cayenne.jpa.Provider.createContainerEntityManagerFactory(Provider.java:222)
            at
    org.apache.geronimo.persistence.PersistenceUnitGBean.<init>(PersistenceUnitGBean.java:98)
            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.startConfigurationGBeans(ConfigurationUtil.java:434)
            at
    org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:188)
            at
    org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:527)
            at
    org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(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:820)
            at
    org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
            at
    org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
            at
    org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
            at
    org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$4e66e01d.startConfiguration(<generated>)
            at
    org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67)
            at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.NullPointerException
            at
    org.apache.cayenne.jpa.conf.ClassAnnotationProcessorFactory$EntityProcessor.onStartElement(ClassAnnotationProcessorFactory.java:85)
            at
    org.apache.cayenne.jpa.conf.EntityMapAnnotationLoader.loadClassMapping(EntityMapAnnotationLoader.java:202)
            at
    org.apache.cayenne.jpa.conf.EntityMapLoader.loadFromAnnotations(EntityMapLoader.java:195)
            at
    org.apache.cayenne.jpa.conf.EntityMapLoader.loadEntityMap(EntityMapLoader.java:97)
            ... 28 more

    Java File :=>
    package org.apache.geronimo.itest.jpa;

    import java.util.Date;
    import java.util.HashSet;
    import java.util.Set;
    import javax.persistence.Entity;

    @Entity
    public class AllFieldTypes {

        private short shortField;
        private int intField;
        private boolean booleanField;
        private long longField;
        private float floatField;
        private char charField;
        private double doubleField;
        private byte byteField;
        private String stringField;
        private Date dateField;
        private Set<String> setOfStrings = new HashSet<String>();
        private String[] arrayOfStrings;

        public void setShortField(short shortField) {
            this.shortField = shortField;
        }

        public short getShortField() {
            return this.shortField;
        }

        public void setIntField(int intField) {
            this.intField = intField;
        }

        public int getIntField() {
            return this.intField;
        }

        public void setBooleanField(boolean booleanField) {
            this.booleanField = booleanField;
        }

        public boolean getBooleanField() {
            return this.booleanField;
        }

        public void setLongField(long longField) {
            this.longField = longField;
        }

        public long getLongField() {
            return this.longField;
        }

        public void setFloatField(float floatField) {
            this.floatField = floatField;
        }

        public float getFloatField() {
            return this.floatField;
        }

        public void setCharField(char charField) {
            this.charField = charField;
        }

        public char getCharField() {
            return this.charField;
        }

        public void setDoubleField(double doubleField) {
            this.doubleField = doubleField;
        }

        public double getDoubleField() {
            return this.doubleField;
        }

        public void setByteField(byte byteField) {
            this.byteField = byteField;
        }

        public byte getByteField() {
            return this.byteField;
        }

        public void setStringField(String stringField) {
            this.stringField = stringField;
        }

        public String getStringField() {
            return this.stringField;
        }

        public void setDateField(Date dateField) {
            this.dateField = dateField;
        }

        public Date getDateField() {
            return this.dateField;
        }

        public void setSetOfStrings(Set<String> setOfStrings) {
            this.setOfStrings = setOfStrings;
        }

        public Set<String> getSetOfStrings() {
            return this.setOfStrings;
        }

        public void setArrayOfStrings(String[] arrayOfStrings) {
            this.arrayOfStrings = arrayOfStrings;
        }

        public String[] getArrayOfStrings() {
            return this.arrayOfStrings;
        }
    }

    persitence.xml =>

    <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/>
        </persistence-unit>
    </persistence>

    Thanks,
    Lasantha Ranaweera



    This archive was generated by hypermail 2.0.0 : Tue Feb 27 2007 - 09:38:15 EST