Hi!
I'm new to GAE and had quite a lot of issues that I solved, but stuck with 
this one.
The app deploys/runs fine locally, but fails to run on the server.

ERROR org.springframework.web.context.ContextLoader  - Context initialization 
failed
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'springpmf' defined in ServletContext resource [/WEB-INF/beans.xml]: 
Invocation of init method failed; nested exception is 
javax.jdo.JDOFatalUserException: Application code attempted to create a 
PersistenceManagerFactory named keepeye, but one with this name already exists! 
 Instances of PersistenceManagerFactory are extremely slow to create and it is 
usually not necessary to create one with a given name more than once.  Instead, 
create a singleton and share it throughout your code.  If you really do need to 
create a duplicate PersistenceManagerFactory (such as for a unittest suite), 
set the appengine.orm.disable.duplicate.pmf.exception system property to avoid 
this error.

But the PMF is created just once (see below conf) by spring and injected 
into my dao. All the beans are singletons.
I have the following spring config:
    <!-- JDO PMF config -->
    <bean id="springpmf" 
class="org.springframework.orm.jdo.LocalPersistenceManagerFactoryBean">
        <property name="persistenceManagerFactoryName" value="keepeye" />
    </bean>

    <bean id="pmfproxy" 
class="org.springframework.orm.jdo.TransactionAwarePersistenceManagerFactoryProxy">
        <property name="targetPersistenceManagerFactory" ref="springpmf" />
        <property name="allowCreate" value="false" />
    </bean>

    <bean id="transactionManager" 
class="org.springframework.orm.jdo.JdoTransactionManager">
        <property name="persistenceManagerFactory" 
ref="pmfproxy"></property>
    </bean>
    <bean id="dao" class="wowpop.service.DAO">
        <property name="pmf" ref="pmfproxy"></property>
    </bean>
Plz suggest something:)
The dao
public class DAO {
    //    private static final PersistenceManagerFactory PMF = 
JDOHelper.getPersistenceManagerFactory("keepeye");
    private PersistenceManagerFactory pmf;

    public void save(Object obj) {
        PersistenceManager pm = pmf.getPersistenceManager();
        pm.makePersistent(obj);
        //        pm.close();
    }

    /**
     * @return list of ServerStats that fit the dates range
     */
    public List<ServerStats> findInDateRange(long from, long to) {
        PersistenceManager pm = pmf.getPersistenceManager();
        System.out.println("got manager");
        Query q = pm.newQuery(ServerStats.class, "time>=:from && time 
<=:to");
        List<ServerStats> result = (List<ServerStats>) q.execute(from, to);
        //        pm.close();
        return result;
    }

    /**
     * @param pmf the pmf to set
     */
    public void setPmf(PersistenceManagerFactory pmf) {
        this.pmf = pmf;
    }

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to