Results 1 to 7 of 7

Thread: More adventures in GAE Persistence

  1. #1

    Question More adventures in GAE Persistence

    I've upgrade Roo to 1.1.2 and run my script to create an App using GAE Persistence. I still have to make fixes in my Tour_Roo_JavaBean.aj to get it to compile. This entity has many-to-many relationships implemented as Set with some of my other entities. There are 2 problems.

    • HashSet is used in the Set<Key> declarations but not imported.
    • The getters and setters try to create (instanciate) new Set<...>() rather than new HashSet<...>().


    After fixing these, I still have a problem when I try to Run on Server (STS 2.5.2). I'm getting this exception:

    Code:
    2011-03-03 06:16:45,347 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
    org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.NullPointerException: No API environment is registered for this thread.
    	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:382)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:273)
    	at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$before$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:63)
    	at com.getrolling.cis.InsertTestData.init(InsertTestData.java:33)
    	at com.getrolling.cis.InsertTestData.onApplicationEvent(InsertTestData.java:28)
    	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
    	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
    	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
    ...
    Any help?

    Dan

  2. #2
    Join Date
    Mar 2011
    Posts
    2

    Default

    Same problems with SET. No problem with EntityManager after correct the code.
    Roo 1.1.2.

    This is my script:

    Code:
    project --topLevelPackage com.test --projectName gae-test --java 6
    persistence setup --database GOOGLE_APP_ENGINE --provider DATANUCLEUS 
    
    entity --class ~.shared.test.Smartmeter --testAutomatically 
    entity --class ~.shared.test.Variable --testAutomatically 
    
    focus --class ~.shared.test.Smartmeter
    field number --fieldName estado --notNull --type java.lang.Integer --value 1
    field set --fieldName variables --type ~.shared.test.Variable
    
    focus --class ~.test.Variable
    field string --fieldName nombre --notNull

  3. #3

    Default

    Are you using "run on server" in STS? Maybe I should try running from the command line.

  4. #4
    Join Date
    Mar 2011
    Posts
    2

    Default

    The steps I follow.

    1. Create an empty folder for my project.
    2. Copy my <code>myScript.roo</code> file to this folder
    3. From within project folder call Roo, execute <code>script myScript.roo</code>
    4. Run STS and Import Maven Project

    From now on, I stay in STS.

    5. Correct .aj code
    6. Change preferences Google-->GAE-->ORM-->Path
    . Delete resources folder
    . Add detail and filter to src/main/ and /src/test path. (shared/**/*.java)
    7. Compile with GWT button in STS interface
    8. Run as Web App

    (Y)

    Must work.

  5. #5

    Default

    Thanks for the details. I'll try again tonight.

  6. #6
    Join Date
    Sep 2010
    Posts
    3

    Default

    I created a bug in Jira for this problem: https://jira.springsource.org/browse/ROO-2208

  7. #7
    Join Date
    Dec 2005
    Posts
    929

    Default

    ROO-2208 is fixed now.

    Alan
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •