[appengine-java] Re: Relationships
I really recommend you read the documentation: http://code.google.com/appengine/docs/java/datastore/overview.html You are trying to do things the datastore does not allow. It's so different that a relational datastore, I think you'll find you're constantly roadblocked if you don't become familiar with it. On Aug 26, 5:42 am, midomarocain elattar...@gmail.com wrote: i use three class User , Type ,and Article : @PersistenceCapable(identityType = IdentityType.APPLICATION) public class User { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key id; @Persistent private String login; @Persistent private Type type; ... } @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Type { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; ... } @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Article { @PrimaryKey �...@persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; �...@persistent private User user; . } I use this method to save the article : public static Article save(Article article, Long userId) { Article result = null; PersistenceManager pm = PMF.get().getPersistenceManager(); try { // Getting the user by id Query query = pm.newQuery(User.class, id == idParam); query.declareParameters(Long idParam); ListUser users = (ListUser) query.execute(userId); User user = null; if (!users.isEmpty()) { user = users.get(0); } article.setUser(user); result = pm.makePersistent(article); } finally { pm.close(); } return result; } the exception : javax.jdo.JDOFatalUserException: Detected attempt to establish Article (16) as the parent of User(14) but the entity identified by User(14) has already been persisted without a parent. A parent cannot be established or changed once an object has been persisted. at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException (NucleusJDOHelper.java:354) at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent (JDOPersistenceManager.java:674) at org.datanucleus.jdo.JDOPersistenceManager.makePersistent (JDOPersistenceManager.java:694) .. thanks in advance On 25 août, 17:14, objectuser kevin.k.le...@gmail.com wrote: Can you tell us what the error is? And maybe some snippits of code showing the relevant parts of your model and how it's mapped? On Aug 25, 8:08 am, midomarocain elattar...@gmail.com wrote: I have a relation between a User and Article (1) User can have one or many article (2) an article is owned by only one user i'am intersted only by the relation (2) the User is persisted I create a new Article and i want relie it with an existant User But i have a probleme when trying to persist the article object my code is like article.setUser(user); pm.makePersistent(article); can any one help me please --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Service logic conflicts with transaction policy for entity groups
Hello. I'm trying to create a service method that encapsulates a particular business logic. I want to make this feature transactional such that its job is accomplished atomically(?). The problem is the service logic involves accessing different entities that do not belong to the same entity group which is not allowed in GAE. At the moment, I've temporarily disabled transaction management to the service method. However, I feel I'd need to manage transactions eventually. I'm thinking of revising the model design but from how I see it, the model classes are good as they are--unrelated by ownership. Btw, within the service logic is some methods that are transactional. I'm using Spring framework to annotate transaction management. Can anyone help me on how I can go about this? Thanks. --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Service logic conflicts with transaction policy for entity groups
Hey, Vince, That's really cool. Does that address the need of the OP though? I may just not be understanding it fully ... Thanks! On Aug 26, 11:15 am, Vince Bonfanti vbonfa...@gmail.com wrote: I've implemented a set of distributed locks for GAE that I posted a message about previously (especially note the current limitations of reliability of shared/read locks): http://groups.google.com/group/google-appengine-java/browse_thread/th... Here's a direct link to the source code: http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlant... Since posting that message, I've done some timings on memcache calls and found that they usually take about 15ms; I've seen low times around 6-7ms and high times as much as 60ms. The ExclusiveLock is the most efficient, since it takes only one memcache call to acquire and one to release. If you use the ReadWriteLock class, it takes two memcache calls to acquire a write lock, and three memcache calls to acquire a read lock (it only takes one memcache call to release either a write or read lock). So, while using ReadWriteLock allows the greatest concurrency in your application, unless the read operations take longer than 45ms on average, you might be better off using ExclusiveLocks. Let me know if you find this useful. Vince On Wed, Aug 26, 2009 at 10:31 AM, randalrdgo...@gmail.com wrote: Hello. I'm trying to create a service method that encapsulates a particular business logic. I want to make this feature transactional such that its job is accomplished atomically(?). The problem is the service logic involves accessing different entities that do not belong to the same entity group which is not allowed in GAE. At the moment, I've temporarily disabled transaction management to the service method. However, I feel I'd need to manage transactions eventually. I'm thinking of revising the model design but from how I see it, the model classes are good as they are--unrelated by ownership. Btw, within the service logic is some methods that are transactional. I'm using Spring framework to annotate transaction management. Can anyone help me on how I can go about this? Thanks. --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Service logic conflicts with transaction policy for entity groups
I thought it did, but I may not have fully understood the question. Using distributed locks would allow him to implement atomicity (synchronization) of transactions in his application code without modifying his data model, something like this: exclusiveLock.lock(); try { // modify entity A // modify entity B } finally { exclusiveLock.unlock(); } Assuming that entities A and B are in different entity groups, and therefore he can't use the built-in transaction support provided by the datastore. Vince On Wed, Aug 26, 2009 at 12:44 PM, objectuserkevin.k.le...@gmail.com wrote: Hey, Vince, That's really cool. Does that address the need of the OP though? I may just not be understanding it fully ... Thanks! --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Unable to persist an object in GAE
However, the object is not able to persist. Define not able to persist. You quote no exception. You quote no datastore info. The log says that the object persists. The object moves into the correct lifecycle state for a persisted object. There is no error. --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Service logic conflicts with transaction policy for entity groups
I see what you're saying ... you're addressing the integrity issues around concurrent modifications. As is, what if someone makes an inconsistent modification to A while I'm trying to update B ... I was thinking of it in terms of, what if modify entity A works and modify entity B fails. Good stuff! On Aug 26, 11:51 am, Vince Bonfanti vbonfa...@gmail.com wrote: I thought it did, but I may not have fully understood the question. Using distributed locks would allow him to implement atomicity (synchronization) of transactions in his application code without modifying his data model, something like this: exclusiveLock.lock(); try { // modify entity A // modify entity B } finally { exclusiveLock.unlock(); } Assuming that entities A and B are in different entity groups, and therefore he can't use the built-in transaction support provided by the datastore. Vince On Wed, Aug 26, 2009 at 12:44 PM, objectuserkevin.k.le...@gmail.com wrote: Hey, Vince, That's really cool. Does that address the need of the OP though? I may just not be understanding it fully ... Thanks! --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Unable to persist an object in GAE
Hi, I am writing a simple app in GAE to persist some objects in the GAE datastore. I am using JDO. However, the object is not able to persist. I am currently running the program in the eclipse plugin. Please see below for the code snippet and the logs: public String addAccount(UserAccount account) throws ServiceException { xLogger.fine(Entering addAccount); boolean userExists = false; //Assuming that all other fields including registeredBy is set by the calling function //TODO: Encrypt the password before storing to the database //Set the memberSince and lastLogin timestamp to now Date now = new Date(); account.setTimeStamp(now); account.setMemberSince(now); String accountId = account.getUserId(); xLogger.info(addAccount: userId is {0}, accountId); PersistenceManager pm = PMF.get().getPersistenceManager(); //We use an atomic transaction here to check if the user already exists, and if not, create it Transaction tx = pm.currentTransaction(); try { tx.begin(); try { //First check if the user already exists in the database @SuppressWarnings(unused) UserAccount user = pm.getObjectById(UserAccount.class, accountId); //If we get here, it means the user exists xLogger.warn(addAccount: FAILED!! user {0} already exists, accountId); userExists = true; } catch (JDOObjectNotFoundException e) { xLogger.fine(addAccount: User {0} does not exist. Adding user to database, accountId); pm.makePersistent(account); } tx.commit(); } finally { if (tx.isActive()) { xLogger.warn(addAccount: Rolling back transaction); tx.rollback(); } pm.close(); if (userExists == true) { throw new ServiceException(User already exists); } xLogger.fine(Exiting addAccount); return accountId; } } Aug 26, 2009 5:21:12 PM org.lggi.samaanguru.utils.XLog log FINE: Entering addAccount Aug 26, 2009 5:21:12 PM org.lggi.samaanguru.utils.XLog log INFO: addAccount: userId is user1 Aug 26, 2009 5:21:12 PM org.datanucleus.state.LifeCycleState changeState FINE: Object org.lggi.samaanguru.entity.useracco...@30a6d6 (id=org.lggi.samaanguru.entity.UserAccount:user1) has a lifecycle change : HOLLOW-P_CLEAN Aug 26, 2009 5:21:12 PM org.datanucleus.ConnectionManagerImpl allocateConnection FINE: Connection added to the pool : org.datanucleus.store.appengine.DatastoreConnectionFactoryImpl $datastoremanagedconnect...@163d844 Aug 26, 2009 5:21:12 PM org.datanucleus.ConnectionManagerImpl allocateConnection FINE: Connection found in the pool : org.datanucleus.store.appengine.DatastoreConnectionFactoryImpl $datastoremanagedconnect...@163d844 Aug 26, 2009 5:21:12 PM org.lggi.samaanguru.utils.XLog log FINE: addAccount: User user1 does not exist. Adding user to database Aug 26, 2009 5:21:12 PM org.datanucleus.ConnectionManagerImpl allocateConnection FINE: Connection found in the pool : org.datanucleus.store.appengine.DatastoreConnectionFactoryImpl $datastoremanagedconnect...@163d844 Aug 26, 2009 5:21:12 PM org.datanucleus.ObjectManagerImpl performReachabilityAtCommit FINE: Performing check of objects for persistence-by- reachability (commit) ... Aug 26, 2009 5:21:12 PM org.datanucleus.ObjectManagerImpl performReachabilityAtCommit FINE: Performing reachability algorithm on object with id user1 Aug 26, 2009 5:21:12 PM org.datanucleus.state.JDOStateManagerImpl runReachability FINE: Object org.lggi.samaanguru.entity.useracco...@b5a19 (id=user1) lifecycle state P_NEW added to the list of reachables on commit. Aug 26, 2009 5:21:12 PM org.datanucleus.store.fieldmanager.ReachabilityFieldManager storeObjectField FINE: Performing reachability on field org.lggi.samaanguru.entity.UserAccount.kiosks which is null Aug 26, 2009 5:21:12 PM org.datanucleus.store.fieldmanager.ReachabilityFieldManager storeObjectField FINE: Performing reachability on field org.lggi.samaanguru.entity.UserAccount.gender which is null Aug 26, 2009 5:21:12 PM org.datanucleus.store.fieldmanager.ReachabilityFieldManager storeObjectField FINE: Performing reachability on field org.lggi.samaanguru.entity.UserAccount.birthdate which is null Aug 26, 2009 5:21:12 PM org.datanucleus.store.fieldmanager.ReachabilityFieldManager
[appengine-java] Re: Unable to persist an object in GAE
After persisting the object, I try to get the object and it fails. try { xLogger.fine(Authenticating user 1); AccountsServiceImpl as = Services.get().getService( AccountsServiceImpl.class); as.authenticateUser(user1, user1); xLogger.fine(user authenticated successfully); return true; } catch (ServiceException e) { e.printStackTrace(); return false; } I get a JSOObjectNotFoundException when I run this On Aug 26, 10:35 pm, datanucleus andy_jeffer...@yahoo.com wrote: However, the object is not able to persist. Define not able to persist. You quote no exception. You quote no datastore info. The log says that the object persists. The object moves into the correct lifecycle state for a persisted object. There is no error. --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Service logic conflicts with transaction policy for entity groups
Yes, that's what I meant (I should have given a fuller answer the first time). Any error checking and rollback to undo modify entity A in case of failure of modify Entity B would have to be coded manually within the lock/unlock block. Vince On Wed, Aug 26, 2009 at 1:09 PM, objectuserkevin.k.le...@gmail.com wrote: I see what you're saying ... you're addressing the integrity issues around concurrent modifications. As is, what if someone makes an inconsistent modification to A while I'm trying to update B ... I was thinking of it in terms of, what if modify entity A works and modify entity B fails. Good stuff! On Aug 26, 11:51 am, Vince Bonfanti vbonfa...@gmail.com wrote: I thought it did, but I may not have fully understood the question. Using distributed locks would allow him to implement atomicity (synchronization) of transactions in his application code without modifying his data model, something like this: exclusiveLock.lock(); try { // modify entity A // modify entity B } finally { exclusiveLock.unlock(); } Assuming that entities A and B are in different entity groups, and therefore he can't use the built-in transaction support provided by the datastore. Vince On Wed, Aug 26, 2009 at 12:44 PM, objectuserkevin.k.le...@gmail.com wrote: Hey, Vince, That's really cool. Does that address the need of the OP though? I may just not be understanding it fully ... Thanks! --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Unable to persist an object in GAE
I should be more explicit. I make a call to the following code and get the logs below: public boolean authenticateUser(String userId, String encPassword) throws ServiceException { xLogger.fine(Entering authenticateUser); PersistenceManager pm = PMF.get().getPersistenceManager(); //We use an atomic transaction here to check if the user exists and then update it try { //First check if the user already exists in the database UserAccount user = pm.getObjectById(UserAccount.class, userId); xLogger.info(authenticateUser: Authenticating user {0}, userId); //If we get here, it means the user exists //If the user account is disabled, then always fail authentication if (!user.isEnabled()) { xLogger.warn(authenciateUser: FAILED!! User {0} is disabled, userId); throw new ServiceException(User is disabled); } //TODO: Encode password if (encPassword == user.getEncodedPassword()) { user.setTimeStamp(new Date()); pm.close(); xLogger.fine(Exiting authenticateUser); xLogger.info(authenticateUser: User authenticated successfully); return true; } } catch (JDOObjectNotFoundException e) { xLogger.warn(authenciateUser: FAILED!! User {0} does not exist, userId); throw new ServiceException(User does not exist); } xLogger.fine(Exiting authenticateUser); xLogger.warn(authenticateUser: FAILED!! Incorrect password for user {0}, userId); throw new ServiceException(Incorrect password); } FINE: Entering authenticateUser Aug 26, 2009 6:01:07 PM org.datanucleus.state.LifeCycleState changeState FINE: Object org.lggi.samaanguru.entity.useracco...@5d5f30 (id=org.lggi.samaanguru.entity.UserAccount:user1) has a lifecycle change : HOLLOW-P_NONTRANS Aug 26, 2009 6:01:07 PM org.datanucleus.ConnectionManagerImpl allocateConnection FINE: Connection added to the pool : org.datanucleus.store.appengine.DatastoreConnectionFactoryImpl $datastoremanagedconnect...@1be8bba Aug 26, 2009 6:01:07 PM org.datanucleus.ConnectionManagerImpl allocateConnection FINE: Connection found in the pool : org.datanucleus.store.appengine.DatastoreConnectionFactoryImpl $datastoremanagedconnect...@1be8bba Aug 26, 2009 6:01:07 PM org.lggi.samaanguru.utils.XLog log WARNING: authenciateUser: FAILED!! User user1 does not exist On Aug 26, 10:50 pm, swprog juheeg...@gmail.com wrote: After persisting the object, I try to get the object and it fails. try { xLogger.fine(Authenticating user 1); AccountsServiceImpl as = Services.get().getService( AccountsServiceImpl.class); as.authenticateUser(user1, user1); xLogger.fine(user authenticated successfully); return true; } catch (ServiceException e) { e.printStackTrace(); return false; } I get a JSOObjectNotFoundException when I run this On Aug 26, 10:35 pm, datanucleus andy_jeffer...@yahoo.com wrote: However, the object is not able to persist. Define not able to persist. You quote no exception. You quote no datastore info. The log says that the object persists. The object moves into the correct lifecycle state for a persisted object. There is no error.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Compile and execute at runtime
Hey Toby: Did as you instructed and worked. Thanks a lot Toby. Let me know should you need anything. I'm glad to help. Another question about Janino: I'm getting the following exception on the live app-engine when the dynamic code (the code that is compiled by janino) has a compilation error: An error occurred: java.security.AccessControlException: access denied (java.lang.RuntimePermissions accessDeclaredMembers) On the local environment, janino returns the line number where the error occurred, which is very helpful for the students. Cheers, Albert Attard Samuel Goldwynhttp://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html - I'm willing to admit that I may not always be right, but I am never wrong. 2009/8/26 Toby Reyelts to...@google.com Hey Albert, Even though I haven't actually seen the changes that you made, I believe they were unnecessary. (Go out on a limb with me here). I tracked the fault down to an error in our runtime that can be worked around by just recompiling the code. You should be able to confirm this on your end by recompiling Janino from source *without* any of the changes you made. Please make sure you've set the target version to 1.5 or 1.6. On Wed, Aug 26, 2009 at 4:51 AM, Albert Attard albertatt...@gmail.comwrote: Hey Toby: Janino api include classes that are not supported by the app-engine. All I did is commented out the code that the app-engine didn't like in janino and repackaged it. I did the following: - Downloaded the source for janino: http://www.janino.net/download/janino-2.5.15.zip - I've created a new Google Web Project in Eclipse - I've copied the source into the Google Web Project - Than I've *unsafely* commented out code that was not supported by the Google app-engine - Repackaged the edited code into a new jar and deployed it with my project instead of the original one - The simple proof of concept seams to work As you can see at the simple demo: http://ask-me.appspot.com/ the code seams to work. Hope you manage to complete this question :) Cheers, Albert Attard Stephen Leacockhttp://www.brainyquote.com/quotes/authors/s/stephen_leacock.html - I detest life-insurance agents: they always argue that I shall some day die, which is not so. 2009/8/25 Toby Reyelts to...@google.com Hey Albert, That code should actually work ok, but you've managed to tickle a bug in our runtime. I've filed an issuehttp://code.google.com/p/googleappengine/issues/detail?id=2028for you here. The fix for this probably won't make the next release, but it should come shortly thereafter. On Tue, Aug 25, 2009 at 6:33 AM, Albert Attard albertatt...@gmail.comwrote: Hi Toby: Thanks for you feedback. I've did a small prototype: http://ask-me.appspot.com/ . It's working fine locally, but it's throwing the following exception when executed on the app-engine: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.albertattard.askme.client.utils.AssessmentTO com.albertattard.askme.client.AssessorService.assessCode(java.lang.String)' threw an unexpected exception: java.lang.VerifyError: (class: org/codehaus/janino/ByteArrayClassLoader, method: findClass signature: (Ljava/lang/String;)Ljava/lang/Class;) Illegal type in constant pool at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:713) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:237) at
[appengine-java] javax.servlet.Filter question
Hi, According to the following document http://code.google.com/appengine/docs/java/config/webxml.html#Filters the method signature for doFilter is public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) should it be public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) Thanks. Iqbal Yusuf Dipu --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: java.rmi.server.UID Error
Thanks! I just added it here: http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine - Jason On Tue, Aug 25, 2009 at 5:14 AM, Icarus pr.a...@gmail.com wrote: Hi Jason, Sorry about the delay... I didn't get a mail regarding response to this thread. The fix I made was : 1. Within the Jena distribution, cd to src/com/hp/hpl/jena/rdf/model, modify the constructor so that it does not use the offending rmi UID generator public AnonId() { if (JenaParameters.disableBNodeUIDGeneration) { synchronized (AnonId.class) { id = A + idCount++; // + rand.nextLong(); } } else { id = java.util.UUID.randomUUID().toString(); } } You would need to import java.util.UUID for this. There is another change as well ( attributed to Taylor Cowan)... both of these can be found on the link here : http://tech.groups.yahoo.com/group/jena-dev/message/39575 -Ic On Aug 12, 5:19 am, Jason (Google) apija...@google.com wrote: Can you detail the fix? I'd love to add your pointer(s) to the Will it play in App Engine wiki page: http://groups.google.com/group/google-appengine-java/web/will-it-play... - Jason On Mon, Aug 10, 2009 at 3:16 PM, Icarus pr.a...@gmail.com wrote: The issue was with the Jena Framework source code and fixing that made it possible to run the app. On Aug 11, 2:21 am, Icarus pr.a...@gmail.com wrote: Hi, While using the Jena Semantic Framework for extracting RDF based data, I come across the following error on GAE : Uncaught exception from servlet java.lang.NoClassDefFoundError: java.rmi.server.UID is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.apphosting.runtime.security.shared.stub.java.rmi.server.UID.clinit (UID.java) at com.hp.hpl.jena.rdf.model.AnonId.init(AnonId.java:78) at com.hp.hpl.jena.rdf.model.AnonId.create(AnonId.java:60) at com.hp.hpl.jena.graph.Node.createAnon(Node.java:45) at com.hp.hpl.jena.rdf.arp.JenaReader.convert(JenaReader.java: 116) at com.hp.hpl.jena.rdf.arp.JenaReader.convert(JenaReader.java: 128) at com.hp.hpl.jena.rdf.arp.JenaHandler.statement (JenaHandler.java:73) at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.triple (XMLHandler.java: 100) at com.hp.hpl.jena.rdf.arp.impl.ParserSupport.triple (ParserSupport.java:240) at com.hp.hpl.jena.rdf.arp.states.WantPropertyElement.aPredAndObj (WantPropertyElement.java:187) at com.hp.hpl.jena.rdf.arp.states.Frame.processPropertyAttributes (Frame.java:112) at com.hp.hpl.jena.rdf.arp.states.WantPropertyElement.startElement (WantPropertyElement.java:116) at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.startElement (XMLHandler.java:137) at org.apache.xerces.parsers.AbstractSAXParser.startElement (Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement (Unknown Source) at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement (Unknown Source) at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement (Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement (Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl $FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument (Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse (RDFXMLParser.java: 107) at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:158) at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:145) at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:215) at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java: 188) This runs in dev mode on my local machine but gives problem from the deployment on GAE server. Any suggestions would be highly appreciated. -Ic --~--~-~--~~~---~--~~ 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-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at
[appengine-java] Re: Tutorial Java em Português
Most of the App Engine documentation should be available in Portuguese. Here is the Getting Started Guide: http://code.google.com/intl/pt-BR/appengine/docs/java/gettingstarted/ - Jason 2009/8/25 Almir F. Rivas Jr rivasal...@gmail.com Pessoal, Alguém pode me ajudar indicando um tutorial onde mostre como trabalhar com o Google App Engine usando Java em português. Atenciosamente, Almir F. Rivas Jr Sincro Tecnologia (34) 9944-5791 --~--~-~--~~~---~--~~ 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-java@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 -~--~~~~--~~--~--~---
[appengine-java] Re: Datanucleus fails when commiting non-existing transaction
I can not reproduce the problem in simple code. By the way the full- size code also works, when uploaded. Anyway it consistently fails on the development server - in one and the same way. If the above log does not say enough, I will have to investigate more. On Aug 27, 6:49 am, Jason (Google) apija...@google.com wrote: If I'm reading your logs correctly, you should be able to add both entities since you're supposedly not operating inside of a transaction. Can you post your full test code? - Jason On Tue, Aug 25, 2009 at 3:50 AM, eddyd dimitrov...@gmail.com wrote: This happens on the development server, using JPA. In the request there are: 1. transaction.begin; run query; transaction.commit; log (transaction.isActive) 2. (w/o transaction) delete entry; log(transaction.isActive) 3. (w/o transaction) add entry; log(transaction.isActive) 4. (w/o transaction) add entry; log(transaction.isActive) 5. log(transaction.isActive); close connection (i.e. close entityManager) And close connection fails, because it tries to commit a transaction, which fails because there are two entities in different entity groups - see the messages bellow. And at any point the logs show transaction.isActive::false. My question - why at close connection does it try to commit, if there is no active transaction?? == Aug 25, 2009 9:56:50 AM com.mound.flexiview.fvstory.StoryEntryRepositoryJPA list Entries INFO: story::listEntries::transaction.isActive::false Aug 25, 2009 9:56:50 AM com.mound.flexiview.fvstory.StoryEntryRepositoryJPA dele teEntries INFO: story::deleteEntries::transaction.isActive::false Aug 25, 2009 9:56:50 AM com.mound.flexiview.fvstory.StoryEntryRepositoryJPA addE ntry INFO: story::addEntry::transaction.isActive::false Aug 25, 2009 9:56:50 AM com.mound.flexiview.fvstory.StoryEntryRepositoryJPA addE ntry INFO: story::addEntry::transaction.isActive::false Aug 25, 2009 9:56:50 AM com.mound.flexiview.db.DBManagerJPA closeConnection INFO: closeConnection::transaction.isActive::false Aug 25, 2009 9:56:50 AM com.mound.flexiview.db.DBManagerJPA closeConnection WARNING: closeConnection failed (close):: javax.persistence.PersistenceException: Illegal argument at org.datanucleus.jpa.NucleusJPAHelper.getJPAExceptionForJDOException(N ucleusJPAHelper.java:214) at org.datanucleus.jpa.EntityManagerImpl.close (EntityManagerImpl.java:15 7) at org.datanucleus.store.appengine.jpa.DatastoreEntityManager.close(Data storeEntityManager.java:54) at com.mound.flexiview.db.DBManagerJPA.closeConnection(Unknown Source) at com.mound.flexiview.db.DBPhaseListener.afterPhase(Unknown Source) at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java: 179) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:103) ... Caused by: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both com.google.appengine.api.datastore.de v.localdatastoreservice$profile$entitygr...@1bd427 and com.google.appengine.api. datastore.dev.localdatastoreservice$profile$entitygr...@1054f93 at com.google.appengine.api.datastore.DatastoreApiHelper.translateError( DatastoreApiHelper.java:29) at com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(Da tastoreApiHelper.java:56) at com.google.appengine.api.datastore.DatastoreServiceImpl $2.run(Datasto reServiceImpl.java:169) at com.google.appengine.api.datastore.TransactionRunner.runInTransaction (TransactionRunner.java:30) at com.google.appengine.api.datastore.DatastoreServiceImpl.put (Datastore ServiceImpl.java:157) at com.google.appengine.api.datastore.DatastoreServiceImpl.put (Datastore ServiceImpl.java:137) at com.google.appengine.api.datastore.DatastoreServiceImpl.put (Datastore ServiceImpl.java:133) at org.datanucleus.store.appengine.RuntimeExceptionWrappingDatastoreServ ice.put(RuntimeExceptionWrappingDatastoreService.java:104) at org.datanucleus.store.appengine.DatastorePersistenceHandler.put(Datas torePersistenceHandler.java:125) at org.datanucleus.store.appengine.DatastorePersistenceHandler.put(Datas torePersistenceHandler.java:94) at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObj ect(DatastorePersistenceHandler.java:195) at org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOS tateManagerImpl.java:3185) at org.datanucleus.state.JDOStateManagerImpl.flush (JDOStateManagerImpl.j ava:4513) at org.datanucleus.ObjectManagerImpl.flushInternal (ObjectManagerImpl.jav a:2814) at org.datanucleus.ObjectManagerImpl.flush (ObjectManagerImpl.java:2754) at org.datanucleus.ObjectManagerImpl.preCommit