[appengine-java] Re: makePersistent failing every second time since server restart
Hi John, You just need to read the entity group references above and it will be clearer. Appengine is a distributed datastore in which the files and entities within are not necessarily co-located. If you need to retrieve more than one type of entity within a transaction, those entities need to have relationships that you have defined using structure within appengine. Without those relationships you have this: create entity Sale (it lives in filesystem 1234567) create entity RegularUser (it lives in filesystem 231) Create a new entity with those. The new entity lives in filesystem 123. If you have not created the implicit indexes by using cross group transactions, nor have you created entity groups by giving the entities a common ancestor, the entity manager will not have the information it needs to locate all of the fields... There's more to it than that, but that is the simplest way to explain it. Cheers, Nichole On Feb 2, 4:19 am, John Goche johngoch...@googlemail.com wrote: NIchole, Thank you for your feedback, but how do I change my code so that I have this entity group you are mentioning? I am using the HR datastore. And how did you get to this conclusion? I am fetching every store from the datastore, detaching everything after making it persistent, and always touching fields before accessing them, so why are things not working out? @PersistenceCapable(detachable=true) class ZZZStore { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private AdminUser admin; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=email asc)) private ListRegularUser users; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=itemCode asc)) private ListItem inventory; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=receiveDate asc, receiptID asc)) private ListReceipt receipts; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=saleID asc)) private ListSale sales; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=shipDate asc)) private ListShipment shipments; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) //@Order(extensions = @Extension(vendorName=datanucleus, key=list-ordering, value=cusID asc)) private ListCustomer customers; //@Persistent(defaultFetchGroup = true) @Persistent @Element(dependent = true) private Company company; } @PersistenceCapable class Sale { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private long saleID; @Persistent private Date saleDate; @Persistent private String cusID; @Persistent private String repID; @Persistent //@Persistent(defaultFetchGroup = true) private ListSaleItem saleItems; } static void persistStore() { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(Data.store); tx.commit(); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } } On Thu, Feb 2, 2012 at 11:01 AM, Nichole nichole.k...@gmail.com wrote: you need an entity group http://code.google.com/appengine/docs/java/datastore/jdo/relationship... or cross group transactions if you are using the HR datastore: http://code.google.com/appengine/docs/python/datastore/transactions.html or If you are not on the HR datastore and need2-phaselocking transactions: http://groups.google.com/group/google-appengine-java/browse_thread/th... On Feb 1, 10:25 am, John Goche johngoch...@googlemail.com wrote: Hi, I've raised the issue with a test case in google's issue tracker: http://code.google.com/p/datanucleus-appengine/issues/detail?id=259 I am hoping someone can kindly have a look at it and get back to me as I cannot see how I can make use of JDO on app engine without this fixed. In the meantime any suggestions on how to work around the problem would be greatly appreciated. Kind Regards, John Goche On Wed, Feb 1, 2012 at 9:21 AM, datanucleus andy_jeffer...@yahoo.com wrote: So it can't find a related Entity. You could obviously use the DB viewer (or a low level API call) to check whether it is present
[appengine-java] Re: Cannot retrieve filename with Complicated Chinese charaters in GAE
I just looked at appengine System properties (System.getProperty('file.encoding'). The file system encoding is set to ANSI_X3.4-1968. You might tinker with trying to change that? On Feb 6, 10:51 pm, Tony Yang tonyyan...@gmail.com wrote: Dear Sir, Thanks a lot but the problem is still there. Attached more description below. 1. input some files into directory /war/images/ , they're are file names of img01.jpg, img02.jpg ...中文img.jpg 2. Assign file directory in JSP file by code below. File myFile = new File(images/); String[] strFiles = myFile.list(); 3. Print file name in the assigned directory by JSP code below for(int i=0 ; i strFiles.length ; i++){ file_name = strFiles[i].toString(); out.println(file_name); } 4. The file name with traditional Chinese characters(中文) cannot be printed out but others are ok for printing. 5. The mentioned problem only happened after deploying in GAE cloud but didn't happen in local Eclipse development environment. Please help and thanks again. On Mon, Feb 6, 2012 at 5:05 PM, Nichole nichole.k...@gmail.com wrote: With GFS you should be able to use any character in the name of a file or directory except the null character, so you just need to form your string using the right encoding. String fileName = new String(str, UTF-8); or use Big5 for encoding? And then make sure the jsp prints the character correctly by including the encoding in one of several ways. Here's one way: %@ page language=java contentType=text/html; UTF-8 pageEncoding=UTF-8 isELIgnored=false % On Feb 3, 7:44 pm, Tony Yang tonyyan...@gmail.com wrote: Dear Sir, Would you help me the problem below. Environment : Java and JSP Action : retrieve filename from file with Complicated Chinese characters. Sample file : A1-中文.jpg Response : 1. OK for local Eclipse developing platform, the name of 中文 can be retrieved. 2. After deploying in GAE cloud, system sound having problem and skip this file and no response. Written code in JSP file : -- path_string = objFiles[i].toString(); index1 = path_string.lastIndexOf('-')+1; index2 = path_string.indexOf('.'); file_name = path_string.substring(index1, index2) %= file_name% - ---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. -- 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: Cannot retrieve filename with Complicated Chinese charaters in GAE
With GFS you should be able to use any character in the name of a file or directory except the null character, so you just need to form your string using the right encoding. String fileName = new String(str, UTF-8); or use Big5 for encoding? And then make sure the jsp prints the character correctly by including the encoding in one of several ways. Here's one way: %@ page language=java contentType=text/html; UTF-8 pageEncoding=UTF-8 isELIgnored=false % On Feb 3, 7:44 pm, Tony Yang tonyyan...@gmail.com wrote: Dear Sir, Would you help me the problem below. Environment : Java and JSP Action : retrieve filename from file with Complicated Chinese characters. Sample file : A1-中文.jpg Response : 1. OK for local Eclipse developing platform, the name of 中文 can be retrieved. 2. After deploying in GAE cloud, system sound having problem and skip this file and no response. Written code in JSP file : -- path_string = objFiles[i].toString(); index1 = path_string.lastIndexOf('-')+1; index2 = path_string.indexOf('.'); file_name = path_string.substring(index1, index2) %= file_name% - ---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: Unexplained error of SQLException
Looks like you are trying to upload binaries compiled w/ a jdk version not compatible w/ 5 or 6. On Feb 2, 9:06 pm, Arjun Damodar lutt...@gmail.com wrote: Hello, I was trying to compile an application but getting the following error: javax.servlet.ServletException: java.sql.SQLException: Access denied for user 'lutt...@gmail.com'@'localhost' (using password: YES) The worst part is I haven't imported java.sql.* as this is not using cloud SQL. But I have another project using cloud sql on my eclipse. This is getting compiled and also getting deployed perfectly. I've attached a copy of the log below from local system (Appspot logs below that) Logs from eclipse: 3 Feb, 2012 4:58:36 AM com.google.apphosting.utils.jetty.JettyLogger info INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger 3 Feb, 2012 4:58:36 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml INFO: Successfully processed C:\Users\Arjun\workspace\Luttapy\war\WEB-INF/appengine-web.xml 3 Feb, 2012 4:58:36 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml INFO: Successfully processed C:\Users\Arjun\workspace\Luttapy\war\WEB-INF/web.xml 3 Feb, 2012 4:58:37 AM com.google.apphosting.utils.jetty.JettyLogger warn WARNING: failed CreateNewTodo: java.lang.UnsupportedClassVersionError: luttapy/ServletCreateTodo : Unsupported major.minor version 51.0 3 Feb, 2012 4:58:37 AM com.google.apphosting.utils.jetty.JettyLogger warn WARNING: failed RemoveTodo: java.lang.UnsupportedClassVersionError: luttapy/ServletRemoveTodo : Unsupported major.minor version 51.0 3 Feb, 2012 4:58:37 AM com.google.apphosting.utils.jetty.JettyLogger warn WARNING: Failed startup of context com.google.appengine.tools.development.DevAppEngineWebAppContext@5e2c17f7{/ , C:\Users\Arjun\workspace\Luttapy\war} org.mortbay.util.MultiException[java.lang.UnsupportedClassVersionError: luttapy/ServletCreateTodo : Unsupported major.minor version 51.0, java.lang.UnsupportedClassVersionError: luttapy/ServletRemoveTodo : Unsupported major.minor version 51.0] at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:656 ) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250 ) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.appengine.tools.development.JettyContainerService.startContainer ( JettyContainerService.java:191) at com.google.appengine.tools.development.AbstractContainerService.startup(Abs t ractContainerService.java:239) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerI m pl.java:146) at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(D e vAppServerMain.java:164) at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48 ) at com.google.appengine.tools.development.DevAppServerMain.init(DevAppServer M ain.java:113) at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMa i n.java:89) java.lang.UnsupportedClassVersionError: luttapy/ServletCreateTodo : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(Iso l atedAppClassLoader.java:176) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at org.mortbay.util.Loader.loadClass(Loader.java:91) at org.mortbay.util.Loader.loadClass(Loader.java:71) at
[appengine-java] Re: Sending HTTP response header Connection: close for request with Connection: keep-alive
you'll want to use the HttpServletResponse close() method. On Feb 1, 9:18 pm, Jeff Morgan j...@lacodatech.com wrote: Is there a way to force GAE to send an HTTP response with header Connection: close? I have tried, response.setHeader(Connection,close); but no luck. -- 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: map-reduce
Do you have a security-constraint in your web.xml that specifies 'role- name' as '*' or admin for the url-pattern of the servlet you used? It looks like the invoker was not yet authenticated or failed authentication. On Feb 1, 5:59 am, Sergio ksergio...@gmail.com wrote: Hi All! I catch the following exception when trying to launch map-reduce job in maven project: AccessControlException: access denied (javax.security.auth.AuthPermission getSubject) at java.security.AccessControlContext.checkPermission(AccessControlContext.jav a: 355) at java.security.AccessController.checkPermission(AccessController.java: 567) at java.lang.SecurityManager.checkPermission(SecurityManager.java: 549) at com.google.apphosting.runtime.security.CustomSecurityManager.checkPermissio n(CustomSecurityManager.java: 56) at javax.security.auth.Subject.getSubject(Subject.java:288) at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInf ormation.java: 394) at org.apache.hadoop.mapreduce.JobContext.init(JobContext.java:80) at com.google.appengine.tools.mapreduce.AppEngineJobContext.init(AppEngineJo bContext.java: 132) at com.google.appengine.tools.mapreduce.AppEngineJobContext.init(AppEngineJo bContext.java: 124) at com.google.appengine.tools.mapreduce.MapReduceServlet.handleStart(MapReduce Servlet.java: 799) at com.google.appengine.tools.mapreduce.MapReduceServlet.handleStartJob(MapRed uceServlet.java: 423) at com.google.appengine.tools.mapreduce.MapReduceServlet.handleCommand(MapRedu ceServlet.java: 301) at com.google.appengine.tools.mapreduce.MapReduceServlet.doPost(MapReduceServl et.java: 238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) What can be the cause? -- 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: makePersistent failing every second time since server restart
you need an entity group http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html or cross group transactions if you are using the HR datastore: http://code.google.com/appengine/docs/python/datastore/transactions.html or If you are not on the HR datastore and need 2-phase locking transactions: http://groups.google.com/group/google-appengine-java/browse_thread/thread/497060c343e16052/18f8603e9ffe3db4?lnk=gstq=Good+point+++nichole#18f8603e9ffe3db4 On Feb 1, 10:25 am, John Goche johngoch...@googlemail.com wrote: Hi, I've raised the issue with a test case in google's issue tracker: http://code.google.com/p/datanucleus-appengine/issues/detail?id=259 I am hoping someone can kindly have a look at it and get back to me as I cannot see how I can make use of JDO on app engine without this fixed. In the meantime any suggestions on how to work around the problem would be greatly appreciated. Kind Regards, John Goche On Wed, Feb 1, 2012 at 9:21 AM, datanucleus andy_jeffer...@yahoo.com wrote: So it can't find a related Entity. You could obviously use the DB viewer (or a low level API call) to check whether it is present (with that Key), and look in the log for whether it was PUT. Can't speak for Google but I'm sure nobody has interest in private code, though I'm sure that it ought to be perfectly simple to generate a testcase something akin to the format used by DataNucleus http://www.datanucleus.org/project/problem_jdo_testcase.html if the issue is as clear as you say in terms of reproducing it. And then you can raise an issue in Googles issue tracker with the testcase; obviously without the testcase then nobody, other than you, can see it. -- 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 athttp://groups.google.com/group/google-appengine-java?hl=en. -- 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: BaseFeed versus DocumentListFeed
Looks like you are using paging... On Jan 31, 11:41 am, Paul Ford paul.f...@mavenwave.com wrote: ok guys could not find a google docs api group so posting this here. I'm trying to list out all documents within a domain companyabc.com. If I use DocumentListFeed I get a 100 docs. If I use the same exact code and use BaseFeed instead I get all docs 1080 returned. Why? I understand BaseFeed is an abstract of DocumentListFeed and have read the javadoc. But in plain english what is basefeed giving me that documentlistfeed does not? I thought that documentlistfeed may only be returning my 'google docs' and basefeed everything (i.e. pdfs, docx, etc;) but that is not the case. DocumentListFeed also is by authenticated user. I'm using the same request and access tokens and just changing the class type when the above results are seen. Thoughts? Your urgently paul -- 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: anyone know how to deal with: org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed
One uses flush() typically at the end of a sequence of operations where you need to ensure that your objects are synced with the datastore. I'll include a link at the bottom of this with more information. Your code uses multiple entities. If they aren't from the same ancestor entity (that is if they are not in the same entity group), then you can use the new ' Cross-Group Transactions' for at most 5 entity types not of the same group if you're using the HR datastore. http://code.google.com/appengine/docs/java/datastore/transactions.html http://www.datanucleus.org/javadocs/core/2.1/index.html?org/datanucleus/jdo/JDOPersistenceManager.html public void flush() This method flushes all dirty, new, and deleted instances to the datastore. It has no effect if a transaction is not active. If a datastore transaction is active, this method synchronizes the cache with the datastore and reports any exceptions. If an optimistic transaction is active, this method obtains a datastore connection and synchronizes the cache with the datastore using this connection. The connection obtained by this method is held until the end of the transaction. Specified by: flush in interface javax.jdo.PersistenceManager On Jan 29, 4:46 pm, John Goche johngoch...@googlemail.com wrote: On Mon, Jan 30, 2012 at 12:37 AM, Nichole nichole.k...@gmail.com wrote: Do you have fields within your persistable entities in Data.store which are persistable? Yes, all the fields within the persistable entities are also persistent. http://www.datanucleus.org/javadocs/core/2.1/org/datanucleus/store/ex... You can try pm.flush() and temporarily add catch (Throwable t) { t.printStackTrace() for more detail Thanks but where in my code am I supposed to call this pm.flush() call? Thanks, JG On Jan 28, 3:52 pm, John Goche johngoch...@googlemail.com wrote: Hello, If anyone knows how to deal with org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed any help would be greatly appreciated. Here is the code which is throwing the exception: static void persistStore() { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(Data.store); tx.commit(); } finally { if (tx.isActive()) tx.rollback(); pm.close(); } } I don't see anything wrong with the code. Any ideas? John Goche -- 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. -- 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: Support of Java Keystore Files for SSL Connections
You'll have a security, restricted class exception for javax.net.ssl. You can use ssl provided by appengine for appspot.com subdomains (the CA was Equifax last time I checked), but not your own certificate. http://code.google.com/appengine/kb/general.html#https On Jan 29, 3:18 pm, Doug doug...@gmail.com wrote: Hello All, Is there a way in GAE to access certificates that are stored in Java Keystore files and then have GAE use those certificates when making a connection to call a web service? I can do this outside of GAE by specifying the location of keystore file using 'System.setProperty(javax.net.ssl.keyStore,C:\\myKeys.jks);' and then specifying the keystore password using 'System.setProperty(javax.net.ssl.keyStorePassword,x);' I have been successful in calling other web services from GAE. I am just unsure how to tell GAE to use specific SSL certificates in making the connection. Thanks, Doug -- 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: Logging when using local unit testing
To simplify the problem, can you use your IDE purely as jdwp agent? For maven (which for multi-module projects w/ profiles, current netbeans and eclipse plugins can have difficulty resolving a class, but are well worth that trouble for everything they do do right :) I often use this: mvn -Dmaven.surefire.debug -Dtest=$unittest test which internally is using -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 - Xnoagent -Djava.compiler=NONE On Jan 28, 2:28 am, Simon Knott knott.si...@gmail.com wrote: When I get near a computer I'll see what settings I've got. I swear I see log output for my unit tests. Cheers, Simon -- 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: Mobile subdomain in app engine
You can use a single servlet filter instead of a servlet per destination jsp page. Keep in mind that if you choose to use a RequestDispatcher.forward the user's browser url remains the same which is what you probably want (no redirect is sent back to the browser, instead the request is internally routed to the jsp and that is returned to the user). If you use the .forward approach, you can return agent specific results to the user that may be beyond just window.width dependent, HD for example. But if you use that approach, you'll need to be careful about urls because you might mangle your SEO. Deeply linked urls should remain the same to a client. style sheets and javascript could be condensed and pre-embedded in your pages ahead of time to remove those as links, but image links would require a little work. There are several ways to use a single url for the image links which tend to be thwarted by IE7 or IE8 browsers (scalable graphics using SVG, for example). You could avoid image links by using data URIs, but again, IE browsers don't support that earlier than v 9. Get clever w/ image using sprites? (disadvantage only for mobile devices as they will be downloading more than they need). If your image links do not need to be part of the SEO, then you could use dynamically loaded images in your pages w/ ajax w/ a failover plan and then your page will not have a conflicting image url in it's indexed links. And for media which you would definitely want to be findable as part of your SEO such as videos or music, the filter approach would work fine to return device dependent response/stream from a request to the same url. If instead you choose to use the two pseudo-site pattern as in the first posts above: /site/ /site/mobile/ and redirect the user to the site or mobile landing page upon their first visit, then you can include a link rel=canonical in your main site to keep the SEO in good shape. (you just can't use your landing page that includes a redirect for advertising destinations.) On Oct 7, 7:56 am, WillSpecht willspe...@gmail.com wrote: I was looking for an easy way to do this once and make it work for the whole site. Now I realize I'm going to have to go into every servlet and have it choose which jsp to display. On Oct 6, 6:43 pm, WillSpecht willspe...@gmail.com wrote: My real problem is that I can't figgure out how to show war/mobile/ home.jsp when a user types in m.mydomain.com/home. On Oct 6, 5:55 pm, Nichole nichole.k...@gmail.com wrote: I should add that my simplified model above uses the given static examples without a redirect to a /site/mobile. By 'design for all viewports' I mean design to use floating right divs when possible... On Oct 6, 2:50 pm, Nichole nichole.k...@gmail.com wrote: I'm not using a pseudo-2-site model myself anymore as I recently simplified my structure. For SDK 1.5.2 I had errors upon submitting for deployment more than static 100 files, so keep that in mind. If SDK 1.5.5 increased the max of number of static files to be uploaded, or your files are within limit, next keep in mind that appengine implementation of javax.Servlet.Filters work upon dynamic content (filters are not applied to static content at this time). So if you need to sense the user agent on server-side using your library of preference, make sure that your welcome file is a jsp file in order for your browser agent filter to intercept up the request. If you are instead using a static html file that includes javascript to sense the viewport size (= document.width) and then redirect, you won't need to use a javax.servlet.Filter and can replace the welcome file with your index.html instead (caveat is that if you advertise, you won't be able to use that default url as it will now result in a redirect). Here's how it could work w/ welcome file index.html: If you had webapp directories: /site/ /site/mobile/ in appengine-web.xml use: public-root/site/public-root static-files include path=/site/favicon.ico / include path=/site/index.html / include path=/site/about.jsp / include path=/site/error.html / /static-files in web.xml use: error-page error-code404/error-code location/error.html/location /error-page welcome-file-list welcome-fileindex.html/welcome-file /welcome-file-list I'll leave the app version that uses an index.jsp welcome file and a browser agent filter up to you, but it should work similarly. On Oct 6, 7:10 am, WillSpecht willspe...@gmail.com wrote: Things will be slightly different on the mobile site. I have checked out jquery mobile and its how I want to write the mobile site. I think the layout of the two sites will be too different to do on one page. On Oct
[appengine-java] Re: Mobile subdomain in app engine
Correction on the servlet filter intercepting a request for media such as music or videos! They're static content so you won't be able to intercept w/ the servlet to return device dependent links. You'd have to have decide based on your content if this approach would result in the same SEO or a different one... for instance, if the media link requires javascript to learn what player will work in the browser and hence decide the format to send as a parameter in a get request, then no matter what site plan you use, this url link would be similarly represented. and if user is selecting content, then if you use a post to same url and parameters as data, no difference in resulting SEO for these 2 different site approaches... On Oct 8, 1:30 am, Nichole nichole.k...@gmail.com wrote: You can use a single servlet filter instead of a servlet per destination jsp page. Keep in mind that if you choose to use a RequestDispatcher.forward the user's browser url remains the same which is what you probably want (no redirect is sent back to the browser, instead the request is internally routed to the jsp and that is returned to the user). If you use the .forward approach, you can return agent specific results to the user that may be beyond just window.width dependent, HD for example. But if you use that approach, you'll need to be careful about urls because you might mangle your SEO. Deeply linked urls should remain the same to a client. style sheets and javascript could be condensed and pre-embedded in your pages ahead of time to remove those as links, but image links would require a little work. There are several ways to use a single url for the image links which tend to be thwarted by IE7 or IE8 browsers (scalable graphics using SVG, for example). You could avoid image links by using data URIs, but again, IE browsers don't support that earlier than v 9. Get clever w/ image using sprites? (disadvantage only for mobile devices as they will be downloading more than they need). If your image links do not need to be part of the SEO, then you could use dynamically loaded images in your pages w/ ajax w/ a failover plan and then your page will not have a conflicting image url in it's indexed links. And for media which you would definitely want to be findable as part of your SEO such as videos or music, the filter approach would work fine to return device dependent response/stream from a request to the same url. If instead you choose to use the two pseudo-site pattern as in the first posts above: /site/ /site/mobile/ and redirect the user to the site or mobile landing page upon their first visit, then you can include a link rel=canonical in your main site to keep the SEO in good shape. (you just can't use your landing page that includes a redirect for advertising destinations.) On Oct 7, 7:56 am, WillSpecht willspe...@gmail.com wrote: I was looking for an easy way to do this once and make it work for the whole site. Now I realize I'm going to have to go into every servlet and have it choose which jsp to display. On Oct 6, 6:43 pm, WillSpecht willspe...@gmail.com wrote: My real problem is that I can't figgure out how to show war/mobile/ home.jsp when a user types in m.mydomain.com/home. On Oct 6, 5:55 pm, Nichole nichole.k...@gmail.com wrote: I should add that my simplified model above uses the given static examples without a redirect to a /site/mobile. By 'design for all viewports' I mean design to use floating right divs when possible... On Oct 6, 2:50 pm, Nichole nichole.k...@gmail.com wrote: I'm not using a pseudo-2-site model myself anymore as I recently simplified my structure. For SDK 1.5.2 I had errors upon submitting for deployment more than static 100 files, so keep that in mind. If SDK 1.5.5 increased the max of number of static files to be uploaded, or your files are within limit, next keep in mind that appengine implementation of javax.Servlet.Filters work upon dynamic content (filters are not applied to static content at this time). So if you need to sense the user agent on server-side using your library of preference, make sure that your welcome file is a jsp file in order for your browser agent filter to intercept up the request. If you are instead using a static html file that includes javascript to sense the viewport size (= document.width) and then redirect, you won't need to use a javax.servlet.Filter and can replace the welcome file with your index.html instead (caveat is that if you advertise, you won't be able to use that default url as it will now result in a redirect). Here's how it could work w/ welcome file index.html: If you had webapp directories: /site/ /site/mobile/ in appengine-web.xml use: public-root/site/public-root static-files
[appengine-java] Re: Calling app script from app engine
Since it's javascript downloaded from *appspot.com, is your question about 'cross origin resource sharing'? On Oct 7, 6:01 am, Vik vik@gmail.com wrote: Hie I have a google app script which I want to invoke from google app engine for java. Can someone please guide on how to invoke such script? I tried to google and i found lot of information on how to do the reverse. Please advise Thankx and Regards Vik Founderhttp://www.sakshum.orghttp://blog.sakshum.org -- 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: Full-text search engine and its indexes
Not sure what your search server does, but presumably the user enters keywords and you search through your file based pre-prepared 'indexes' of file offset and keywords to return information to locate the word within the text? Since you don't have direct access to big table and are not wanting to format your data for that in any case as you already have code to read your current format, it sounds as if you'd want to place the indexes in a database to use the features of a distr database. With appengine, you can choose the number of active instances to remove load from your problem set. For data modeling w/ appengine, you might need to empirically determine the largest number of entities that can be searched for a field within a reasonable amount of time (and that information would be useful to post back if you have it.) That number would be a size to use for your queries and hence the number of index entities that belong to one entity group. Presumably, the finest level of partitioning here could use starts with [a-d], starts with [e-o], etc. for bin ranges (or bin ranges within bin ranges), for example. To partition your data in appengine w/ it still remaining searchable, you could consider the extreme cases? The most number of entities: Content of each file based index as a separate entity is ~1 million indexes for your 400 books (presuming each index was 90B, and you have 90MB in 1 group of 400 books). Then add table entities holding the bin ranges. The advantage to this approach is that if the number of index entities will grow over time, you only need to change the tables (references) that point to the ranges to be used. The queries would be simple, but presumably you would need many in order to complete one request. The fewest number of entities: All indexes with primary value something through something would be aggregated into one large entity, and the same for the next bin range etc. Then add table entities holding the bin ranges. The advantage to this is that you'd need very few queries. The disadvantages would be many though! Any growth in your indexes may need all entities to be re-written. Returning a result returns far more than is needed... Presumably, partitioning using a method closer to the most number of entities is closer to what you want. With respect to the user's query: Any progress of a user's search could be stored in their session. Searches of the exact same query that would be repeated using an offset in range can be replaced with a cursor to make it more efficient. Features such as the background processing task queue or the already available task queue can continue a search asynchronously... On Oct 5, 8:35 am, jacek.ambroziak jacek.ambroz...@gmail.com wrote: I have full-text indexed all of O'Reilly eBooks (1,600 of them) using my own search engine. You can see how the search works if you have an Android tablet and install (free app) eCarrel (O'Reilly bookstore). To make searching manageable in the context of GAE I have originally partitioned all the books into 4 groups, each with its own index. That way searches can be performed in parallel (merging results when done), individual (per book group) indexes are smaller, and w/i group search is faster. An index for 400 books is about 90 MB in size. To implement the search engine on GAE I would dedicate 4 applications to the task (eg. search1.appspot.com, through search4). Each application would run exactly the same code, but would have different application files containing index data. (I wasn't sure if the index data should be stored in DataStore entities, Blobstore blobs, or application files; at the time the SE was first implemented it seemed that application files was the only option even if it meant that they had to be split into 10 MB chunks (1.5.5 supposedly raises the limit to 32 MB but I got an error attempting that)). One problem with that approach is that multiple GAE applications are used to implement parallel search servers. Another is that it takes time and resources to read in the index from application files into RAM before search results can be computed. When an instance is killed all this work goes to waste and will have to be repeated on next search. When the number of groups was too small and therefore indexes too big, I was getting OutOfMemory errors just loading index data to RAM. Do you guys think it is a good idea to use application files to store index data? Since each search server runs the same code (and only accesses different application files), can it be implemented via a single (versioned?) GAE application? (I will run out of applications when adding more search servers, and it will become more costly to run the search engine). http://ecarrel.com -- 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
[appengine-java] Re: Full-text search engine and its indexes
B.T.W. if you choose a method closer to 'using the most number of entities' above, just keep in mind that your key names should be scalable too if you will be adding entities to a range. The 2 parts which are needed for your binning are a parent key and your entity key. Your parent (ancestor) key is the entity group, so it's name could be the name of your entity group. (and that should be used to limit your searches to an entity group... if you need access to the group name in your search query filters, you may want to store that entity group name as a field in your 'index entities'). Your entity key could have a scalable name that is usable in an order by clause (the order by is needed if you're using cursors for example). A pattern like object1 for the entity name means you can keep adding names with a number as string. On Oct 5, 11:56 pm, Nichole nichole.k...@gmail.com wrote: Not sure what your search server does, but presumably the user enters keywords and you search through your file based pre-prepared 'indexes' of file offset and keywords to return information to locate the word within the text? Since you don't have direct access to big table and are not wanting to format your data for that in any case as you already have code to read your current format, it sounds as if you'd want to place the indexes in a database to use the features of a distr database. With appengine, you can choose the number of active instances to remove load from your problem set. For data modeling w/ appengine, you might need to empirically determine the largest number of entities that can be searched for a field within a reasonable amount of time (and that information would be useful to post back if you have it.) That number would be a size to use for your queries and hence the number of index entities that belong to one entity group. Presumably, the finest level of partitioning here could use starts with [a-d], starts with [e-o], etc. for bin ranges (or bin ranges within bin ranges), for example. To partition your data in appengine w/ it still remaining searchable, you could consider the extreme cases? The most number of entities: Content of each file based index as a separate entity is ~1 million indexes for your 400 books (presuming each index was 90B, and you have 90MB in 1 group of 400 books). Then add table entities holding the bin ranges. The advantage to this approach is that if the number of index entities will grow over time, you only need to change the tables (references) that point to the ranges to be used. The queries would be simple, but presumably you would need many in order to complete one request. The fewest number of entities: All indexes with primary value something through something would be aggregated into one large entity, and the same for the next bin range etc. Then add table entities holding the bin ranges. The advantage to this is that you'd need very few queries. The disadvantages would be many though! Any growth in your indexes may need all entities to be re-written. Returning a result returns far more than is needed... Presumably, partitioning using a method closer to the most number of entities is closer to what you want. With respect to the user's query: Any progress of a user's search could be stored in their session. Searches of the exact same query that would be repeated using an offset in range can be replaced with a cursor to make it more efficient. Features such as the background processing task queue or the already available task queue can continue a search asynchronously... On Oct 5, 8:35 am, jacek.ambroziak jacek.ambroz...@gmail.com wrote: I have full-text indexed all of O'Reilly eBooks (1,600 of them) using my own search engine. You can see how the search works if you have an Android tablet and install (free app) eCarrel (O'Reilly bookstore). To make searching manageable in the context of GAE I have originally partitioned all the books into 4 groups, each with its own index. That way searches can be performed in parallel (merging results when done), individual (per book group) indexes are smaller, and w/i group search is faster. An index for 400 books is about 90 MB in size. To implement the search engine on GAE I would dedicate 4 applications to the task (eg. search1.appspot.com, through search4). Each application would run exactly the same code, but would have different application files containing index data. (I wasn't sure if the index data should be stored in DataStore entities, Blobstore blobs, or application files; at the time the SE was first implemented it seemed that application files was the only option even if it meant that they had to be split into 10 MB chunks (1.5.5 supposedly raises the limit to 32 MB but I got an error attempting that)). One problem with that approach is that multiple GAE applications are used
[appengine-java] Re: Mobile subdomain in app engine
I should add that my simplified model above uses the given static examples without a redirect to a /site/mobile. By 'design for all viewports' I mean design to use floating right divs when possible... On Oct 6, 2:50 pm, Nichole nichole.k...@gmail.com wrote: I'm not using a pseudo-2-site model myself anymore as I recently simplified my structure. For SDK 1.5.2 I had errors upon submitting for deployment more than static 100 files, so keep that in mind. If SDK 1.5.5 increased the max of number of static files to be uploaded, or your files are within limit, next keep in mind that appengine implementation of javax.Servlet.Filters work upon dynamic content (filters are not applied to static content at this time). So if you need to sense the user agent on server-side using your library of preference, make sure that your welcome file is a jsp file in order for your browser agent filter to intercept up the request. If you are instead using a static html file that includes javascript to sense the viewport size (= document.width) and then redirect, you won't need to use a javax.servlet.Filter and can replace the welcome file with your index.html instead (caveat is that if you advertise, you won't be able to use that default url as it will now result in a redirect). Here's how it could work w/ welcome file index.html: If you had webapp directories: /site/ /site/mobile/ in appengine-web.xml use: public-root/site/public-root static-files include path=/site/favicon.ico / include path=/site/index.html / include path=/site/about.jsp / include path=/site/error.html / /static-files in web.xml use: error-page error-code404/error-code location/error.html/location /error-page welcome-file-list welcome-fileindex.html/welcome-file /welcome-file-list I'll leave the app version that uses an index.jsp welcome file and a browser agent filter up to you, but it should work similarly. On Oct 6, 7:10 am, WillSpecht willspe...@gmail.com wrote: Things will be slightly different on the mobile site. I have checked out jquery mobile and its how I want to write the mobile site. I think the layout of the two sites will be too different to do on one page. On Oct 5, 9:49 pm, Nichole nichole.k...@gmail.com wrote: Have you thought of designing for all viewports from the start instead of a redirect? see the new jquery library http://jquerymobile.com On Oct 4, 11:57 am, WillSpecht willspe...@gmail.com wrote: Can someone give me a basic rundown of how to set up a mobile site on app engine. I already have a standard site set up but I want to use the same data store to run a mobile site. I would like to redirect mobile users to m.mydomain.com. Basically both sites will be the same I just want to show them different jsp pages. -- 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: Mobile subdomain in app engine
One last addition is that the appengine implementation of javax.servlet.Filter will probably never intercept static content as those files are probably on CDN, hence not delivered directly by servlet container... On Oct 6, 2:55 pm, Nichole nichole.k...@gmail.com wrote: I should add that my simplified model above uses the given static examples without a redirect to a /site/mobile. By 'design for all viewports' I mean design to use floating right divs when possible... On Oct 6, 2:50 pm, Nichole nichole.k...@gmail.com wrote: I'm not using a pseudo-2-site model myself anymore as I recently simplified my structure. For SDK 1.5.2 I had errors upon submitting for deployment more than static 100 files, so keep that in mind. If SDK 1.5.5 increased the max of number of static files to be uploaded, or your files are within limit, next keep in mind that appengine implementation of javax.Servlet.Filters work upon dynamic content (filters are not applied to static content at this time). So if you need to sense the user agent on server-side using your library of preference, make sure that your welcome file is a jsp file in order for your browser agent filter to intercept up the request. If you are instead using a static html file that includes javascript to sense the viewport size (= document.width) and then redirect, you won't need to use a javax.servlet.Filter and can replace the welcome file with your index.html instead (caveat is that if you advertise, you won't be able to use that default url as it will now result in a redirect). Here's how it could work w/ welcome file index.html: If you had webapp directories: /site/ /site/mobile/ in appengine-web.xml use: public-root/site/public-root static-files include path=/site/favicon.ico / include path=/site/index.html / include path=/site/about.jsp / include path=/site/error.html / /static-files in web.xml use: error-page error-code404/error-code location/error.html/location /error-page welcome-file-list welcome-fileindex.html/welcome-file /welcome-file-list I'll leave the app version that uses an index.jsp welcome file and a browser agent filter up to you, but it should work similarly. On Oct 6, 7:10 am, WillSpecht willspe...@gmail.com wrote: Things will be slightly different on the mobile site. I have checked out jquery mobile and its how I want to write the mobile site. I think the layout of the two sites will be too different to do on one page. On Oct 5, 9:49 pm, Nichole nichole.k...@gmail.com wrote: Have you thought of designing for all viewports from the start instead of a redirect? see the new jquery library http://jquerymobile.com On Oct 4, 11:57 am, WillSpecht willspe...@gmail.com wrote: Can someone give me a basic rundown of how to set up a mobile site on app engine. I already have a standard site set up but I want to use the same data store to run a mobile site. I would like to redirect mobile users to m.mydomain.com. Basically both sites will be the same I just want to show them different jsp pages. -- 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: Mobile subdomain in app engine
Have you thought of designing for all viewports from the start instead of a redirect? see the new jquery library http://jquerymobile.com On Oct 4, 11:57 am, WillSpecht willspe...@gmail.com wrote: Can someone give me a basic rundown of how to set up a mobile site on app engine. I already have a standard site set up but I want to use the same data store to run a mobile site. I would like to redirect mobile users to m.mydomain.com. Basically both sites will be the same I just want to show them different jsp pages. -- 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: 404 for app thats deployed successfully.
2 things to fix in your web.xml: --param-value should be single valued --url-pattern ExampleApp/* should be changed. url-pattern has the following rules path mapping: starts with /, ends with /* extension mapping: begins with *. default servlet: single character / all other strings are exact matches only The loader (appengine-tools) validates all other xml content against schemas except for the web.xml against the web-app_2_5.xsd schema, at least as of sdk 1.5.2... On Oct 5, 12:09 am, Manilal libreg...@gmail.com wrote: I am having the same issue. I have checked web.xml and the welcome-file doesn't start with slash. Is there some other reason why this error occurs? In my case, the application runs successfully from Eclipse, dev_appserver and Ant, but not in appspot. Here is the web.xml: ?xml version=1.0 encoding=utf-8? web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://java.sun.com/xml/ns/javaee; xmlns:web=http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; xsi:schemaLocation=http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 filter filter-namespringSecurityFilterChain/filter-name filter-classorg.springframework.web.filter.DelegatingFilterProxy/filter- class /filter filter-mapping filter-namespringSecurityFilterChain/filter-name url-pattern/*/url-pattern /filter-mapping context-param param-namecontextConfigLocation/param-name param-value /WEB-INF/spring/servlet-config.xml /WEB-INF/spring/application-config.xml /WEB-INF/spring/spring-security.xml /param-value /context-param !-- Bootstraps the root web application context before servlet initialization -- listener listener-classorg.springframework.web.context.ContextLoaderListener/list ener-class /listener servlet servlet-namedispatcher/servlet-name servlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-c lass init-param param-namecontextConfigLocation/param-name param-value/WEB-INF/spring/servlet-config.xml/param-value /init-param load-on-startup1/load-on-startup /servlet servlet-mapping servlet-namedispatcher/servlet-name url-patternExampleApp/*/url-pattern /servlet-mapping welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list -- 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: Storing query results in memcache
Level2 cache might be what you want, but anyway, just to add to the dialog, I tinkered with what's available in datanucleus-core v1.1.5. Choices in datanucleus are: none, soft, and weak (jcache is not available in any version, but see below for customization) In addition to those, one can make a class that implements Level2Cache by adopting the connectors that you see in the src code for WeakLevel2Cache.java. If implementing your own Level2Cache, you can, for example, use Google's MapMaker in Guava for finer control of expiration: http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/MapMaker.html If you pursue a custom implementation, you'll have to edit datanucleus-core-1.1.5.jar's plugin.xml to add the new class and name for it. http://www.datanucleus.org/extensions/level2_cache.html http://grepcode.com/file_/repo1.maven.org/maven2/org.datanucleus/datanucleus-core/1.1.5/org/datanucleus/cache/WeakLevel2Cache.java/?v=source Here's a quick check I used in development and production to assert that the level2 cache works in appengine (presumably by container, and not yet distributed, not sure...) /* * Level 1 Cache - caching of instances within a PersistenceManager * Level 2 Cache - caching of instances within all PersistenceManagers of a PersistenceManagerFactory, */ /* * Add this to jdoconfig.xml or change yours for the level2 entries: * * persistence-manager-factory name=l2cache property name=javax.jdo.PersistenceManagerFactoryClass value=org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory/ property name=javax.jdo.option.ConnectionURL value=appengine/ property name=javax.jdo.option.NontransactionalRead value=true/ property name=javax.jdo.option.NontransactionalWrite value=true/ property name=javax.jdo.option.RetainValues value=true/ property name=datanucleus.appengine.autoCreateDatastoreTxns value=true/ property name=datanucleus.cache.level2 value=true/ property name=datanucleus.cache.level2.type value=weak/ property name=datanucleus.cache.level1.type value=weak/ /persistence-manager-factory */ PersistenceManagerFactory pmf = null; PersistenceManager pm = null; Transaction tx = null; Event event1 = null; try { pmf = JDOHelper.getPersistenceManagerFactory(l2cache); pm = pmf.getPersistenceManager(); tx = pm.currentTransaction(); DataStoreCache l2Cache = pmf.getDataStoreCache(); l2Cache.pinAll(true, Event.class); tx.begin(); event1 = createEvent1(); pm.makePersistent(event1); tx.commit(); } catch (Exception e) { e.printStackTrace(); e.printStackTrace(out); } finally { if (tx.isActive()) { tx.rollback(); } if (pm != null) { pm.close(); } log.info(wrote 1 event to PM); } Level2Cache l2Cache = ((JDODataStoreCache)pmf.getDataStoreCache()).getLevel2Cache(); int nObjectsInCache = l2Cache.getSize(); int nPinnedObjects = l2Cache.getNumberOfPinnedObjects(); int nUnpinnedObjects = l2Cache.getNumberOfUnpinnedObjects(); log.info(tx is closed:); log.info(number of objects in Level2Cache is + nObjectsInCache); log.info(number of pinned objects in Level2Cache is + nPinnedObjects); log.info(number of unpinned objects in Level2Cache is + nUnpinnedObjects); l2Cache.evictAll(); nObjectsInCache = l2Cache.getSize(); nPinnedObjects = l2Cache.getNumberOfPinnedObjects(); nUnpinnedObjects = l2Cache.getNumberOfUnpinnedObjects(); log.info(number of objects in Level2Cache is + nObjectsInCache); log.info(number of pinned objects in Level2Cache is + nPinnedObjects); log.info(number of unpinned objects in Level2Cache is + nUnpinnedObjects); On Oct 3, 5:14 am, nicanor.babula nicanor.bab...@gmail.com wrote: Thanks for your help. I'll go with Ian's suggestion, storing arrays in the memcache. -- 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: Storing query results in memcache
use the level 2 cache? property name=datanucleus.cache.level2.type value=javax.cache / Objects are placed in the L2 cache when you commit() the transaction of a PersistenceManager. This means that you only have datastore- persisted objects in that cache. Also, if an object is deleted during a transaction then at commit it will be removed from the L2 cache if it is present. http://www.datanucleus.org/products/accessplatform/jdo/cache.html#level2 On Sep 29, 3:59 am, nicanor.babula nicanor.bab...@gmail.com wrote: Hi Ian, Thanks for sharing your strategy.. I am not sure if I understand exactly how could I use your system to solve my problem. Actually, the memcache concept is working nice solving similar, but simpler situations. I think I explained poorly my situation. Here it is: An application manages contacts. It actually has thousands of them. On the GUI side we have a listview, an editview and a createview. The list view has 4 columns, and is paged (30 records per page) and by default is sorted ascending by the first column. I can search the listview by issuing queries serverside (I want the results always ordered and paged accordingly). Now, a user clicks on new contact. The application goes into createView. Data input then save. Application goes to list view. The contact should have been in the first page, but it isn't. After a few seconds, it appears. The previous example with phone numbers is kind of the same issue, but with simpler queries: User modifies a contact by adding some phone numbers. Hits save and goes to list view, then he remembers that one number was wrong and goes back to editing the same contact. The phone numbers inserted seconds ago aren't there. In this case, (since for other reasons I the phone numbers entities cannot be children of the contact entity) every phone number entity has a property called contactId that points to the father contact. The solution employed in this simple case is storing in the memcache the phone numbers by using contact-based keys so that for example [code] memcache.get(MEMCACHE_phones_contactId_1234) [/code] would give me an all the phone numbers for contact having id=1234. Somehow (too long and boring to explain how) I manage to keep this array always up to date so when the user returns lightning-fast to the editview the newly inserted phone number are there, only that they are read from the memcache. Analogically, how could this be done for the fore-mentioned listview situation, where the query is much more complex? Hope I didn't confused you more.. Thanks, Cristian -- 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: Servlet Mapping not working as expected
try a forward within index.jsp instead: jsp:forward page=/index.vm / On Sep 26, 1:42 pm, Stephen Johnson onepagewo...@gmail.com wrote: My guess is that Google is interpreting them as static files and Google's infrastructure is handling them before it reaches your app. So, read up on excluding static files so they aren't served up by Google's infrastructure athttp://code.google.com/appengine/docs/java/config/appconfig.html Also, I put my JSP files in my WEB-INF and you may want to do that as well with your vm files. Then there shouldn't be any way they will be served as static files by Google. Stephen CortexConnect.com On Sun, Sep 25, 2011 at 11:50 AM, Andrew Ducker and...@ducker.org.ukwrote: I'm trying to get Velocity up and running with GAE, and the first problem I'm bumping into is that servlet mapping doesn't seem to be working as I'd expect. I've cut down the Web.xml to its bare minimum: servlet servlet-namevelocity/servlet-name servlet-classorg.apache.velocity.tools.view.VelocityViewServlet/ servlet-class /servlet servlet-mapping servlet-namevelocity/servlet-name url-pattern*.vm/url-pattern /servlet-mapping welcome-file-list welcome-fileindex.vm/welcome-file /welcome-file-list Now, when I accesshttp://localhost:/it presents with me with a page that looks as I'd expect (give or take). But when I access http://localhost:/index.vmit shows me the source of the page, rather than the processed version. With *.vm in the url-pattern, I'd have expected it to work exactly the same in both cases. I did a bit of further testing, rerouting things to my own servlet to see when it got called and when it didn't. If I use a uri to a file that exists then I get the source of it. If I use a uri for a file that doesn't exist (i.e.http://localhost:/DoesntExist.vm) then my servlet is called. Any suggestions as to why it would be getting the file directly rather than calling the servlet? Is there a setting I need to configure to tell it to call the servlet even if the file exists? Cheers, Andy -- 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. -- 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: GAE+GWT2.4 [ERROR] java.lang.NoClassDefFoundError: javax/validation/Path
It looks like a factory for a validation service might be looking for the declaration of the validation service. These are often declared in a file in META-INF/services in jars that are the providers of that service so take a look at the jars in your web apps lib directory. That same declaration can be made programmatically using System.setProperty(javax.validation.spi.ValidationProvider, packagename.validatationclass) if you know what it is and do not want to alter the jar file. On Sep 19, 9:46 pm, John Howe jhowe...@gmail.com wrote: I thought this was going to be easy. I'm trying to move a working GAE java app up to GWT 2.4. But when I do, I see the following stack trace on the first RPC call. At least one other guy has seen this while doing same and posted a query athttp://groups.google.com/group/google-appengine/browse_frm/thread/a78... Any help, suggestions, or insight would be most appreciated! Thanks. The server is running athttp://localhost:/ mozilla/5.0 (windows nt 6.0) applewebkit/535.1 (khtml, like gecko) chrome/14.0.835.163 safari/535.1 [ERROR] javax.servlet.ServletContext log: Exception while dispatching incoming RPC call java.lang.NoClassDefFoundError: javax/validation/Path at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(Iso latedAppClassLoader.java:176) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.google.gwt.user.server.rpc.SerializationPolicyLoader.loadFromStream(Ser ializationPolicyLoader.java:196) at com.google.gwt.user.server.rpc.RemoteServiceServlet.loadSerializationPolicy (RemoteServiceServlet.java:90) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doGetSerializationPolic y(RemoteServiceServlet.java:293) at com.google.gwt.user.server.rpc.RemoteServiceServlet.getSerializationPolicy( RemoteServiceServlet.java:157) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.prepare ToRead(ServerSerializationStreamReader.java:455) at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:237) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServi ceServlet.java:206) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServi ceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(Abstract RemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1166) at com.sportzcasterbeta.server.ServiceFilterImpl.doFilter(ServiceFilterImpl.ja va:25) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157) at com.sportzcasterbeta.server.ServiceFilterImpl.doFilter(ServiceFilterImpl.ja va:25) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(He aderVerificationFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFi lter.java:58) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans actionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFile Filter.java:122) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157) at com.google.appengine.tools.development.BackendServersFilter.doFilter(Backen dServersFilter.java:97) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at
[appengine-java] Re: Developing Multilingual Web Applications
and you'll probably want to add threadsafetrue/threadsafe to appengine-web.xml as appengine's frontend server will otherwise send requests serially On Sep 18, 6:25 pm, Nichole nichole.k...@gmail.com wrote: If you have a java web application that conforms to servlet spec 2.4, jsp spec 2.0 and jstl spec 1.1.x the additional steps you'll need to take are roughly: -- add the resource files to your appengine-web.xml file -- replace use of JAAS classes that are not allowed by the appengine security manager such as the Principal class. see the Google account com.google.appengine.api.users.User -- turn any jspx files into jsp files by making the directives not use xml (just the directives, the remaining jstl xml commands will still function). that also means that your jsp-config in the web.xml should use el-ignoredfalse/el-ignored -- the jars for servlet-api, jsp-api, jstl and standard are needed for compilation, but should be removed before deployment as they are provided by the container. -- to use the servlet session, you'll need to enable it with: http://code.google.com/appengine/docs/java/config/appconfig.html#Enab... On Sep 17, 4:37 pm, Jesper Nyqvist ad...@neptunediving.com wrote: Google Data APIs http://code.google.com/apis/gdata/javadoc/ This is google data api library but i cannot find what i need in here. There is very little documentation regarding this issue with google. There most be some information out there regarding this with multilingual web applications? Not only from oracle but also from google? Please anybody who have any ideas regarding this, please let me know so i can start with my new google project!! -- 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: Developing Multilingual Web Applications
If you have a java web application that conforms to servlet spec 2.4, jsp spec 2.0 and jstl spec 1.1.x the additional steps you'll need to take are roughly: -- add the resource files to your appengine-web.xml file -- replace use of JAAS classes that are not allowed by the appengine security manager such as the Principal class. see the Google account com.google.appengine.api.users.User -- turn any jspx files into jsp files by making the directives not use xml (just the directives, the remaining jstl xml commands will still function). that also means that your jsp-config in the web.xml should use el-ignoredfalse/el-ignored -- the jars for servlet-api, jsp-api, jstl and standard are needed for compilation, but should be removed before deployment as they are provided by the container. -- to use the servlet session, you'll need to enable it with: http://code.google.com/appengine/docs/java/config/appconfig.html#Enabling_Sessions On Sep 17, 4:37 pm, Jesper Nyqvist ad...@neptunediving.com wrote: Google Data APIs http://code.google.com/apis/gdata/javadoc/ This is google data api library but i cannot find what i need in here. There is very little documentation regarding this issue with google. There most be some information out there regarding this with multilingual web applications? Not only from oracle but also from google? Please anybody who have any ideas regarding this, please let me know so i can start with my new google project!! -- 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: Help: Memcache - not hitting at all
The lower level MemcacheService is different from the service provided by the jache api (a.k.a. memcache). The lower level MemcacheService that you are accessing is more volatile and so in between checking for existence of a key and getting that value, the value may have been disappeared (reclaimed by the garbage collector). This can happen more frequently if the values are soft references. soft references are a way to specify that the garbage collector can remove an object even if it's still referred to by a root object in the heap - the gc would reclaim that object's memory if memory becomes scarce. So in summary, you want to get the value and work with that in one step instead of the less atomic check for existence then get value - that's because this cache implementation is more volatile. On Sep 13, 10:03 am, realdope rte...@gmail.com wrote: I took suggestions from Nicole and it seems to be working now.. Although I'm still uneasy about it. How does contains(key) work? If I store a non-null value into the Memcache, why would get(key) ever return null? What's wrong with the existing code that I posted that Memcache.hasById(id) always fails? -- 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: Help: Memcache - not hitting at all
The implementation of jcache is now Google's GCache internally and that's included in the api, so no need to include the separate jar for appengine-jsr107cache. GCache implements javax.cache.Cache The only mention I could find of net.sf.jsr107cache.Cache.java online did not implement javax.cache.Cache. If you're following the documentation, might want to change your cache interface to javax.cache.Cache and use a ConcurrentMap when you create your cache. On Sep 14, 3:25 am, Cyrille Vincey cvin...@qunb.com wrote: Speaking about memcache, could someone give a clear confirmation whether I should use import net.sf.jsr107cache.Cache or javax.cache.Cache. Documentation is still misguiding about this point. 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: Help: Memcache - not hitting at all
The javadocs for MemcacheService suggest a pattern that you would use if the backing cache used soft references: foo = memcache.get(key); if (foo == null) { if (memcache.contains(key)) { // continue, assuming foo had the real value null } else { // continue; foo may have had a real null, but has been dropped now } } On Sep 11, 12:33 pm, realdope rte...@gmail.com wrote: Here's rest of the code: public class Memcache { private static int EXPIRY = 60*60*24*30; private static final String POSTIDKEY=POSTID_; private static boolean has(String key) { return MemcacheServiceFactory.getMemcacheService().contains(key) get(key).length()0; } private static String get(String key) { try { return (String) MemcacheServiceFactory.getMemcacheService().get(key); } catch (Exception e) { return ; } } private static void put(String key, String value, int expiry) { MemcacheServiceFactory.getMemcacheService().put(key, value, Expiration.byDeltaSeconds(expiry)); } private static void delete(String key) { MemcacheServiceFactory.getMemcacheService().delete(key); } public static boolean hasById(Long id) { return has(POSTIDKEY+id); } public static String getById(Long id) { return get(POSTIDKEY+id); } public static void putById(Long id, String value) { put(POSTIDKEY+id, value, EXPIRY); } public static void flushById(Long id) { delete(POSTIDKEY+id); } } public static String byid(HttpServletRequest req) { Long id=0L; try { id=Long.parseLong(req.getParameter(id)); } catch (Exception e) {} if (id==0) return ; if (Memcache.hasById(id)) return Memcache.getById(id); String res = V1Post.getById(id); Memcache.putById(id, res); return res; } Does anyone know where the error is in my code? And why Memcache.hasById(id) seems to always return false? -- 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: Retrieving keys involving corresponding entities in transaction
Hi Mauricio, I think I need more information: What relationships do you have between your entities? For the Conversation/Comment example above I can derive something like this: === Conversation -- commentKey: Key status: String rank: Integer -- findConversationKeysForCommentVisibleRanked(Integer, Key): ListKey === Comment -- key: Key -- Relationships? And what version of the appengine-datanucleus plugin are you using (1.x or 2.x?) And are you using the default jdoconfig.xml or other PMF/level1/2 cache configurations? On Sep 5, 4:59 pm, Mauricio Aristizabal aris...@gmail.com wrote: Forgot to add: entity 38 is the one being updated, entity 34 is the one for the first key in the returned list. May or may not be significant. -- 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: Problem with URL paths in deployed version of Google App
In addition to adding urls to your appengine-web.xml, if you intend app to be your application default root path, see: http://code.google.com/appengine/docs/java/config/appconfig.html#Changing_the_Root_Directory On Sep 9, 12:13 pm, jem...@gmail.com wrote: Static file are dealt with differently on production , please check gaej documentation online. Hth-- Sent from my HP TouchPad On Sep 9, 2011 2:31 PM, nicshel2 nicsh...@gmail.com wrote: Hi, I am working on my first Google App and am having issues with URLs. I am using Spring MVC. My application works as expected in local development mode, where I have URLs in the format of http://localhost:/app/intro.htm When I deploy to Google App Engine however this path doesn't work. ( replacing local host with actual URL ). http://.appspot.com/app/intro.htm For example I am trying to get the UserService to redirect to the login screen ( works fine in local deployment ) but I get the error: java.lang.IllegalArgumentException: The requested URL was not allowed: /app/intro.htm If I try to go to http://.appspot.com/app/intro.htm directly from the deployed version, it fails because /app/intro.htm cannot be found. If anyone could give me any tips or suggestions that would be great. Thanks, Lisa -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visithttps://groups.google.com/d/msg/google-appengine-java/-/Lce29yEEsUgJ. 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. -- 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: Delete Lots Of Data
Can use low-level datastore and iterate over batches: binSize = 1000;// or smaller if needed 30 sec timeout DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Keys only select and delete: javax.jdo.Query q = pm.newQuery(select key from + entityKind.getClass().getName()); q.setRange(0, binSize); (ListKey) q.execute(); ds.delete(keys); Or slower entity-by-entity delete: FetchOptions fetchOptions = FetchOptions.Builder.withLimit(binSize); com.google.appengine.api.datastore.Query q = new com.google.appengine.api.datastore.Query(entityKind); PreparedQuery pq = datastore.prepare(q); Listcom.google.appengine.api.datastore.Entity results = pq.asList(fetchOptions); for (com.google.appengine.api.datastore.Entity result : results) { com.google.appengine.api.datastore.Key key = result.getKey(); datastore.delete(key); } On Sep 9, 9:55 pm, Didier Durand durand.did...@gmail.com wrote: If you don't want to introduce MapReduce solely for this purpose, you can write a queued task that loops through the data to delete it and that recreates a new instance of itself just before time limit (10 min) to continue the deletion. regards didier On Sep 9, 8:37 pm, Marcelo Liberato mliber...@gmail.com wrote: You may use MapReduce programmatically or just use Datastore admin (which uses mapreduce behind the scenes). On Thu, Sep 8, 2011 at 12:30 PM, blitzer brian.blit...@gmail.com wrote: So I have ~ 35 million rows of data. I have seen that I need to get the data into a collection and then call deletePersistAll(). Is that the only way? -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/gg8buxlS2JUJ. 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. -- 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: BigTable LIKE
In addition to the above, I'd say you might want to make new keyword entities for each keyword and store the reference/key to the original entities instead of storing your keywords as a list of properties in your original entity. A list of strings is stored implicitly as an embedded table so will be slower to search for than searching for a keyword property in a separate entity - this later is indexed by the framework. On Aug 29, 4:01 am, Ravi Sharma ping2r...@gmail.com wrote: Lets say you have book Harry potter If you want to search this withH or Ha Har Harr then this facility provided by google app engine, instead of Like use startWith . Else if you really want to search it with arry or rry basically any word in it, then you may saev every book name as SetString (Not List avod duplicates) save following strings in Set and you will be bale to search it... H A R Y HA AR RR RY HAR ARR RRY HARR ARRY HARRY Ravi. On Mon, Aug 29, 2011 at 11:56 AM, J.Ganesan j.gane...@datastoregwt.comwrote: Why don't you consider splitting the keywords and maintaining a memcache-resident HashMapString,id ? J.Ganesan www.DataStoreGwt.com On Aug 26, 9:25 pm, realdope rte...@gmail.com wrote: Hi, I know that you cannot do a LIKE clause in BigTable. How do you get around this issue? Suppose I'm making a book database, and I want to implement a search function that compares titles against a random string. What is a plausible mechanism with which to do so? Any help would be appreciated! -- 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. -- 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.lang.LinkageError encountered loading Google Checkout classes
I started seeing errors due to changes in appengine security manager and a new appengine defined user-class loader on about July 21st for classes that I was constructing on the fly dynamically in the code using Constructor. In addition to ExceptionInInitializerErrors there were logs statements about not being to resolve some of the members within the dynamically constructed class. Some of those members were in other jars. I added code to catch a few exceptions related to that and use the classes constructor instead. Your log statement java.lang.reflect.InvocationTargetException suggests that you may be seeing something similar. On Aug 24, 4:08 pm, Eddie C eddiecc...@gmail.com wrote: Hello. Our app integrates with Google Checkout. As part of the checkout process, Google Checkout makes an HTTP callback request to our App to calculate taxes; it is at this point that we are failing. It appears that the error occurs when our App attempts to process XML content in the Google Checkout callback. Here's the error that we see in the AppEngine console: -- A serious problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. If you see this message frequently, you should contact the App Engine team. (Error code 202) -- Not very helpful. We turned up the logging level and got some more detailed logs. Here's an excerpt from that log: -- Caused by: java.lang.LinkageError: loader (instance of com/google/ apphosting/runtime/security/UserClassLoader): attempted duplicate class definition for name: com/google/checkout/schema/_2/ ShippingRestrictions$ExcludedAreas $JaxbAccessorF_usStateAreaOrUsZipAreaOrUsCountryArea at com.google.appengine.runtime.Request.process-5e6d2d1250669cff(Request.java) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) ... 152 more D 2011-08-21 12:19:28.208 com.sun.xml.bind.v2.runtime.reflect.opt.Injector inject: Unable to inject com/google/checkout/schema/_2/MerchantCalculatedShipping $JaxbAccessorF_name java.lang.reflect.InvocationTargetException at com.google.appengine.runtime.Request.process-5e6d2d1250669cff(Request.java) at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java: 43) at java.lang.reflect.Method.invoke(Method.java:43) at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java: 181) at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java: 85) at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorIn jector.java: 87) at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(Optimi zedAccessorFactory.java: 164) at com.sun.xml.bind.v2.runtime.reflect.Accessor $FieldReflection.optimize(Accessor.java:252) at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor $CompositeTransducedAccessorImpl.init(TransducedAccessor.java:231) at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccess or.java: 173) at com.sun.xml.bind.v2.runtime.property.AttributeProperty.init(AttributeProp erty.java: 87) at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory .java: 104) at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.init(ClassBeanInfoImpl.java : 171) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.jav a: 481) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.init(JAXBContextImpl.java: 315) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java: 139) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java: 117) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java: 188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java: 43) at java.lang.reflect.Method.invoke(Method.java:616) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:159) at javax.xml.bind.ContextFinder.find(ContextFinder.java:311) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:392) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:357) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:264) at com.google.checkout.protocol.AbstractProtocolBuilder.createXmlUnMashaller(A bstractProtocolBuilder.java: 86) at
[appengine-java] Re: Server Error : Deployment Failed
you can get notifications for the issue at: http://code.google.com/p/googleappengine/issues/detail?id=5474 On Aug 20, 12:10 am, steveb steve.buikhui...@gmail.com wrote: and me On Aug 20, 3:13 pm, BoulderGae sc...@scmlabs.com wrote: Me Too! On Aug 19, 10:34 pm, culov cul...@gmail.com wrote: havent been able to deploy in the last hour... On Aug 19, 8:24 pm, Shawn Brown big.coffee.lo...@gmail.com wrote: Hello, I consistently get: Unable to update: java.io.IOException: Error posting to URL:https://appengine.google.com/api/appversion/clonefiles?app_id=fluency... 500 Internal Server Error On a related note, are uploads to appengine (meaning deploying) very slow. I was averaging around 32kbps which is well below what my connection tests at 256kbps. Well that is before deploying failed completely. Now all's I see is: at com.google.appengine.tools.admin.AbstractServerConnection.send(AbstractServ erConnection.java:249) at com.google.appengine.tools.admin.AbstractServerConnection.post(AbstractServ erConnection.java:207) at com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.jav a:639) at com.google.appengine.tools.admin.AppVersionUpload.cloneFiles(AppVersionUplo ad.java:502) at com.google.appengine.tools.admin.AppVersionUpload.beginTransaction(AppVersi onUpload.java:462) at com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload .java:137) at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:30 0) at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:52) at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute(AppCfg.java:59 8) at com.google.appengine.tools.admin.AppCfg.init(AppCfg.java:157) at com.google.appengine.tools.admin.AppCfg.init(AppCfg.java:65) at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:61) and 37% Cloning 1027 application files. 37% on backend null. So what do I need to do to reply? Shawn -- 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: deployment to production stalling
http://code.google.com/p/googleappengine/issues/detail?id=5524 Anyone had trouble with client-server-client data exchange that's lead to stalled updates? Thanks for your time, Nichole On Jul 26, 1:46 pm, Nichole nichole.k...@gmail.com wrote: Can anyone who's successfully today deploying to appengine production w/ sdk 1.5.0 confirm this md5 sum for me? MD5 (appengine-tools-api.jar) = 472e6d29ff6633cf1cc7fde3cabd6290 Thanks for your time On Jul 25, 11:05 am,Nicholenichole.k...@gmail.com wrote: Hello, Anyone having troubles deploying to appengine production? My deployments are currently stalling out to production since Friday July 21 though they still succeed to development. I didn't change my java jdk binaries, didn't change the appengine sdks that I was using, and had previously successfully deployed the app using the same configuration and builds, even after the July 14th maintenance. To troubleshoot, I tried installing and building from variations of java jdks, variations of appengine sdks (fresh downloads and existing that I already had) and had the same stalls during attempts to upload to production. I ran the deployment with java verbose options to print the classes loaded and then created aspects and used load time weaving to see the methods where the deployment is stalling. I can print them out here if it's helpful, but it looks to be a bug in the appengine-tools-api.jar Has anyone else had the same problem recently? If so, how did you solve it? Thanks, Nichole -- 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: deployment to production stalling
Ikai, can you recommend a work around? On Aug 8, 10:37 am, Nichole nichole.k...@gmail.com wrote: http://code.google.com/p/googleappengine/issues/detail?id=5524 Anyone had trouble with client-server-client data exchange that's lead to stalled updates? Thanks for your time, Nichole On Jul 26, 1:46 pm, Nichole nichole.k...@gmail.com wrote: Can anyone who's successfully today deploying to appengine production w/ sdk 1.5.0 confirm this md5 sum for me? MD5 (appengine-tools-api.jar) = 472e6d29ff6633cf1cc7fde3cabd6290 Thanks for your time On Jul 25, 11:05 am,Nicholenichole.k...@gmail.com wrote: Hello, Anyone having troubles deploying to appengine production? My deployments are currently stalling out to production since Friday July 21 though they still succeed to development. I didn't change my java jdk binaries, didn't change the appengine sdks that I was using, and had previously successfully deployed the app using the same configuration and builds, even after the July 14th maintenance. To troubleshoot, I tried installing and building from variations of java jdks, variations of appengine sdks (fresh downloads and existing that I already had) and had the same stalls during attempts to upload to production. I ran the deployment with java verbose options to print the classes loaded and then created aspects and used load time weaving to see the methods where the deployment is stalling. I can print them out here if it's helpful, but it looks to be a bug in the appengine-tools-api.jar Has anyone else had the same problem recently? If so, how did you solve it? Thanks, Nichole -- 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: Trying to save and retrieve data in google app engine in hierarchical manner.
In the first case, you have an unowned one to many and the children are not persisted with pm.makePersitent(item); If the 2nd case, when Item owns Child entities, pm.makePersistent(item) will persist the children too, but you will have exceptions it you try to persist another item with the same children. If you wanted a hierarchical data structure, you could create a graph of entities with references to children and parent. you'd be missing the cascade delete and insert features of owned one to may relationships though. On Aug 2, 11:49 pm, Ian Marshall ianmarshall...@gmail.com wrote: I don't think that we can help you unless we see some of your code where you do your persisting! (Am I correct to presume that you are using JDO?) On Aug 2, 2:28 pm, Sachin Salunkhe sachi...@ensarm.com wrote: I am trying to save and retrieve data in google app engine in hierarchical manner. 1. In such a case ,where I am using key's for reference to another entity (i.e parent -- child) @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = true) public class Item { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private ListKey childs; // } there is no replication of data. Is it possible that child entities get saved automatically when parent is saved in above case where I am using Keys ? 2. If I tried same without keys .. @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = true) public class Item { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private ListChild childs; // } In this case when I saved parent entity then child's also get saved automatically . But then there is replication of data i.e for different child's of same parent there are separate copies of parent's. Can anybody give me some Ideas and Links ?? -- 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: Retrieving keys involving corresponding entities in transaction
Did you reverse the error and queries? In the first, you're getting a list of keys, so those aren't entities to have caused the multiple entity exception. On Aug 1, 11:12 pm, Mauricio Aristizabal aris...@gmail.com wrote: I was just trying retrieve a List of entities and do a .size() to get a current count, but ran into this: Caused by: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both Element { type: Conversation id: 37 } and Element { type: Reply id: 38 } It was very confusing because nowhere am I doing anything with Reply #38. It happens only when I get the list like this (JPA): entityManager().createQuery(SELECT key FROM Reply o WHERE o.conversationKey = :conversation).setParameter(conversation, conversationKey).getResultList(); and NOT if I do it like this: entityManager().createQuery(SELECT o FROM Reply o WHERE o.conversationKey = :conversation).setParameter(conversation, conversationKey).getResultList(); Any idea why this is? I'm not blocked... I'll just keep a counter. Mainly wanted to share in case someone else is stumped by this 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: How to ensure two entities are updated WITHOUT using transactions?
Also, if you wanted to use that same pattern of 2 transactions for a delete, you should use a query for the delete to avoid conflict with the cache. tx.begin(); qRT = pm.newQuery(Event.class); qRT.setFilter( (key == k) ); qRT.declareParameters(com.google.appengine.api.datastore.Key k); long ndeleted = qRT.deletePersistentAll(key); pm.flush(); tx.commit(); On Jul 18, 8:49 pm, Nichole nichole.k...@gmail.com wrote: By the way, if you wanted vary your jdoconfig.xml settings knowing which are impl in appengine, here's a link to appengine datanucleus test code: http://code.google.com/p/datanucleus-appengine/source/browse/trunk/te... On Jul 18, 8:44 pm, Nichole nichole.k...@gmail.com wrote: The answer to the nontransactionalread and write are below, but meanwhile, if you really do need those updates to be as close to atomic as possible, then you need them in the same entity group so they're co-located in the distributed file system. On Jul 18, 2:02 am, mscwd01 mscw...@gmail.com wrote: Thanks for the update. It's a pity you cant check to see if the first transaction committed before it leaves an active state, that'd make things so much easier. I really needed the two updates to occur as quickly as possible so relying on the second update to continue retying via the task queue, is not ideal. Would running the PersistenceManagerFactory with 'NontransactionalRead' and 'NontransactionalWrite' set to 'true' allow me to do what I want? I cant really find any documentation that describes what those two values do. Thanks again On Jul 17, 11:46 pm,Nicholenichole.k...@gmail.com wrote: Good point, I rewrote the code below to better use the available connections and improve the pattern. Regarding update 1 being committed and update 2 failing, the first is already committed, yes. I think one has to use a retry for the 2nd update (using the task queue structure) for the 2nd operation to eventually succeed, but on a longer timescale. Here's a better approach to the problem: import com.climbwithyourfeet.software.twotransaction.util.PMF; import com.google.appengine.api.datastore.Key; import java.util.ArrayList; import javax.jdo.Transaction; import javax.jdo.PersistenceManager; import java.util.logging.Logger; import com.google.appengine.tools.development.LocalDatastoreTestCase; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; /** Goal: * Update 2 entities which reside in 2 different entity groups. * The updates must both pass or both fail. * * Solution: * Use a different transaction for each entity, configurable in jdoconfig.xml. * (Note that it looks like 2 named PersistenceManagerFactory connections are possible, but not more than that, and there is only one transaction for a PMF connection). * * Solution is essentially check that transaction1 succeeds or fails before * committing transaction2. * * The case which needs additional fail-over is the case in which transaction 1 is committed successfully but transaction2 fails. * In this case a retry of transaction2 should be invoked and must eventually succeed. * * For that reason, any code using this pattern should design the logic so that the logic in the 2nd transaction can be consistent on a longer timescale. * * @authornichole */ public class TwoOperationPseudoTransactionTest extends LocalDatastoreTestCase { private final Logger log = Logger.getLogger(this.getClass().getName()); private String iden1 = 1234567; private String iden2 = 1123456; public TwoOperationPseudoTransactionTest() { super(); } @Before public void setUp() throws Exception { super.setUp(); try { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); tx.begin(); UserGameCredits e1 = new UserGameCredits(iden1); pm.makePersistent(e1); pm.flush(); tx.commit(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); tx = pm2.currentTransaction(); tx.begin(); UserAccount e2 = new UserAccount(iden2); pm2.makePersistent(e2); pm2.flush(); tx.commit(); } catch (Throwable t) { String msg = t.getMessage(); } } @After public void tearDown() throws Exception { super.tearDown(); } @Test public void
[appengine-java] Re: Mining logs for performance data
Or the script that's used to upload your application now offers the ability to download logs too: http://code.google.com/appengine/docs/java/tools/uploadinganapp.html You'd have to download frequently or not depending upon your log rate. Or you could create a servletrequestlistener to gather the stats you need and store them in the datastore or another datastore using the RemoteApiInstaller. On Jul 28, 10:18 am, Stephen Johnson onepagewo...@gmail.com wrote: I don't know if this will help you or not but you can read about a utility I wrote a while back that uses XMPP to send log info for real-time monitoring. These messages can be saved to files I believe by some of the chat clients out there or probably a custom chat client could be built to save the data to files in your own format. Maybe it will give you an idea of what you can do. It can be found atwww.professionalintellectualdevelopment.comand there's a link to the code at Google Project Hosting there as well. Stephen CortexConnect cortexconnect.appspot.com On Thu, Jul 28, 2011 at 9:40 AM, Kesava Neeli nke...@gmail.com wrote: Anyone from GAE team has better suggestions for this? Normally we setup a separate metrics logger in log4j which would log all metric events in a separate log file. Then we generate reports out of it. On GAE, we cannot define a logfile for a separate logger and don't have access to download any log file.. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/t63On0QqjvkJ. 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. -- 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: deployment to production stalling
Can anyone who's successfully today deploying to appengine production w/ sdk 1.5.0 confirm this md5 sum for me? MD5 (appengine-tools-api.jar) = 472e6d29ff6633cf1cc7fde3cabd6290 Thanks for your time On Jul 25, 11:05 am, Nichole nichole.k...@gmail.com wrote: Hello, Anyone having troubles deploying to appengine production? My deployments are currently stalling out to production since Friday July 21 though they still succeed to development. I didn't change my java jdk binaries, didn't change the appengine sdks that I was using, and had previously successfully deployed the app using the same configuration and builds, even after the July 14th maintenance. To troubleshoot, I tried installing and building from variations of java jdks, variations of appengine sdks (fresh downloads and existing that I already had) and had the same stalls during attempts to upload to production. I ran the deployment with java verbose options to print the classes loaded and then created aspects and used load time weaving to see the methods where the deployment is stalling. I can print them out here if it's helpful, but it looks to be a bug in the appengine-tools-api.jar Has anyone else had the same problem recently? If so, how did you solve it? Thanks, Nichole -- 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] deployment to production stalling
Hello, Anyone having troubles deploying to appengine production? My deployments are currently stalling out to production since Friday July 21 though they still succeed to development. I didn't change my java jdk binaries, didn't change the appengine sdks that I was using, and had previously successfully deployed the app using the same configuration and builds, even after the July 14th maintenance. To troubleshoot, I tried installing and building from variations of java jdks, variations of appengine sdks (fresh downloads and existing that I already had) and had the same stalls during attempts to upload to production. I ran the deployment with java verbose options to print the classes loaded and then created aspects and used load time weaving to see the methods where the deployment is stalling. I can print them out here if it's helpful, but it looks to be a bug in the appengine-tools-api.jar Has anyone else had the same problem recently? If so, how did you solve it? Thanks, Nichole -- 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: How to ensure two entities are updated WITHOUT using transactions?
The 2 properties that you are trying to set nontransactionalRead and nontransactionalRead are what is set in the jdoconfig.xml. They define whether that persistence manager will allow queries that are not in a transaction. The datanucleus documentation isn't as readily available for jdo 2.3, so here's what the kodo docs say: 2.5.10. javax.jdo.option.NontransactionalRead Property name: javax.jdo.option.NontransactionalRead Configuration API: kodo.conf.JDOConfiguration.getNontransactionalRead Resource adaptor config-property: NontransactionalRead Default: true Description: Whether the JDO runtime will allow you to read data outside of a transaction. See Section 7.2, “PersistenceManagerFactory Properties” in the JDO Overview for details. 2.5.11. javax.jdo.option.NontransactionalWrite Property name: javax.jdo.option.NontransactionalWrite Configuration API: kodo.conf.JDOConfiguration.getNontransactionalWrite Resource adaptor config-property: NontransactionalWrite Default: false Description: Whether you can modify persistent fields outside of a transaction. See Section 7.2, “PersistenceManagerFactory Properties” in the JDO Overview for details. http://download.oracle.com/docs/cd/E13189_01/kodo/docs316/ref_guide_conf_jdo.html#javax.jdo.option.NontransactionalRead One last post of the example that includes asserts and a few more comments to make it readable: package com.climbwithyourfeet.software.twotransaction.model; import com.climbwithyourfeet.software.twotransaction.util.PMF; import com.google.appengine.api.datastore.Key; import java.util.ArrayList; import javax.jdo.Transaction; import javax.jdo.PersistenceManager; import java.util.logging.Logger; import com.google.appengine.tools.development.LocalDatastoreTestCase; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; /** Goal: * Update 2 entities which reside in 2 different entity groups. * The updates must both pass or both fail. * * Solution: * Use a different transaction for each entity, * configurable in jdoconfig.xml. * (Note that it looks like 2 named PersistenceMaangerFactory * connections are * possible, but not more than that, and there is only one * transaction for a PMF connection). * * Solution is essentially check that transaction1 succeeds * or fails before committing transaction2. * * The case which needs additional fail-over is the case in * which transaction 1 is committed successfully but transaction2 * fails. In this case a retry of transaction2 should be invoked * and must eventually succeed. * * For that reason, any code using this pattern should design the * logic so that the logic in the 2nd transaction can be consistent * on a longer timescale. * * @author nichole */ public class TwoOperationPseudoTransactionTest extends LocalDatastoreTestCase { private final Logger log = Logger.getLogger( this.getClass().getName()); private String iden1 = 1234567; private String iden2 = 1123456; // change to for tests final boolean commit1 = true; final boolean commit2 = false; public TwoOperationPseudoTransactionTest() { super(); } @Before public void setUp() throws Exception { super.setUp(); log.info(setUp); try { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); tx.begin(); UserGameCredits e1 = new UserGameCredits(iden1); pm.makePersistent(e1); pm.flush(); tx.commit(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); tx = pm2.currentTransaction(); tx.begin(); UserAccount e2 = new UserAccount(iden2); pm2.makePersistent(e2); pm2.flush(); tx.commit(); } catch (Throwable t) { String msg = t.getMessage(); } } @After public void tearDown() throws Exception { PersistenceManager pm = null; try { pm = PMF.get().getPersistenceManager(); Key key1 = UserGameCredits.createKey(iden1); UserGameCredits e1 = pm.getObjectById(UserGameCredits.class, key1); String var1 = e1.getVariable(); Key key2 = UserAccount.createKey(iden2); UserAccount e2 = pm.getObjectById(UserAccount.class, key2); String var2 = e2.getVariable(); log.info(var1= + var1); log.info(var2= + var2); if (commit1 commit2) { assertEquals(var1, updated); assertEquals(var2, updated); } else if (commit1 !commit2) { assertEquals(var1, updated); assertEquals(var2, ); } else { assertEquals(var1
[appengine-java] Re: How to ensure two entities are updated WITHOUT using transactions?
The answer to the nontransactionalread and write are below, but meanwhile, if you really do need those updates to be as close to atomic as possible, then you need them in the same entity group so they're co-located in the distributed file system. On Jul 18, 2:02 am, mscwd01 mscw...@gmail.com wrote: Thanks for the update. It's a pity you cant check to see if the first transaction committed before it leaves an active state, that'd make things so much easier. I really needed the two updates to occur as quickly as possible so relying on the second update to continue retying via the task queue, is not ideal. Would running the PersistenceManagerFactory with 'NontransactionalRead' and 'NontransactionalWrite' set to 'true' allow me to do what I want? I cant really find any documentation that describes what those two values do. Thanks again On Jul 17, 11:46 pm,Nicholenichole.k...@gmail.com wrote: Good point, I rewrote the code below to better use the available connections and improve the pattern. Regarding update 1 being committed and update 2 failing, the first is already committed, yes. I think one has to use a retry for the 2nd update (using the task queue structure) for the 2nd operation to eventually succeed, but on a longer timescale. Here's a better approach to the problem: import com.climbwithyourfeet.software.twotransaction.util.PMF; import com.google.appengine.api.datastore.Key; import java.util.ArrayList; import javax.jdo.Transaction; import javax.jdo.PersistenceManager; import java.util.logging.Logger; import com.google.appengine.tools.development.LocalDatastoreTestCase; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; /** Goal: * Update 2 entities which reside in 2 different entity groups. * The updates must both pass or both fail. * * Solution: * Use a different transaction for each entity, configurable in jdoconfig.xml. * (Note that it looks like 2 named PersistenceManagerFactory connections are possible, but not more than that, and there is only one transaction for a PMF connection). * * Solution is essentially check that transaction1 succeeds or fails before * committing transaction2. * * The case which needs additional fail-over is the case in which transaction 1 is committed successfully but transaction2 fails. * In this case a retry of transaction2 should be invoked and must eventually succeed. * * For that reason, any code using this pattern should design the logic so that the logic in the 2nd transaction can be consistent on a longer timescale. * * @authornichole */ public class TwoOperationPseudoTransactionTest extends LocalDatastoreTestCase { private final Logger log = Logger.getLogger(this.getClass().getName()); private String iden1 = 1234567; private String iden2 = 1123456; public TwoOperationPseudoTransactionTest() { super(); } @Before public void setUp() throws Exception { super.setUp(); try { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); tx.begin(); UserGameCredits e1 = new UserGameCredits(iden1); pm.makePersistent(e1); pm.flush(); tx.commit(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); tx = pm2.currentTransaction(); tx.begin(); UserAccount e2 = new UserAccount(iden2); pm2.makePersistent(e2); pm2.flush(); tx.commit(); } catch (Throwable t) { String msg = t.getMessage(); } } @After public void tearDown() throws Exception { super.tearDown(); } @Test public void test2() throws Exception { PersistenceManager pm = PMF.get().getPersistenceManager(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); final Transaction tx = pm.currentTransaction(); final Transaction tx2 = pm2.currentTransaction(); final ListBoolean completedOp1 = new ArrayListBoolean(); final ListBoolean completedOp2 = new ArrayListBoolean(); try { // change to for tests final boolean commit1 = true; final boolean commit2 = false; tx.setSynchronization(new javax.transaction.Synchronization() { public void beforeCompletion() { log.info(before transaction 1); } public void afterCompletion(int status) { switch (status) { case
[appengine-java] Re: How to ensure two entities are updated WITHOUT using transactions?
By the way, if you wanted vary your jdoconfig.xml settings knowing which are impl in appengine, here's a link to appengine datanucleus test code: http://code.google.com/p/datanucleus-appengine/source/browse/trunk/tests/META-INF/jdoconfig.xml?r=514spec=svn514 On Jul 18, 8:44 pm, Nichole nichole.k...@gmail.com wrote: The answer to the nontransactionalread and write are below, but meanwhile, if you really do need those updates to be as close to atomic as possible, then you need them in the same entity group so they're co-located in the distributed file system. On Jul 18, 2:02 am, mscwd01 mscw...@gmail.com wrote: Thanks for the update. It's a pity you cant check to see if the first transaction committed before it leaves an active state, that'd make things so much easier. I really needed the two updates to occur as quickly as possible so relying on the second update to continue retying via the task queue, is not ideal. Would running the PersistenceManagerFactory with 'NontransactionalRead' and 'NontransactionalWrite' set to 'true' allow me to do what I want? I cant really find any documentation that describes what those two values do. Thanks again On Jul 17, 11:46 pm,Nicholenichole.k...@gmail.com wrote: Good point, I rewrote the code below to better use the available connections and improve the pattern. Regarding update 1 being committed and update 2 failing, the first is already committed, yes. I think one has to use a retry for the 2nd update (using the task queue structure) for the 2nd operation to eventually succeed, but on a longer timescale. Here's a better approach to the problem: import com.climbwithyourfeet.software.twotransaction.util.PMF; import com.google.appengine.api.datastore.Key; import java.util.ArrayList; import javax.jdo.Transaction; import javax.jdo.PersistenceManager; import java.util.logging.Logger; import com.google.appengine.tools.development.LocalDatastoreTestCase; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; /** Goal: * Update 2 entities which reside in 2 different entity groups. * The updates must both pass or both fail. * * Solution: * Use a different transaction for each entity, configurable in jdoconfig.xml. * (Note that it looks like 2 named PersistenceManagerFactory connections are possible, but not more than that, and there is only one transaction for a PMF connection). * * Solution is essentially check that transaction1 succeeds or fails before * committing transaction2. * * The case which needs additional fail-over is the case in which transaction 1 is committed successfully but transaction2 fails. * In this case a retry of transaction2 should be invoked and must eventually succeed. * * For that reason, any code using this pattern should design the logic so that the logic in the 2nd transaction can be consistent on a longer timescale. * * @authornichole */ public class TwoOperationPseudoTransactionTest extends LocalDatastoreTestCase { private final Logger log = Logger.getLogger(this.getClass().getName()); private String iden1 = 1234567; private String iden2 = 1123456; public TwoOperationPseudoTransactionTest() { super(); } @Before public void setUp() throws Exception { super.setUp(); try { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); tx.begin(); UserGameCredits e1 = new UserGameCredits(iden1); pm.makePersistent(e1); pm.flush(); tx.commit(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); tx = pm2.currentTransaction(); tx.begin(); UserAccount e2 = new UserAccount(iden2); pm2.makePersistent(e2); pm2.flush(); tx.commit(); } catch (Throwable t) { String msg = t.getMessage(); } } @After public void tearDown() throws Exception { super.tearDown(); } @Test public void test2() throws Exception { PersistenceManager pm = PMF.get().getPersistenceManager(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); final Transaction tx = pm.currentTransaction(); final Transaction tx2 = pm2.currentTransaction(); final ListBoolean completedOp1 = new ArrayListBoolean(); final ListBoolean completedOp2 = new ArrayListBoolean(); try { // change to for tests final boolean
[appengine-java] Re: How to ensure two entities are updated WITHOUT using transactions?
Good point, I rewrote the code below to better use the available connections and improve the pattern. Regarding update 1 being committed and update 2 failing, the first is already committed, yes. I think one has to use a retry for the 2nd update (using the task queue structure) for the 2nd operation to eventually succeed, but on a longer timescale. Here's a better approach to the problem: import com.climbwithyourfeet.software.twotransaction.util.PMF; import com.google.appengine.api.datastore.Key; import java.util.ArrayList; import javax.jdo.Transaction; import javax.jdo.PersistenceManager; import java.util.logging.Logger; import com.google.appengine.tools.development.LocalDatastoreTestCase; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; /** Goal: * Update 2 entities which reside in 2 different entity groups. * The updates must both pass or both fail. * * Solution: * Use a different transaction for each entity, configurable in jdoconfig.xml. * (Note that it looks like 2 named PersistenceManagerFactory connections are possible, but not more than that, and there is only one transaction for a PMF connection). * * Solution is essentially check that transaction1 succeeds or fails before * committing transaction2. * * The case which needs additional fail-over is the case in which transaction 1 is committed successfully but transaction2 fails. * In this case a retry of transaction2 should be invoked and must eventually succeed. * * For that reason, any code using this pattern should design the logic so that the logic in the 2nd transaction can be consistent on a longer timescale. * * @author nichole */ public class TwoOperationPseudoTransactionTest extends LocalDatastoreTestCase { private final Logger log = Logger.getLogger(this.getClass().getName()); private String iden1 = 1234567; private String iden2 = 1123456; public TwoOperationPseudoTransactionTest() { super(); } @Before public void setUp() throws Exception { super.setUp(); try { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); tx.begin(); UserGameCredits e1 = new UserGameCredits(iden1); pm.makePersistent(e1); pm.flush(); tx.commit(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); tx = pm2.currentTransaction(); tx.begin(); UserAccount e2 = new UserAccount(iden2); pm2.makePersistent(e2); pm2.flush(); tx.commit(); } catch (Throwable t) { String msg = t.getMessage(); } } @After public void tearDown() throws Exception { super.tearDown(); } @Test public void test2() throws Exception { PersistenceManager pm = PMF.get().getPersistenceManager(); PersistenceManager pm2 = PMF.get2().getPersistenceManager(); final Transaction tx = pm.currentTransaction(); final Transaction tx2 = pm2.currentTransaction(); final ListBoolean completedOp1 = new ArrayListBoolean(); final ListBoolean completedOp2 = new ArrayListBoolean(); try { // change to for tests final boolean commit1 = true; final boolean commit2 = false; tx.setSynchronization(new javax.transaction.Synchronization() { public void beforeCompletion() { log.info(before transaction 1); } public void afterCompletion(int status) { switch (status) { case javax.transaction.Status.STATUS_MARKED_ROLLBACK : // fall through case javax.transaction.Status.STATUS_ROLLEDBACK : log.severe(rollback transaction 1); break; case javax.transaction.Status.STATUS_COMMITTED: log.info(committed transaction 1); completedOp1.add(Boolean.TRUE); break; case javax.transaction.Status.STATUS_UNKNOWN: // treat as rollback both? } } }); tx2.setSynchronization(new javax.transaction.Synchronization() { public void beforeCompletion() { log.info(before transaction 2); } public void afterCompletion(int status) { switch (status) { case javax.transaction.Status.STATUS_MARKED_ROLLBACK : // fall through case javax.transaction.Status.STATUS_ROLLEDBACK
[appengine-java] Re: How to ensure two entities are updated WITHOUT using transactions?
(); } } finally { if ((tx != null) tx.isActive()){ tx.rollback(); log.info(both operations failed. submitting retry); handleRetry(userGameCredits, userAccount); } else { if (!completedOp1.isEmpty() completedOp1.get(0).booleanValue()) { // TODO: if using task for userAccount update check completedOp2 and use new task API to see if it is listed, else start task here. if (!completedOp2.isEmpty() completedOp1.get(0).booleanValue()) { log.info(both operations succeeded); } } } if (pm != null) { pm.close(); } } } } On Jul 11, 3:41 pm, mscwd01 mscw...@gmail.com wrote: The try/catch/finally method seems better than the convoluted method mentioned in the blog. One question though, what is the success flag you mentioned? I'm confused as to how I can have two transactions in one try/catch and make sure both succeed. Maybe a quick code sample would help if you have the time. Thanks On Jul 11, 5:01 pm, Nichole nichole.k...@gmail.com wrote: I might add that you could add a try/catch/finally: use a transaction on the first operation in the try block that can be rolled back if a succeeded flag is false in the finally block; after the 2nd operation in the try block the succeeded gets set to true; and if you use the referred pattern in the blog above on the 2nd operation, you might want to include pre-conditions and the operation to be performed (in other words, if it's a banking operation, you want to know that you expected the amount to be x before you add y). On Jul 10, 9:15 pm, Didier Durand durand.did...@gmail.com wrote: Hi, Have a look at this to understand the issues:http://blog.notdot.net/2009/9/Distributed-Transactions-on-App-Engine regards didier On Jul 10, 11:09 pm, mscwd01 mscw...@gmail.com wrote: Hey I'm using JDO and need to update two entities both of which reside in their own entity group. As I cannot use a transaction, I'd like to determine how others achieve this. It is imperative that both entities are updated or none at all. 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: How to ensure two entities are updated WITHOUT using transactions?
Yes, you'll need to add structure to the entity update method or surrounding it to persist the state of the entity (and use real entities! The test structure is purely to provide runnable code to demonstrate one way to approach the problem). For the 2nd update, if you recently fetched or refreshed the entity and the persistenceManager is still open, then the entity is still attached and all you need to use is persistenceManager.flush() before you close it. It doesn't do harm, however, to use makePersistent(entity) if the entity isn't a detached transient instance and you certainly do want to use makePersistent(entity) if it is. And yes, the return value of makePersistent(entity) is a good check for the last operation being successful: the return value is the parameter instance for parameters in the transient or persistent state, or the corresponding persistent instance for detached parameter instances :) http://download.oracle.com/docs/cd/E13222_01/wls/docs103/kodo/jdo-javadoc/index.html?javax/jdo/JDOUserCallbackException.html On Jul 12, 7:20 am, mscwd01 mscw...@gmail.com wrote: One final question. In the afterCompletion method when the userAccount has the amount subtracted, would you call pm.makePersistent() on the userAccount object? If you don't it wouldn't persist the change made to the userAccount surely? If this is the case would you just look to see that the object returned by makePersistent is not null to ensure the update to userAccount was saved successfully? Thanks On Jul 12, 9:37 am, Nichole nichole.k...@gmail.com wrote: Here's an implementation. You might want to add checks for read staleness, and think about using a task structure for the operations to make retry easier. The unit test structure is from fromhttp://code.google.com/appengine/docs/java/howto/unittesting.html package com.climbwithyourfeet.events.dao; import java.util.ArrayList; import javax.jdo.Transaction; import javax.jdo.PersistenceManagerFactory; import javax.jdo.JDOHelper; import javax.jdo.PersistenceManager; import java.util.logging.Logger; import com.google.appengine.tools.development.LocalDatastoreTestCase; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; public class TwoOperationPseudoTransactionTest extends LocalDatastoreTestCase { private Logger log = Logger.getLogger(this.getClass().getName()); private UserGameCredits userGameCredits = new UserGameCredits(); private UserAccount userAccount = new UserAccount(); public TwoOperationPseudoTransactionTest() { super(); } @Before public void setUp() throws Exception { super.setUp(); } @After public void tearDown() throws Exception { super.tearDown(); } public class UserGameCredits { public boolean add(int credits) { return true; } } public class UserAccount { public double getBalance() { return 123456789.00; } public boolean add(int credits) { return true; } public boolean subtractAmount(double balance, double amount, long timestamp) { return true; } } private void handleRetry(UserGameCredits userGameCredits, UserAccount userAccount) { } @Test public void testCredits() throws Exception { /* * Goal: * Update 2 entities which reside in 2 different entity groups. * The updates must both pass or both fail. * * Example: * The updates are 2 operations wrapped in a try/catch/ finally block. * The entities are UserGameCredits and UserAccount and are in diff entity groups. * One transaction, the current transaction, is available for the application, * so only one transaction-wrapped-operation can be rolled back in the * finally clause if needed. * * GameCredits update has higher priority as the user may need to see * it immediately. The payment processing may take longer - so UserAccount consistency * can have slightly less priority. */ PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory(transactions-optional); PersistenceManager pm = null; Transaction tx = null; final ListBoolean completedOp1 = new ArrayListBoolean(); final ListBoolean completedOp2 = new ArrayListBoolean(); int credits = 10; final double cost = 1; final double accountBalance = userAccount.getBalance(); final long timestamp = System.currentTimeMillis(); try { // change to simulate pass or fail boolean
[appengine-java] Re: How to ensure two entities are updated WITHOUT using transactions?
I might add that you could add a try/catch/finally: use a transaction on the first operation in the try block that can be rolled back if a succeeded flag is false in the finally block; after the 2nd operation in the try block the succeeded gets set to true; and if you use the referred pattern in the blog above on the 2nd operation, you might want to include pre-conditions and the operation to be performed (in other words, if it's a banking operation, you want to know that you expected the amount to be x before you add y). On Jul 10, 9:15 pm, Didier Durand durand.did...@gmail.com wrote: Hi, Have a look at this to understand the issues:http://blog.notdot.net/2009/9/Distributed-Transactions-on-App-Engine regards didier On Jul 10, 11:09 pm, mscwd01 mscw...@gmail.com wrote: Hey I'm using JDO and need to update two entities both of which reside in their own entity group. As I cannot use a transaction, I'd like to determine how others achieve this. It is imperative that both entities are updated or none at all. 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: can i load web form and then submit it, after showing only form's captcha on screen?
I think I understood your question before your last addition: if you're wanting to add human verification, you might use the oddly named 'honeypot' :) On Jul 11, 1:11 am, Arvind Chari arvind.ik.ch...@gmail.com wrote: Hi Sorry for the late reply... I am trying to submit same/similar data to article directories, and I am still unable to devise a solution (either as desktop app or web app) that shows only captcha on screen, and then submits the form. The task is to submit articles to upto thousands of article directories. Regards, Arvind. On Jun 19, 7:10 am, Ikai Lan (Google) ika...@google.com wrote: Just out of curiosity, what is it that you are doing that presents a captcha with a form? Ikai Lan Developer Programs Engineer, Google App Engine Blog:http://googleappengine.blogspot.com Twitter:http://twitter.com/app_engine Reddit:http://www.reddit.com/r/appengine On Sun, Jun 19, 2011 at 4:35 AM, Stephen Johnson onepagewo...@gmail.comwrote: You can do it several ways. The best way IMHO is to show the form and the captcha together and they fill in the form fields and the captcha and submit both together. Or as your question implies, you want a two-step process for some reason where they fill in the form and then you show a different page with just the captcha. Not sure why you want to do this, but in this scenario when they submit the form, you can send the captcha page back to them with the form fields as hidden fields. Then when captcha is submitted, then both form fields and captcha info is submitted together. Another alternative is to store the submitted form values into the session object on first submit, then show captcha page and when they have submitted captcha successfully, you can process the form data. Stephen On Wed, Jun 15, 2011 at 8:30 PM, Arvind Chari arvind.ik.ch...@gmail.com wrote: Hello I want to automate the submission of repetitive data to multiple web forms... I already have with me details of all fields that have to be filled in on a web form. What I want to do is, initially ask the user for values of various fields, and at time of submission show only captcha of form on screen. Now, when end user fills in the captcha, then the form (along with other fields filled in by the application) is submitted successfully. Can i do this in Google App Engine (either Java or Python or any of the other supported languages)? Regards, Arvind. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/ftxQm2I3P5EJ. 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. -- 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. -- 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: email in yahoo junk - amazon ses
It sounds like your main goal is to send email that does not get flagged by Yahoo's spam filter. The links you included had a discussion about key security added to google apps for business that signs your email and allows Yahoo spam filter service to check the public key w/ your DNS mx records. A quick further browse suggests that such features of google apps for business may be available to appengine in a near future release. The error you see below is because you are attempting to establish a socket connection (as an email client) to your other email server. On appengine, you don't have permission to open a socket (excepting http/https requests or Channel client socket connections). On Jul 8, 4:11 pm, pac parvez.chau...@gmail.com wrote: I was also trying to contact yahoo, they get back to me and asked me to do few things but I don't have access to do those , may be some body from google can do this i.e. Thank you for writing to Yahoo! Mail. To further troubleshoot the issue, please send a test email (from the affected server/IP) via a telnet session to see if you can recreate the problem. The URL below describes how you can do a manual telnet test. Please telnet to this host a.mx.mail.yahoo.com (i.e., telnet a.mx.mail.yahoo.com 25). http://www.spamsoap.com/how-to-manually-send-an-email-message-via-tel... Once you've followed the steps, please send us the transcript of the telnet session when you reply to this email. For assistance with delivery issues to Yahoo! Mail, please visit: http://help.yahoo.com/l/us/yahoo/mail/postmaster/ Please let us know if you need any assistance, so we may assist you further. Your patience is greatly appreciated. Thank you again for contacting Yahoo! Mail. I think ip address in that email case was X-Originating-IP: [209.85.216.205] but I guess that could be any e.g. 74.125.79.27 74.125.53.27 209.85.143.27 74.125.43.27 72.14.213.27 209.85.229.27 74.125.157.27 On Jul 8, 11:55 pm, pac parvez.chau...@gmail.com wrote: Is it possible to use amazon SES to send emails? Emails sent by application are going in yahoo's junk folder. My application hardly send few emails per day. Just looking various posts:http://code.google.com/appengine/forum/?place=topic%2Fgoogle-appengin... It looks that people have used amazon SES with success. But I am unable to make it work in java, on connect I get error Transport t = new AWSJavaMailTransport(session, null); t.connect(); Caused by: java.lang.NoClassDefFoundError: javax.net.ssl.KeyManagerFactory is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime .java: 51) at org.apache.http.conn.ssl.SSLSocketFactory.createSSLContext(SSLSocketFactory .java: 184) at org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(SSLSocket Factory.java: 209) Any suggestions to solve this email issue. 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: Failed to compile jsp files.
Looks like an error in your jsp file. On Jul 3, 8:12 am, ~Juli~ yoolc...@gmail.com wrote: Hi all! I faced with probem that i couldn't update war because jsp compilation failed. --- An error occurred at line: -1 in the generated java file extension dir=C:\Program Files\Java\jdk1.6.0_26\jre\lib\ext;C: \WINDOWS\Sun\J ava\lib\ext srcDir=C:\DOCUME~1\Admin\LOCALS~1\Temp \appcfg6421727645217272141.tmp\WEB-INF \classes compiler=extJavac compilerTargetVM=1.5 compilerSourceVM=1.5 include=org/apache/jsp/jsp/static_/pageHeader_jsp.java Stacktrace: at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErro rHandler.java:92) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher .java:330) at org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java :255) at org.apache.jasper.compiler.Compiler.compile(Compiler.java: 349) at org.apache.jasper.JspC.processFile(JspC.java:1192) at org.apache.jasper.JspC.execute(JspC.java:1341) at com.google.appengine.tools.development.LocalJspC.main(LocalJspC.java: 18) Error while executing: C:\Program Files\Java\jdk1.6.0_26\jre\bin \java.exe -class path /C:/appengine-java-sdk-1.5.1/lib/impl/appengine-api-labs.jar;/C:/ appengine- java-sdk-1.5.1/lib/impl/appengine-api-stubs.jar;/C:/appengine-java- sdk-1.5.1/lib /impl/appengine-api.jar;/C:/appengine-java-sdk-1.5.1/lib/impl/ appengine-local-ru --- I read more topics about this problem, but all this topics didn't help me.I understand that problem is that jre used instead of jdk. As written:http://code.google.com/p/googleappengine/issues/detail?id=1226http://groups.google.com/group/google-appengine-java/browse_thread/th... i tried: 1. Copy tools.jar into the AppEngine lib/shared directory from jdk/ lib. 2. Modify appcfg.cmd so it fully-qualifies the reference to java.exe in the JDK/bin directory. So now my appcfg.cm looks like C:\Program Files\Java\jdk1.6.0_26\bin\java -cp %~dp0\..\lib\appengine-tools- api.jar com.google.appengine.tools.admin.AppCfg %* 3. My JAVA_HOME=C:\Program Files\Java\jdk1.6.0_26 But problem is still exist... And i also didn't understand why if i changed the appcfg.cmd and forse set the path to the java - why it still try to use jre (Error while executing: C:\Program Files\Java \jdk1.6.0_26\jre\bin\java.exe -class path)?? What i have to do? Thank you. -- 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: How can I make sure a Collection of child classes gets fetched in a query?
http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html#Owned_One_to_Many_Relationships entity groups and mappedBy in your parent class. On Jul 2, 1:39 pm, ksafez216 mell...@gmail.com wrote: After I get a Command object using PersistenceManager.getObjectById(), and then try to access the ArrayListAction member variable (see code below) I get this error: The datastore does not support joins and therefore cannot honor requests to place related objects in the default fetch group. The field will be fetched lazily on first access. You can modify this warning by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config. A value of NONE will silence the warning. A value of ERROR will turn the warning into an exception. My question is: how can I make sure that the actions variable below is fetched every time I do a query for Command entities? Here is my code: @PersistenceCapable public class Command { @Persistent(defaultFetchGroup=true) public ArrayListAction actions; } @PersistenceCapable class Action { Action() { } } -- 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: Scalability of inequality filters for multiple fields via Hilbert curve
Since you're working with data that is presumably in entities, your fields such as long or date at any given time aren't continuous, so the algorithm to group by features should work. 'Any given time' here is the time that you actually start to write your entities that are to be your HilbertIndex entities, for example. Pre-preparing finer grained search result Indexes in this way would be a service that you write. The HilbertIndex entities could contain either keys to the entities in that range or fields derived from them. On Jul 4, 6:44 am, Max thebb...@gmail.com wrote: Hi all, Would like to know if there are any of you guys ever tried to use space filling curve like Hilbert curve to build index for multiple inequality filters. Seems like for any continuous field like long or date, the number of ranges (to be merged) to perform a accurate query is increasing rapidly, which makes this approach not scale. Any thought? or shall I build / model like this samplehttp://code.google.com/appengine/articles/geosearch.html app? Query by partitions of all data and do an in-memory merge? -- 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: Facebook Federated Login
Or use OpenAuth instead? On Jul 5, 10:33 pm, Shash Joshi sh...@perfode.com wrote: I have used it, and it works great! -- 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: Changing datastore property type
The quickest solution might be to wrap your entity fetch in a try/ catch (Throwable t) block. Throwable will catch a runtime exception. Upon the expected exception, use the alternate variable type to try another fetch. On Jul 6, 1:34 pm, Jeff Schnitzer j...@infohazard.org wrote: On Wed, Jul 6, 2011 at 12:56 PM, jMotta jayrmo...@gmail.com wrote: * * *Jeff*, You've said: Objectify will let you change the field type to a String and do the right thing out of the box., how? I know that's possible through @AlsoLoad annotation to override the default behavior of binding properties based on the member name. But what I understood about his need is that actually he have entities whose the property names are equals but with different object types as values. So, the only class shared in the String vs Long hierarchy will be Object. The conversion process will merrily convert just about anything to a String. So going from Long - String is easy. The other way 'round, you would need to use the @AlsoLoad mechanism. Jeff -- 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: Changing datastore property type
To update your existing entities to the new entity schema, you would need to rewrite your existing entities (create new w/ same fields and delete old). To find the existing older entities, you could use the low level API (DatastoreService) to fetch Entity instances for your entity Kind and then use getProperty(java.lang.String propertyName) to return an Object which you would check the instanceOf, and then create the new, delete, etc... Note that you could do this on a need only basis, that is as each older entity is fetched. FetchOptions fetchOptions = FetchOptions.Builder.withDefaults(); QueryResultListEntity results = datastore.prepare(yourQuery).asQueryResultList(fetchOptions); for (Entity entity : results) { Object cf = entity.getProperty(ID); if (cf instanceOf Integer) { ... } } On Jul 7, 8:40 pm, Jamie ja...@mapstagram.com wrote: I am indeed using JDO so I'm kinda bummed that a simple schema change like this is causing problems. Haven't used Objectify before but it sounds like it might do what I need. I'm simply changing the type of a field/property (not part of the key) from Integer to String. The issue is I have a LOT of existing entries, so I need to figure out the best way to store new entities using String for that property, but still be able to read old entities that have that value stored as an Integer. Sounds like Objectify might be my only choice? I had another idea which involved using a new property with type String. That way, new entities would have the new property filled, while old entities would have the original property filled. The application code would need to handle this. Kinda ugly and hackish though. On Jul 6, 4:34 pm, Jeff Schnitzer j...@infohazard.org wrote: On Wed, Jul 6, 2011 at 12:56 PM, jMotta jayrmo...@gmail.com wrote: * * *Jeff*, You've said: Objectify will let you change the field type to a String and do the right thing out of the box., how? I know that's possible through @AlsoLoad annotation to override the default behavior of binding properties based on the member name. But what I understood about his need is that actually he have entities whose the property names are equals but with different object types as values. So, the only class shared in the String vs Long hierarchy will be Object. The conversion process will merrily convert just about anything to a String. So going from Long - String is easy. The other way 'round, you would need to use the @AlsoLoad mechanism. Jeff -- 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: JDO: 1-N relationships
Just to add to objectuser, you definitely need to use entity groups to retrieve all entity types within a transaction if you use the model you're both describing. You might want to consider a change in your model though to move the most updated fields in User to a new and different entity, freeing you from needing to retrieve Track and User for those updates. From your description that new entity is found with name fields that are the same fields as in the User and Track entities. This is 2nd normal form in terms of a database model... On Jun 25, 9:33 am, objectuser kevin.k.le...@gmail.com wrote: As long as both the user and tracks are in the same entity group, you can do just that. Whether that's a good idea or not depends on how those users and tracks will be used. If only one user is going to be messing with the tracks, then you should be fine. If many users need to update those tracks, then you will have a lot of contention on that entity group. This is all because only one transaction can update an entity group at a time. On Jun 24, 2:47 am, Martin Newstead skankmar...@hotmail.com wrote: I would like some help and advice on how to model my entities using JDO on GAE. My problem is this, I have a bunch of Users and each User may create zero or more Tracks. Users may exist without a Track but Tracks may not exist without a User who created them. Other attributes on the User and the Track may updated. I would like to be able to query the Tracks and retrieve some attributes from the User who created the Track. The attributes from the User may get updated. In SQL this would be select u.displayName, t.trackName from User u, Track t, where t.userId=u.userId I have some ideas and have tried various things but this isn't a post on why doesn't something work, more of what is the best practice to solve this problem. thanks M -- 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: Lots of 500 errors
Hi Hector, The apache commons http client isn't loaded by the appengine classloader now. It's included in a repackaged form for use in testing in appengine-api-stubs.jar, but shouldn't be included in the deployment. Any 3rd party library using that class will have the same problem. You can replace it with javax.net.HttpURLConnection or the appengine's low level api URLFetchService. On Jun 6, 1:28 pm, hector@ISB hrovira@gmail.com wrote: My appspot (addama-systemsbiology.appspot.com) is getting lots of 500 errors today. I haven't deployed any changes in a while. 2011-06-06 13:05:36.158 */addama/registry/mappings/tools/vera-sam-pipeline*500 11985ms 0cpu_ms 0kb Jakarta Commons-HttpClient/3.1,gzip(gfe) 209.124.189.39 - - [06/Jun/2011:13:05:36 -0700] POST /addama/registry/mappings/tools/vera-sam-pipeline HTTP/1.1 500 0 - Jakarta Commons-HttpClient/3.1,gzip(gfe) ms=11986 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.54 *W *2011-06-06 13:05:36.158 Request was aborted after waiting too long to attempt to service your request. This may happen sporadically when the App Engine serving cluster is under unexpectedly high or uneven load. If you see this message frequently, please contact the App Engine team. -- 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: Problem deleting an entity which has a dependent Set Entity
You might want to use @Persistent(mappedBy = parent) for your Parent entity declaration in your Child entity. Owned one-to-many http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html#Owned_One_to_Many_Relationships On Jun 5, 9:27 pm, Didier Durand durand.did...@gmail.com wrote: Hi, As a workaround, why don't you delete each entity in the set in a loop by yourself before deleting the entity which the set is part of ? regards didier On Jun 6, 1:48 am, mscwd01 mscw...@gmail.com wrote: Hey, I have a parent entity which has a Set of child entities, as follows: class Parent { @Persistent @Element(dependent = true) private SetChild children; } When I delete the Parent entity I get the following exception: javax.jdo.JDOUserException: Cannot read fields from a deleted object FailedObject:com.google.appengine.api.datastore.Key:Parent(100034534545656 7676)/ Child(2) It seems JDO deletes the Parent entity before the Child objects in the dependent Set property, which causes the above exception to appear when the Child entities in the Set are themselves deleted. Does anyone know how to solve this issue? FYI when I delete the parent entity I use pm.deletePersistent() within a transaction. 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: Problem deleting an entity which has a dependent Set Entity
Just a quick addition: you actually have something in between an owned and unowned one-to-many because you're holding on to object references to your many. The unowned one-to-many would use SetKey childrenKeys, for example. On Jun 6, 2:38 am, mscwd01 mscw...@gmail.com wrote: To add to my last comment I could do: pm.deletePersistentAll(children) to delete all Child objects in the Parents children Set, however as the method deletePersistentAll has a void return type how do you ensure all Child objects have been deleted before I delete the Parent entity? On Jun 6, 10:12 am, mscwd01 mscw...@gmail.com wrote: Thanks for the replies. @Didier - I have considered this, and I guess I will have to manually delete each entity if I cant find a more elegant solution, however going by what the documentation says it should just work. I'd like to find out why this exception is occurring if possible. @Nichole - I currently have an unowned one to many relationship and don't really need an owned one, having said that could this make a difference? I will have to try and see when I get time. Thanks again On Jun 6, 5:27 am, Didier Durand durand.did...@gmail.com wrote: Hi, As a workaround, why don't you delete each entity in the set in a loop by yourself before deleting the entity which the set is part of ? regards didier On Jun 6, 1:48 am, mscwd01 mscw...@gmail.com wrote: Hey, I have a parent entity which has a Set of child entities, as follows: class Parent { @Persistent @Element(dependent = true) private SetChild children; } When I delete the Parent entity I get the following exception: javax.jdo.JDOUserException: Cannot read fields from a deleted object FailedObject:com.google.appengine.api.datastore.Key:Parent(100034534545656 7676)/ Child(2) It seems JDO deletes the Parent entity before the Child objects in the dependent Set property, which causes the above exception to appear when the Child entities in the Set are themselves deleted. Does anyone know how to solve this issue? FYI when I delete the parent entity I use pm.deletePersistent() within a transaction. 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: simple request (change localhost for debug app engine server to my local ip)
In your appengine directory there's a file called config/user/ant- macros.xml that accepts --address and --port as arguments for dev_appserver, but you have to include the file into your own build.xml. Instructions are at the top of the file. On Jun 3, 8:06 pm, Bourke Floyd IV chb...@gmail.com wrote: I want to change localhost to an ip. I know the flag is -a or -address for the dev_appserver.sh (Java) but I'm running the Android/AppEngine Task demo and the arguments passed into the debug config are for GWT not the previous shell script. Thus I get Unknown argument: -a Google Web Toolkit 2.4.0beta DevMode [-noserver] [-port port-number | auto] [-whitelist whitelist- string] [-blacklist blacklist-string] [-logdir directory] [-logLevel level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort port-number | auto] [-server servletContainerLauncher[:args]] [- startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-workDir dir] module[s] where -noserver Prevents the embedded web server from running -port Specifies the TCP port for the embedded web server (defaults to ) -whitelist Allows the user to browse URLs that match the specified regexes (comma or space separated) -blacklist Prevents the user browsing URLs that match the specified regexes (comma or space separated) -logdir Logs to a file in the given directory, as well as graphically -logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL -gen Debugging: causes normally-transient generated types to be saved in the specified directory -bindAddress Specifies the bind address for the code server and web server (defaults to 127.0.0.1) -codeServerPort Specifies the TCP port for the code server (defaults to 9997) -server Specify a different embedded web server to run (must implement ServletContainerLauncher) -startupUrl Automatically launches the specified URL -war The directory into which deployable output files will be written (defaults to 'war') -deploy The directory into which deployable but not servable output files will be written (defaults to 'WEB-INF/deploy' under the -war directory/jar, and may be the same as the -extra directory/jar) -extra The directory into which extra files, not intended for deployment, will be written -workDir The compiler's working directory for internal use (must be writeable; defaults to a system temp dir) and module[s] Specifies the name(s) of the module(s) to host The app engine server part of the debug config window only lets me change the port, not the address. Where can i change 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: Can't create application - SMS says account already verified
Google Voice? On Jun 3, 3:01 pm, Ronoaldo José de Lana Pereira rpere...@beneficiofacil.com.br wrote: Sorry Joe, I don't know if you can unregister your phone number. I didn't found this kind of option. Ikai, any tips? -- 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: Application Title available?
You could parse your xml file or parse the System variable called user.dir. On Jun 3, 2:46 am, Marcel Overdijk marceloverd...@gmail.com wrote: Is the Application title accessible using the SDK? I guess not, but Maybe Google can make in available in the Environment class. -- 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: Application Title available?
Make that System.getProperty(com.google.appengine.application.id) instead... no parsing On Jun 3, 9:53 pm, Nichole nichole.k...@gmail.com wrote: You could parse your xml file or parse the System variable called user.dir. On Jun 3, 2:46 am, Marcel Overdijk marceloverd...@gmail.com wrote: Is the Application title accessible using the SDK? I guess not, but Maybe Google can make in available in the Environment class. -- 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: Checking if I understand transactions correctly
I think you might be a little confused about the difference between appengine's transaction in a distributed environment and an enterprise 2-phase transaction in a more classic client server architecture? appengine uses a distributed datastore, so entities are stored all over the place by default. In order to ensure that operations on your entities occur with anything like atomicity all the entities have to be co-located, that is stored near one another in the datastore. That means that they need to be in the same entity group (which means when you make your keys, they have to have the same parent = ancestor). The appengine transaction is for use when your entities are in the same entity group. Once you get that correct, you'll see that rollback is executed if the transaction doesn't finish in the correct state. I've been thinking about the banking use case with a distributed datastore for a little while, and I think that if appengine were to offer a low-level api for increment or decrement operations on primitives that behind the scenes did not use full ORM, but rather operate on the file in place, that might be helpful... When we fetch an entity and operate on it, *if* the 'updates' occur out of order such as can happen during high frequency updates, we have a total that isn't what's expected. The work arounds for this could be several, including [you] designing history entities that store the timestamp and operation to be performed and a reference to the entity to be performed on. Then writing a service that waits a short while then processes those 'operation entities' will leave your datastore in a consistent state. Note that appengine is using similar but more complex logic in its persistence of entities already, but here you programmatically decide the time frame for consistency and that timeframe has to be longer that of the appengine's distributed datastore consistency. That was a little long winded, but I think if you're going to use this framework for bank-type operations then you want to think about how to assure consistency on timescales for your datastore, and then on timescales for your client. The solution for client consistency often uses memcache... Hope that's helpful. On May 31, 10:52 pm, Lars Borup Jensen lbor...@gmail.com wrote: Huh? As you are only able to do work in a single transactional unit-of-work on a single entity-group, rollback must be considered usefull. In the above mentioned snippet, an Account entity is looked-up, updated and a child entity TransactionRecord is added, all in a single entity-group, namely the Account's. So a rollback will undo all operations. If you had added TransactionRecord to, lets say a TransactionRecords entity-group, you would have gotten an error if you were operating in a transactional scope, or no-transaction support at all, hence a rollback would not have been possible. Cheers, Lars Borup Jensen On 1 Jun., 06:21, Didier Durand durand.did...@gmail.com wrote: Hi, entity group is not useful at rollback but rather limits you to which updates you can do: all the entities you touch in a single transaction must be in the same entity group. So, designing your groups properly is a key design issue in GAE to avoid unnecessary complexity when you later need to update at once entities that you created before in various groups. regards didier On May 30, 7:57 am, Jacob jacob.rho...@gmail.com wrote: I am writing some code that needs to do a rollback on a secondary object/table should the transaction fail, I believe this can be done via entity groups, however I am not sure if this is how it would be implemented. I have written some sample code to check if what I would be doing is correct? Would the following code ensure the Account object is never updated if the insert of the TransactionRecord object fails. public void addTransaction(String account, Double value, String description, Date date) throws EntityNotFoundException { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); int retries = 3; while (true) { Transaction txn = datastore.beginTransaction(); try { // Update the bank balance Key key = KeyFactory.createKey(Account, account); Entity e = datastore.get(key); Double balance = (Double) e.getProperty(balance); balance += value; e.setProperty(balance, value); datastore.put(e); // Record transaction details Entity d = new Entity(TransactionRecord, key);
[appengine-java] Re: Is Google planning to offer HR datastore migration feature
googling outside the list turns up a few examples: http://googleappengine.blogspot.com/2011/03/high-replication-datastore-solid-choice.html On May 31, 1:26 pm, Ian Marshall ianmarshall...@gmail.com wrote: I too can make do with cleaning all my datastore data for the transition, so that's good. What you you mean, Marcel, by alias your old application id? On May 31, 8:25 am, Marcel Overdijk marceloverd...@gmail.com wrote: I think there is an option to alias your old application id. So maybe that's option for you? From my perspective all data can be cleaned in my apps, so just switching would be sufficient... doesn't sound that hard? On May 31, 9:10 am, Ian Marshall ianmarshall...@gmail.com wrote: I would like to do this too. The priority for me is to preserve my application ID during this migration. My understanding is that it is impossible for an existing app to switch from M/S to HR; a new app ID must be used. (I would love it if my understanding is incorrect.) On May 30, 12:02 pm, Marcel Overdijk marceloverd...@gmail.com wrote: I would like to switch from M/S datastore to HR datastore, buut how should I do this? Is Google planning to offer HR datastore migration feature? -- 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: NoSuchFieldError: deferredExpression - JSTL library conflict
Appengine uses servlet spec 2.4 so the compatible jstl library is version 1.1. the jsp library is version 2.0. You compile w/ those locally, and yes, they are provided by the container for production deployment so you don't include them in your war file/directory. If your custom tag is uniquely identified, that is not replacing an existing class in the jstl library then it will be found by the class loader. (However, if it contains classes which are not white-listed, the resolved classes won't be loaded.. ). On May 31, 8:25 am, Brian br...@draftpik.com wrote: Hello, I am trying to track down a very obscure issue in GAE/J. I have my own custom ForEachTag that I've written that extends from JSTL 1.2's org.apache.taglibs.standard.tag.rt.core.ForEachTag. Obviously, in order to compile my app, I need to compile with the jstl-1.2.jar. Compilation and execution in my local GAE dev environment works just fine. I've noticed, however, that when I deploy to GAE/J, I get a java.lang.NoSuchFieldError: deferredExpression during the call to release() at: at org.apache.taglibs.standard.tag.common.core.ForEachSupport.release(ForEachS upport.java:178) I've found that the only way to work around this issue is to exclude the jstl-1.2.jar from my exploded/WEB-INF/lib directory before deploying to GAE. Based on my reading, it seems that Jetty possibly includes JSTL 1.2 bundled in its libs? This particular deferredExpression issue seems to happen to people when there are multiple, conflicting JSTL libraries in the classpath. I have found one other very confusing element to this situation. I have a second version of my web application currently deployed to GAE/J. It works just fine, even when executing the identical JSP! Only one of my two apps has this particular issue. My question is two-fold: 1) Are there environmental differences between different app instances on GAE/J? Is it possible that some apps use one servlet container while other apps use a different servlet container? If Jetty is the culprit, are there others running perhaps Tomcat, which is why the issue only affects one, but not both of my apps? 2) How can I fix this issue? :) Ideally, I should be able to deploy my webapp with the jstl-1.2.jar included. In order to deploy without it, I have to manually remove it from the WEB-INF/lib directory prior to deployment. I really don't think this should be necessary (especially considering that it actually does work on a separate app). Really hoping there is a good solution here without needing to impact my current deployment procedure (which is basically just a build deploy via IntelliJ IDEA). Anecdotal site point relating to question #1: I have found that some app instances I have are particularly slow, even with Always On enabled. Is this possibly an artifact of different environments/servlet containers between apps? Is there any way to configure this behavior? If I could get some more background on the environment(s) used in GAE/J, perhaps it would help me understand this problem better and have a better idea of how to solve it. Thanks in advance for any assistance you can provide!! Brian -- 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: Checking if I understand transactions correctly
I didn't look at your snippet in detail, but you need transactions, and that means the entities need to be in the same entity group, that is have same ancestor. On May 31, 2:53 am, pavb pavieillardba...@gmail.com wrote: Hi, Yes all the datastore insert, update, delete done in the transaction are canceled by the rollback operation. The put of your updated Account is validated only if the transaction commit is done succesfully. PA On 30 mai, 07:57, Jacob jacob.rho...@gmail.com wrote: I am writing some code that needs to do a rollback on a secondary object/table should the transaction fail, I believe this can be done via entity groups, however I am not sure if this is how it would be implemented. I have written some sample code to check if what I would be doing is correct? Would the following code ensure the Account object is never updated if the insert of the TransactionRecord object fails. public void addTransaction(String account, Double value, String description, Date date) throws EntityNotFoundException { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); int retries = 3; while (true) { Transaction txn = datastore.beginTransaction(); try { // Update the bank balance Key key = KeyFactory.createKey(Account, account); Entity e = datastore.get(key); Double balance = (Double) e.getProperty(balance); balance += value; e.setProperty(balance, value); datastore.put(e); // Record transaction details Entity d = new Entity(TransactionRecord, key); d.setProperty(account_key, key); d.setProperty(date, date); d.setProperty(value, value); d.setProperty(description, description); txn.commit(); break; } catch (ConcurrentModificationException e) { if (retries == 0) throw e; --retries; } finally { if (txn.isActive()) txn.rollback(); } } } Thanks for any feedback! -- 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: Would the following create problems for me in Google app engine?
Adding to Ian's suggesting, you might want to look at Query Cursors and pre-prepare reports ahead of time... or pre-prepare reports iteratively, compress, store as blob and download... On May 31, 1:24 pm, Ian Marshall ianmarshall...@gmail.com wrote: You can reduce time-out issues if you paginate your query by obtaining contiguous chunks, one at a time. A lot depends on your data exchange interface. I use JDO, and GAE/J makes query cursors available for this. I don't know how other interfaces allow cursor/pagination operations. (Twig and Objectify have good reputations.) You can use deferred tasks to break work up into smaller chunks. I haven't looked at MapReduce. This might help you too? Does this help? On May 30, 7:13 am, Jacob jacob.rho...@gmail.com wrote: I have a Java application that has approximately 100 users. In this application there is a table that would have the equivalent of 100,000 entities added per day, ie 100 users each doing 1000 inserts per day. From time to time I will need to output a CSV file that shows one months worth of entries for a particular user, ie would result in a file with 30,000 entries. If I understand correctly, The entities would be given an anscestor record to allow querying the transactions by user, and then filter them by month. Am I going to have timeout issues with querying by user+month, and for in the case where I need to export a month's worth of data? Any feedback much appreciated! -- 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: open source pdf engine for GAE
Hi Vik, This should be possible with appengine and Google Docs, but it may not be easy. For any Google account you have 1GB of Google Docs usage free and additional storage is $0.25 per GB, so you could be creative with storing files (securely) and or moving them to other backup. Here's how it could be done: For 'creating a PDF' you would actually create or edit a Google Docs document on the fly and keep that stored in Google Docs. (Google Documents List API... Creating a permanent generic version of the document and making a copy and editing the copy on the fly would be easiest.) In the email to the donor, you would give them a url that they will use to download the file as a pdf. That url for the pdf would not be the Google Docs url, but would be a url to your appengine application. That specific delivery url would have to not use Google authentication (though the rest of your urls would continue to). For that delivery url, you would have to implement your own programatic authentication and authorization for that delivery url and supply donor specific auth/ auth to the donor in an easy to use manner. Behind the scenes in your app: Since your application is already authenticated with Google and authorized to access your Google Docs, you would read the PDF export stream directly into the response stream to the donor. A brief look at the Google Documents List API suggests that that's possible, but I haven't tried it. Cheers, Nichole On May 29, 9:07 pm, Vik vik@gmail.com wrote: Hie Nichole My use case is different. We are a non profit and our systems wants to implement a automatic appreciation certification mailing facility to the blood donor after blood donation. So, I need to create the pdf certificate on the fly and email it to the blood donor. So the google docs approach wont help us. Thankx and Regards Vik Founderhttp://www.sakshum.orghttp://blog.sakshum.org On Mon, May 30, 2011 at 9:20 AM, Nichole nichole.k...@gmail.com wrote: I haven't tried this programmatically, but you can export a Google Docs document in pdf format. If it's useful to store your files or a generic version of the file which you can copy and specialize as a Google Doc, then export as pdf might be a good way to create a PDF file. I'd be interested in hearing how well that works for you if you do implement it. On May 20, 10:42 am, Vik vik@gmail.com wrote: any further advise on this please? Thankx and Regards Vik Founderhttp://www.sakshum.orghttp://blog.sakshum.org On Wed, May 18, 2011 at 12:03 PM, Vik vik@gmail.com wrote: Hie Even below code fails for the same exception ByteArrayOutputStream out = new ByteArrayOutputStream(); PDF pdf; try { pdf = new PDF(out); log.info(#1); pdf.setTitle(Using TextColumn and Paragraph classes); pdf.setSubject(Examples); pdf.setAuthor(Innovatics Inc.); log.info(#2); Page page = new Page(pdf, Letter.PORTRAIT); pdf.flush(); Multipart mp = new MimeMultipart(); MimeBodyPart htmlPart = new MimeBodyPart(); htmlPart.setFileName(whatever.pdf); log.info(#7); htmlPart.setContent(out.toByteArray(), application/pdf); mp.addBodyPart(htmlPart); log.info(#8); Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); Message msg = new MimeMessage(session); msg.setContent(mp); msg.setFrom(new InternetAddress(vik@gmail.com)); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(vik@gmail.com)); msg.setSubject(testing PDF system); Transport.send(msg); Thankx and Regards Vik Founder http://www.sakshum.org http://blog.sakshum.org On Wed, May 18, 2011 at 10:25 AM, Stephen Johnson onepagewo...@gmail.comwrote: Try not adding the image or the font. Just try to get as simple a PDF working as possible. On Tue, May 17, 2011 at 9:47 PM, Vik vik@gmail.com wrote: Hie I am doing exact same. Here is the code: log.info(start of PDFTest:); //OutputStream out = resp.getOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); PDF pdf; try { pdf = new PDF(out); log.info(#1); pdf.setTitle(Using TextColumn and Paragraph classes); pdf.setSubject(Examples); pdf.setAuthor(Innovatics Inc.); log.info(#2); String fileName = images/share_facebook.png; Image image1 = new Image(pdf, new BufferedInputStream( getClass().getResourceAsStream(fileName)), ImageType.PNG); log.info(#3
[appengine-java] servlet filter and static pages
Hello, Static pages within appengine are not picked up by the servlet filters. Are there plans to change that? Thanks for your time, Nichole -- 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: open source pdf engine for GAE
, new InternetAddress(vik@gmail.com)); msg.setSubject(testing PDF system); Transport.send(msg); System.out.println(Sucessfully Sent mail to All Users); Thankx and Regards Vik Founder http://www.sakshum.org http://blog.sakshum.org On Tue, May 17, 2011 at 9:30 PM, Stephen Johnson onepagewo...@gmail.com wrote: Vik, Post your code where you're creating the ByteArrayOutputStream and creating the PDF with it. It'll be more helpful then what you've posted. I'm a little concerned you still don't have this part correct since you're still using out as a variable name. You're code should be similar to: ByteArrayOutputStream baos = new ByteArrayOutputStream(); /* this part is from your previous email. I don't use PDFJet so I can't validate this code for you */ PDF pdf = new PDF(baos); some actual writing. pdf.flush(); /* taken from docs */ Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); String msgBody = ...; try { Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(ad...@example.com, Example.com Admin)); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(u...@example.com, Mr. User)); msg.setSubject(Your Example.com account has been activated); msg.setText(msgBody); Multipart mp = new MimeMultipart(); // Get the PDF data byte[] attachmentData = baos.toByteArray(); MimeBodyPart attachment = new MimeBodyPart(); attachment.setFileName(manual.pdf); attachment.setContent(attachmentData, application/pdf); mp.addBodyPart(attachment); message.setContent(mp); Transport.send(msg); } catch (AddressException e) { // .. } catch (MessagingException e) { // ... } On Tue, May 17, 2011 at 6:19 AM, Vik vik@gmail.com wrote: I think the problem is not with pdfJet it about sending pdf as an attachment via mail api on app engine Thankx and Regards Vik Founder http://www.sakshum.org http://blog.sakshum.org On Tue, May 17, 2011 at 6:45 PM, Nichole nichole.k...@gmail.com wrote: You could try iText: http://groups.google.com/group/google-appengine-java/browse_thread/th... http://code.google.com/appengine/docs/java/mail/usingjavamail.html On May 16, 7:11 pm, Vik vik@gmail.com wrote: Hie Trying to send a pdf created using pdfJet throws the exception class javax.mail.SendFailedException:Send failure (javax.mail.MessagingException: Converting attachment data failed) The code is like: MimeBodyPart htmlPart = new MimeBodyPart(); htmlPart.setFileName(whatever.pdf); htmlPart.setContent(out.toByteArray(), application/pdf); mp.addBodyPart(htmlPart); logged issuehttp:// code.google.com/p/googleappengine/issues/list?cursor=1764upda... does not seems to help. Please advise. Thankx and Regards Vik Founderhttp://www.sakshum.orghttp://blog.sakshum.org On Sun, May 15, 2011 at 8:26 PM, Erick Fleming er...@sudogs.com wrote: You can use ByteArrayOutputStream [1 http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputS.. .], then attach that to your mail message. If you are using low-level api, then Attrachment [2 http://code.google.com/appengine/docs/java/javadoc/com/google/appengi.. .] has a constructor for this. [1] http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputS... [2] http://code.google.com/appengine/docs/java/javadoc/com/google/appengi... On Sun, May 15, 2011 at 9:16 AM, Vik vik@gmail.com wrote: Hie Just a little question. I am using this pdfJet thing. The requirement for us is to create a pdf and then mail it to a user. So i am done with pdf creation ... read more » -- 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: open source pdf engine for GAE
); Message msg = new MimeMessage(session); msg.setContent(mp); msg.setFrom(new InternetAddress(vik@gmail.com)); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(vik@gmail.com)); msg.setSubject(testing PDF system); Transport.send(msg); System.out.println(Sucessfully Sent mail to All Users); Thankx and Regards Vik Founder http://www.sakshum.org http://blog.sakshum.org On Tue, May 17, 2011 at 9:30 PM, Stephen Johnson onepagewo...@gmail.com wrote: Vik, Post your code where you're creating the ByteArrayOutputStream and creating the PDF with it. It'll be more helpful then what you've posted. I'm a little concerned you still don't have this part correct since you're still using out as a variable name. You're code should be similar to: ByteArrayOutputStream baos = new ByteArrayOutputStream(); /* this part is from your previous email. I don't use PDFJet so I can't validate this code for you */ PDF pdf = new PDF(baos); some actual writing. pdf.flush(); /* taken from docs */ Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); String msgBody = ...; try { Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(ad...@example.com, Example.com Admin)); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(u...@example.com, Mr. User)); msg.setSubject(Your Example.com account has been activated); msg.setText(msgBody); Multipart mp = new MimeMultipart(); // Get the PDF data byte[] attachmentData = baos.toByteArray(); MimeBodyPart attachment = new MimeBodyPart(); attachment.setFileName(manual.pdf); attachment.setContent(attachmentData, application/pdf); mp.addBodyPart(attachment); message.setContent(mp); Transport.send(msg); } catch (AddressException e) { // .. } catch (MessagingException e) { // ... } On Tue, May 17, 2011 at 6:19 AM, Vik vik@gmail.com wrote: I think the problem is not with pdfJet it about sending pdf as an attachment via mail api on app engine Thankx and Regards Vik Founder http://www.sakshum.org http://blog.sakshum.org On Tue, May 17, 2011 at 6:45 PM, Nichole nichole.k...@gmail.com wrote: You could try iText: http://groups.google.com/group/google-appengine-java/browse_thread/th... http://code.google.com/appengine/docs/java/mail/usingjavamail.html On May 16, 7:11 pm, Vik vik@gmail.com wrote: Hie Trying to send a pdf created using pdfJet throws the exception class javax.mail.SendFailedException:Send failure (javax.mail.MessagingException: Converting attachment data failed) The code is like: MimeBodyPart htmlPart = new MimeBodyPart(); htmlPart.setFileName(whatever.pdf); htmlPart.setContent(out.toByteArray(), application/pdf); mp.addBodyPart(htmlPart); logged issuehttp:// code.google.com/p/googleappengine/issues/list?cursor=1764upda... does not seems to help. Please advise. Thankx and Regards Vik Founderhttp://www.sakshum.orghttp://blog.sakshum.org On Sun, May 15, 2011 at 8:26 PM, Erick Fleming er...@sudogs.com wrote: You can use ByteArrayOutputStream [1 http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputS.. .], then attach that to your mail message. If you are using low-level api, then Attrachment [2 http://code.google.com/appengine/docs/java/javadoc/com/google/appengi.. .] has a constructor for this. [1] http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputS... [2] http://code.google.com/appengine/docs/java/javadoc/com/google/appengi... On Sun, May 15, 2011 at 9:16 AM, Vik vik@gmail.com wrote: Hie Just a little question. I am using this pdfJet thing. The requirement for us is to create a pdf and then mail it to a user. So i am done with pdf creation ... read more » -- 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: open source pdf engine for GAE
You could try iText: http://groups.google.com/group/google-appengine-java/browse_thread/thread/7dfdf19cfdd410d6/ee7024dd040ba6eb?lnk=gstq=pdf#ee7024dd040ba6eb http://code.google.com/appengine/docs/java/mail/usingjavamail.html On May 16, 7:11 pm, Vik vik@gmail.com wrote: Hie Trying to send a pdf created using pdfJet throws the exception class javax.mail.SendFailedException:Send failure (javax.mail.MessagingException: Converting attachment data failed) The code is like: MimeBodyPart htmlPart = new MimeBodyPart(); htmlPart.setFileName(whatever.pdf); htmlPart.setContent(out.toByteArray(), application/pdf); mp.addBodyPart(htmlPart); logged issuehttp://code.google.com/p/googleappengine/issues/list?cursor=1764upda... does not seems to help. Please advise. Thankx and Regards Vik Founderhttp://www.sakshum.orghttp://blog.sakshum.org On Sun, May 15, 2011 at 8:26 PM, Erick Fleming er...@sudogs.com wrote: You can use ByteArrayOutputStream [1http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputS...], then attach that to your mail message. If you are using low-level api, then Attrachment [2http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...] has a constructor for this. [1] http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputS... [2] http://code.google.com/appengine/docs/java/javadoc/com/google/appengi... On Sun, May 15, 2011 at 9:16 AM, Vik vik@gmail.com wrote: Hie Just a little question. I am using this pdfJet thing. The requirement for us is to create a pdf and then mail it to a user. So i am done with pdf creation part and at then end i have the code like: OutputStream out = resp.getOutputStream(); PDF pdf = new PDF(out); some actual writing. pdf.flush(); out.close(); Now the question i have is after this step how do i actually get handle to the created pdf above and attach it to an email ? Thankx and Regards Vik Founder http://www.sakshum.org http://blog.sakshum.org On Tue, Apr 20, 2010 at 1:52 PM, Patou patou.de.saint.ste...@gmail.comwrote: Hello In App Engine, You can't write a file to the file system. Otherwise the save method can't be used in GAE. Use this code to send the pdf to the navigator : pdf.wrap(); String fileName = Example_03.pdf; resp.setContentType(application/pdf); resp.setHeader(Content-Disposition, attachment; filename=\ + fileName + \); ServletOutputStream outs = resp.getOutputStream(); pdf.getData().writeTo(outs); Or to save to the datastore : new Blob(pdf.getData().toByteArray()); Bests Regards Patrice On Apr 20, 4:18 am, jeno jeno...@gmail.com wrote: Hi François , Thanks for your help. I have used PDFjet (PDFJet.jar version 2.72) PDF class missing save method So i cant call pdf.save(d.pdf) method. Cheers jeno On Apr 19, 6:48 pm, François Masurel fm2...@mably.com wrote: Hi Jeno, You can try the PDFjet Open Source Edition : http://pdfjet.com/os/edition.html François On 19 avr, 01:55, jeno jeno...@gmail.com wrote: Hi Guys, Anyone know open source java pdf engine for GAE. Thanks Jeno -- 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 athttp:// groups.google.com/group/google-appengine-java?hl=en. -- 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 athttp:// groups.google.com/group/google-appengine-java?hl=en. -- 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 athttp:// groups.google.com/group/google-appengine-java?hl=en. -- 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. -- You received this message because you are subscribed to the Google
[appengine-java] Re: Setting Namespace for an entire Request
According to the docs, the namespace is set globally within the app, but you can use it On a per-User Basis for users that are logged in as an example and that user is the tenant. The docs aren't clear, but the namespace must be globally just for that tenant, yes? If that's the case, then you wouldn't need to worry about concurrent access. You could make a quick test with 2 users and different namespaces... On May 13, 11:55 pm, Aswath Satrasala aswath.satras...@gmail.com wrote: Namespace-api is set normally in a Servlet Filter, which is normally the beginning point for most application HttpRequests. This means, there is a request coming in, it is serviced by a single-thread. Namespace-api is threadsafe and the namespace is put in the threadlocal, and hence, the same namespace is available during the complete HttpRequest serviced by that thread. -Aswath On Fri, May 13, 2011 at 9:13 PM, mpire sebastian.wennin...@googlemail.comwrote: Hi! I'm trying to use the Namespace-API to build a multi-tenant app. Therefore i have defined a filter that sets the Namespace for each request regarding to the User making the request. However, if there's a new Request before the current request finishes its datastore-operation, the namespace would be overwritten by the new request and the current operation would have an incorrect namespace. I could also set the namespace before each datastore operation, but the problem would be the same.If another request overwrites the namespace before the operation is finished, the data in the database will be messed. Is there a way to set the namespace for an entire request? Or should i try to build some kind of Mutex around the NamespaceManager? Any suggestions to solve this problem are welcome :) Thx in advance -- 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. -- 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: How To: Persist an entity, if and only if, another successfully persists
I like Jeff's solution as it's failsafe, but one more pattern I often use is to set a couple of flags, and complete the 2nd action in a finally clause if needed. The timeout for the 30 sec limit does allow for a very quick transaction to still succeed, so I use that time to persist any state needed for the service I'm running, for example. On May 14, 4:09 pm, Jeff Schnitzer j...@infohazard.org wrote: Depending on your application, you may be able to perform the 2nd entity write in a task. Enqueue the task transactionally with the first operation. You'll be guaranteed that if the first entity commits, the 2nd will *eventually* be written as well. It's not a perfect solution for all apps but it does cover a lot of practical use cases. Jeff On Sat, May 14, 2011 at 7:52 AM, mscwd01 mscw...@gmail.com wrote: Hey I have two entities I update and which to persist. These are in two different entity groups so I cannot update and persist them within a Transaction. I am using JDO pm.makePersistentAll and must ensure each entity only saves to the datastore if both can be written. What's the best way to do 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 athttp://groups.google.com/group/google-appengine-java?hl=en. -- 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: overcome onetomany limitation of 5000
You might want to consider denormalizing that table by one field? That is, create a new entity holding a foreign key relation and the field of interest, and create an index for that query equality. Reads are fast, and updates are slower so creating new entities for that data rather than updating an increasingly large entity (the entity with a list) might be a good approach. On May 11, 11:08 pm, lp lucio.picc...@gmail.com wrote: hi all i am modelling a unowned one-to-many relationship using list properties. @Entity public class User{ String name; Boolean loggedIn; @Basic private ListKey friends; } all is good. i can run queries like query = Select p from PositionUser p where p.friends = :userKey and + AND p.loggedIn = true However there is a limit on the number of index available per entity of 5000. (although i am hitting the limit at 2500 for some reason) i have 2 problems with the current approach #1. below the 5000 limit each addition to the friend list will require a fetch of the entire list, then add item and then put to datastore. this is rather expensive in CPU. #2. How can i allow for 5000 in the onetomany? any suggestion pls -lp -- 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: After upgrade to GAE SDK 1.5.0 - Cache is not working
I've been programming to the jcache interface that's included in the appengine sdk javax.cache.Cache and that still works in SDK 1.5.0. appengine's service locator (MemcacheService) finds the implementation for the interface. import javax.cache.Cache; import javax.cache.CacheException; import javax.cache.CacheFactory; import javax.cache.CacheManager; CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory(); cache = cacheFactory.createCache(Collections.emptyMap()); On May 11, 7:03 pm, luka uluk...@gmail.com wrote: I have found a workaround until a new zip will be released. I have taken the appengine-jsr107cache-1.4.3.jar from a former SDK installation renamed it to appengine-jsr107cache-1.5.0.jar and placed it under C:\Google-Apps\SDK\1.5.0\lib\user I have checked it on local production environment and it works like a charm On May 12, 1:24 am, Scott shathaw...@gmail.com wrote: I am having the same issue this: CacheFactory factory = net.sf.jsr107cache.CacheManager.getInstance().getCacheFactory(); Throws a CacheException with no stack trace and the message: net.sf.jsr107cache.CacheException: Could not find class: 'com.google.appengine.api.memcache.jsr107cache.GCacheFactory' On May 11, 6:03 pm, Don Schwarz schwa...@google.com wrote: What is the NullPointerException that you are getting? You shouldn't need to change your GCacheFactory. Nothing changed with that in 1.5.0, and the new package you are using is not correct. com.google.appengine.api.memcache.jsr107cache.GCacheFactory is the one you want. It is in appengine-jsr107cache-1.5.0.jar. On Wed, May 11, 2011 at 5:00 PM, luka uluk...@gmail.com wrote: I have recently upgraded from GAE 1.4.3 to 1.5.0 and the MemCache service I work with stop working. When I try to reach it, I get NullPointerException I saw that the package of GCacheFactory was changed to com.google.appengine.api.memcache.stdimpl although besides of that I am not sure what is wrong. I have a simple cache implementation using Spring beans which worked well during the last year: (Please help, my service has customers waiting for solution) import java.util.HashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import com.google.appengine.api.memcache.stdimpl.GCacheFactory; import net.sf.jsr107cache.Cache; import net.sf.jsr107cache.CacheException; import net.sf.jsr107cache.CacheManager; public class OnLoad { private static Logger logger = Logger.getLogger(com.lugo.server.utils.OnLoad); Cache cache; /** * Create Cache ( MemCache ) */ public void onStartup(){ try { Map props = new HashMap(); int expire = 3600 * 192 ; // 8 Days props.put(GCacheFactory.EXPIRATION_DELTA, expire); cache = CacheManager.getInstance().getCacheFactory().createCache(props); } catch (CacheException e) { logger.log(Level.WARNING,onStartup(), e); } } public Cache getCache(){ return cache; } } -- 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. -- 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: App engine SDK jars in WEB-INF/lib. Why???
Just a quick summary, the servlet spec requires that a servlet container such as appengine provider an implementation for a service. Those jars such as servlet- api-2.4.jar are needed at compile time. They are sometimes provided by the servlet container/ engines at run time in a global directory that is found by the container/engine classloader. appengine provides the servlet, jsp implementations for us at runtime. The appengine specific service implementations are also needed at runtime and compile time and are present in the appengine-api-1.0-sdk-ver.jar. They've chosen not to add the latest sdk to the container global classpath, so yes, the application must provide it. That may be an assumption that all builds are not required to be backwards compatible. Note that the application loader is now checking for the sdk version before upload too, so there's a rough check for compatibility in place. I think I had one app that was using 1.3.8 and was no longer able to deploy it with version 1.4.3. On May 12, 2:56 pm, Toby Reyelts to...@google.com wrote: arjan, There are two sides to the App Engine API: the client and the server. The client side (appengine-api.jar) lives entirely in user-land. If you so chose, you could create your own version of these classes. In the end, the client ends up talking to the server through a binary protocol in order to fulfill much of the API. Having this separation means that you can evolve the client and server independently. For example, dev_appserver and prod obviously have two different server backends for the same client API. You can take that one step further and even independently implement your own server if you so chose. It also means that its trivial to do things like test out and even deploy hotfixes for individual applications instead of waiting for full releases. On Thu, May 12, 2011 at 4:31 PM, arjan tijms arjan.ti...@gmail.com wrote: Hi ya! On May 12, 1:05 am, Didier Durand durand.did...@gmail.com wrote: 1 of the reasons is that all applications don't run all at the same version on the gae productive infrastructure. So, google would have to know which one you are using in order to put it for you in your war when you upload it. Hmmm, there are two possible problems with that explanation: 1. Aren't the GAE jars in the war the ones for local simulation and not the actual ones used by the live GAE production servers? 2. Why would Google need to put them into the war when we upload it? Tomcat doesn't add the servlet-api jars to my war when I deploy it to Tomcat, JBoss AS doesn't add the EJB, JPA, etc etc jars to a war being deployed to it, Resin also doesn't do this. In fact, I've never encountered any Java server that required jars for functionality that the server provided to be put into the war. WEB-INF/lib is for extra functionality that the server -does not- provide. If they just use it for detecting the version for which you developed your app, then why not just put that version number in appengine- web.xml? -- 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. -- 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: Use Array as a query filter - possible?
The example from the test class is what you're looking for, just replace the String id field with Integer id; @PersistenceCapable(detachable = true) @Version(strategy = VersionStrategy.VERSION_NUMBER) public class Flight implements Serializable { private Integer id; ... Indexes configured in datastore-indexes.xml could help speed up your query returns, but if the field is the primary key, they're already indexed... On May 9, 1:04 am, mscwd01 mscw...@gmail.com wrote: Thanks for the reply. I'm actually using JDO so I create a Query and apply .setFilter() to it. The property I have is an int[] array, not a List, but I could change this if it means I can query the contents of the List. Importantly, I need the query to be as efficient as possible as I'm currently looping through the Array once the Entity is loaded which I assume is not very efficient. So what would be the best way to store 30 integers (Array or List) and how would you filter on it in a query using JDO? I wish to check for Entities which contain a single integer or multiple I.e. 2 or 2,3 and 4. I've tried looking through the JDO docs but I'm obviously missing something :( Thanks On May 9, 7:57 am, Nichole nichole.k...@gmail.com wrote: You can use contains in JDO instead of SQL's IN(), but the implementation is a separate query for each item in the list. (http://code.google.com/appengine/docs/java/datastore/jdo/ queries.html). There's also a limit of 30 to the number of items in the array. This from appengine tests is expected to work: Query q = pm.newQuery(select from + Flight.class.getName() + where :ids.contains(id)); ListFlight flights = (ListFlight) q.execute( Arrays.asList(key, e1.getKey(), e2.getKey()) ); On May 8, 5:14 pm, mscwd01 mscw...@gmail.com wrote: Hey I have an entity with an Int Array and I would like to perform a query on the contents of the Array. For example, I would like to return entities which have a certain number within the array, I.e. Select * From MyObject Where numberArray contains 2 Is this possible in any way, shape or form? 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: Use Array as a query filter - possible?
You can use contains in JDO instead of SQL's IN(), but the implementation is a separate query for each item in the list. (http://code.google.com/appengine/docs/java/datastore/jdo/ queries.html). There's also a limit of 30 to the number of items in the array. This from appengine tests is expected to work: Query q = pm.newQuery(select from + Flight.class.getName() + where :ids.contains(id)); ListFlight flights = (ListFlight) q.execute( Arrays.asList(key, e1.getKey(), e2.getKey()) ); On May 8, 5:14 pm, mscwd01 mscw...@gmail.com wrote: Hey I have an entity with an Int Array and I would like to perform a query on the contents of the Array. For example, I would like to return entities which have a certain number within the array, I.e. Select * From MyObject Where numberArray contains 2 Is this possible in any way, shape or form? 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: Getting class not found errors on my project... any ideas why?
When I need to use document operations rather than a sax2 parser through the XMLReaderFactory reader, I set a system property which declares the first preferred implementation of the factory: String appEngineEnv = System.getProperty(com.google.appengine.runtime.environment); if (appEngineEnv != null appEngineEnv.equalsIgnoreCase(Production)){ // else Development // avail in app engine: System.setProperty(javax.xml.parsers.SAXParserFactory, com.sun.org.apache.xerces.internal.parsers.SAXParserFactoryImpl); } On Apr 27, 8:58 pm, Sam sam.stig...@gmail.com wrote: Hi, I'm new to App Engine. I just spent the weekend porting my code over to Java. The major class in my app is a SAX XML parser that extends DefaultHandler. For some reason, I keep on getting errors similar to the following (extracted from the Eclipse debugger) whenever I try to get a PersistenceManager: Source not found - The JAR file /Applications/eclipse/plugins/ com.google.appengine.eclipse.sdkbundle_1.4.3v201103311225/appengine- java-sdk-1.4.3/lib/usr/appengine-api-1.0-sdk-1.4.3.jar has no source attachment. You can attach source by clicking Attach Source below: // Attach Source button follows I've tried deleting Eclipse and then re-install both it and the Google add-ons, but that didn't help. The error is happening both when I try to instantiate an instance of the PMF class as shown in the Guestbook example, and when I try to eliminate that by using the following line instead: PersistenceManager pm = javax.jdo.JDOHelper.getPersistenceManagerFactory().getPersistenceManager(); My call stack for the main thread looks like the following every time it crashes: XIncludeAwareParserConfiguration(XML11Configuration).parse(boolean) line: 820 XIncludeAwareParserConfiguration(XML11Configuration).parse(XMLInputSource) line: 737 SAXParserImpl$JAXPSAXParser(XMLParser).parse(XMLInputSource) line: 119 SAXParserImpl$JAXPSAXParser(AbstractSAXParser).parse(InputSource) line: 1205 SAXParserImpl$JAXPSAXParser.parse(InputSource) line: 522 SAXParserImpl$JAXPSAXParser.parse(String, DefaultHandler) line: 277 MyServlet.doGet(HttpServletRequest, HttpServletResponse) line: 24 MyServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 617 MyServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 717 ServletHolder.handle(ServletRequest, ServletResponse) line: 511 ... and so on. I'm willing to send the entire callstack if anyone would find that helpful. Some classes I don't even get a class not found error for; just Source not found. in red text with a button to edit the source lookup path. Those classes include XIncludeAwareParserConfiguration, SAXParserImpl$JAXPSAXParser, ServletHolder, ServeBlobFilter, ServletHandler, StaticFileFilter, SecurityHandler, DevAppEngineWebAppContext, JettyContainerService$ApiProxyHandler, Server, HttpConnection, HttpParser, and QueuedThreadPool$PoolThread. The classes that are getting the class not found errors are all saying the AppEngine jar doesn't have source attached to it, see above. They are: TransactionCleanupFilter, my servlet (which extends HttpServlet), SelectChannelConnector$ConnectorEndPoint. I'm stumped. Do you have any ideas? Thanks in advance, Sam Stigler sam.stig...@gmail.com -- 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: Struts2 result type xslt with Google App
Is xml-apis.jar included in your build? I had to add the following jars to an appengine app that used various xml operations. dependency groupIdorg.apache.xerces/groupId artifactIdxml-apis/artifactId version2.9.1/version /dependency dependency groupIdorg.apache.xerces/groupId artifactIdxercesImpl/artifactId version2.9.1/version /dependency dependency groupIdorg.apache.xerces/groupId artifactIdresolver/artifactId version2.9.1/version /dependency dependency groupIdorg.apache.xerces/groupId artifactIdserializer/artifactId version2.9.1/version /dependency dependency groupIdorg.apache.xalan/groupId artifactIdxalan/artifactId version2.7.1/version /dependency Here's the TransformerFactory constructor: javax.xml.transform.TransformerFactory tfactory = javax.xml.transform.TransformerFactory.newInstance(org.apache.xalan.processor.TransformerFactoryImpl, this.getClass().getClassLoader() ); Transformer transformer = tfactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, xml); transformer.setOutputProperty(OutputKeys.ENCODING,UTF-8); StringWriter output = new StringWriter(); transformer.transform(new DOMSource(doc), new StreamResult(output)); sb.append(output.toString()); On Apr 27, 10:23 pm, 朴乾斌 parkyoo...@gmail.com wrote: I success to integrate struts2 in GAE . And can execute program in normal condition. But when i try use xslt result type . The error come out. javax.xml.transform.TransformerOncfigurationException: Could not compile stylesheet is there have any solution? -- 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: How to log user generated traffic per user
or a ServletRequestListener or HttpSessionListener. There are attribute listeners too. In general, as convenient as listeners are, they also affect performance. On Apr 18, 9:51 pm, Nichole nichole.k...@gmail.com wrote: Or you could use a ServletContextListener or a ServletFilter. They're components so easy to swap in an out of your architecture. On Apr 18, 4:04 am, Simon Knott knott.si...@gmail.com wrote: Hi, Didier's solution will definitely do the job for servlets. Alternatively, you could use a servlet filter to wrap all calls to specific URL mappings that allows you to capture the same data, without the need for a common base class, as well as capturing data for dynamic pages as well. You won't be able to capture specific user data for static entities unless you deliver them to end users via some servlet-delivery mechanism. Cheers, Simon -- 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: How to log user generated traffic per user
Or you could use a ServletContextListener or a ServletFilter. They're components so easy to swap in an out of your architecture. On Apr 18, 4:04 am, Simon Knott knott.si...@gmail.com wrote: Hi, Didier's solution will definitely do the job for servlets. Alternatively, you could use a servlet filter to wrap all calls to specific URL mappings that allows you to capture the same data, without the need for a common base class, as well as capturing data for dynamic pages as well. You won't be able to capture specific user data for static entities unless you deliver them to end users via some servlet-delivery mechanism. Cheers, Simon -- 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] 404's intercepted
Hello, For a website I have hosted on appengine, I'm finding that page not found exceptions result in infinite recursion of url paths inspite of use of the servlet container error-page definition. I defined the error-page and code for 404 in the web.xml. Deployment of the app in dev appengine container shows that a 404 is returned to the client along with the body of the page defined in the error-page element. When I deploy the app to the appengine production environment however, a request to a non-existent path within the domain in combination with the Google front end web server results in a redirect to the request url + /index.jsp/ (so a page not found results in infinite recursion request url + /index.jsp/index.jsp/...). As one attempted work around, I used a filter to intercept the request and response before it leaves the appengine container. That filter changes the http status to 200 and lets the request continue to the error-page. The filter works as expected in dev appengine: INFO: javax.servlet.ServletContext log: PageNotFoundFilter:DoBeforeProcessing.response is committed = false res=HTTP/1.1 404 Feb 10, 2011 2:17:52 PM com.google.appengine.tools.development.ApiProxyLocalImpl log INFO: javax.servlet.ServletContext log: PageNotFoundFilter:DoAfterProcessing.response is committed = true res=HTTP/1.1 200 When the same solution was deployed to production, however, the filter isn't necessarily started in time to handle the request. javax.servlet.ServletContext log: PageNotFoundFilter:Initializing filter This request caused a new process to be started for your application, and thus caused yourapplication code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application. I tried variations on the request with a dozen or so different requests and a few browsers. When the dashboard logs were available after a short while, only a couple of those had been logged and with the same statements just mentioned. Any immediate repeat of the non- existent paths by a fresh client browser to rule out caching etc, did not turn up in the logs. The Google front end web server may be intercepting and handling a 404 request, and it may be caching errors and returning a similar response to the same IP address (and hence subsequent requests don't reach the appengine...not sure), but I still should be able to forward the request and change the response before it's committed and leaves the appengine servlet engine. As another attempted work around, I used a servlet for the error-page and added a request forward and response status setting to 200. The servlet error solution worked in development and did not work in production. The single log statement in production said the servlet process itself didn't start. S, it looks like production appengine isn't implementing the error-page of the deployment descriptor? How should we handle page not found? Thanks for your time, Nichole -- 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: persistent and scalable global atomic counter: not possible with GAE?
Hi MG, Sharded counters help solve the concurrent write contention for an entity. Time (to the accuracy of milliseconds) helps to provide a one way arrow towards a unique value. Each request itself could be associated with an identity (this is up to you, perhaps time in the request header). The combination of all 3 may lead to a guaranteed unique number. Cheers, Nichole (p.s. If you do use sharded counters in your approach, you can configure the datastore read consistency to be strong: http://code.google.com/appengine/docs/java/datastore/usingjdo.html) On Dec 28, 8:33 pm, MG michael.glas...@gmail.com wrote: Yes, keys are unique, but they are strings, and quite long (20+ characters, from what I've seen). I do need unique and growing numeric counter. On Dec 28, 11:20 pm, nischalshetty nischalshett...@gmail.com wrote: Have a look at the Datastore Key thingy. The keys generated are unique across the system IMO. Not sure though but that's what I remember reading somewhere. -N On Dec 29, 7:43 am, MG michael.glas...@gmail.com wrote: Hello! I need to create a global atomic counter (64-bit) in my AppEngine/J app. Like long count = MyCounter.increment() that will 100% guarantee that count will never ever be the same for two different requests, and that I will be able to increment it several million times/day initially, and much more if/when traffic increases. I do not really care if it skips a number or two occasionally: I can live with it returning a value larger than the actual number of calls, but I do need absolute uniqueness and reasonably linear growth (i.e. is two consecutive calls from a client should result in ascending counter values). Is this possible to do with Google AppEngine? Sharded counters can ensure consistent counting, but not unique counts; memcache counters can ensure unique increments, but they are perishable and thus difficult (impossible?) to properly synchronize with persistent storage. Using one entity to read-update in a transaction will not scale... Thanks, MG -- 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.
[appengine-java] Bouncy Castle 3party jars no longer loaded?
Hello, Are there changes to the allowed use of Bouncy Castle as a 3rd party library in SDK 1.3.3? I'm now getting an exception SHA1 digest error for org/bouncycastle/ crypto/paddings/BlockCipherPadding.class which suggests that BouncyCastle is still being used, but classes in my app that use bouncy castle are not reporting their log statements. I added quite a bit of logging so see it drop off right before the first class using bouncy castle. I even added a static method to a BC using class just to report that it was reached. I asserted that the classes are present in the web app with JarFile and JarEntry too. Have the classes suddenly been blacklisted, but a runtime exception isn't reported? Note that when I first noticed this last week, I repackaged my app and redeployed it a few times and it was successfully using Bouncy Castle again for that day, but the problem has returned. Thanks for your time, Nichole -- 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.
[appengine-java] number of tasks in queue
Hello, In the near future will there be an API method to get the current number of tasks in a queue? Thanks for your time, Nichole -- 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.
[appengine-java] Re: ability to implement queue or wrapper to queue with an internal latch
Hi Ikai, Yes and a little more. The individual work processes can run multiply in parallel, but the pattern I'm using is a sequential workflow (of parallelizable processes). Having the workflow schedule definable in a configuration file like the cron.xml or queue.xml, but with the added ability to terminate on a certain condition is what I was thinking about. Alternatively the queue.xml file has the ability to specify the frequency of the operation and the cron.xml file has the ability to specify the a discrete set of times for the operation, so the combined ability to specify a set of start times with an interval over which an operation repeats would be a good substitution. To add a little more context, I'm working from the perspective of wanting to use the cron.xml to invoke my workflow on a regular schedule, not having enough slots to enter the number of iterations it needs along with other processes outside of it in that cron.xml. I'm interested in using the Task Queue API instead for the workflow, but do not want the operation to run all day. I'm still reading the Task Queue API, so it may be that it's straight forward to add and remove a task from the Queue... it's just that the total solution for the problem I've set up requires many moving parts (a cron.xml operation to put the workflow in a task and an operation to remove it when the workflow state changes) and I like the idea of being able to configure it in a file if possible. Thanks for your help, pushing it back onto the queue from a cron job sounds like the right solution for now. -Nichole On Nov 10, 2:51 pm, Ikai L (Google) ika...@google.com wrote: Nichole, Our Task Queue API will take care of distributing your background tasks across separate application instances:http://code.google.com/appengine/docs/java/taskqueue/overview.html It sounds like what you are describing is the ability to increase your ability to parallelize long running tasks. A typical pattern for this would be to lazy when possible in your job execution: when the first queue comes in, chop it up into several other tasks and push them back into the queue. Repeat as necessary. On Sat, Nov 7, 2009 at 4:03 AM, Nichole nichole.k...@gmail.com wrote: Hello, Thanks for use of the app engine! I'm wondering if there are future plans to implement something like the ability to use a concurrent count down latch with a wrapper to or within a queue implementation? It would be nice to be able to set a condition upon which multiple processors operating on the same task are done and the next in a sequence of tasks can be started. I'm implementing this in other ways currently... -- Ikai Lan Developer Programs Engineer, Google App Engine --~--~-~--~~~---~--~~ 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: Problem with Data Store using JDO Query
Your error message says that the current app engine API doesn't support 'OR', and the docs state: 'An entity must match all filters to be a result. In the JDOQL string syntax, multiple filters are specified separated by (logical and). Other logical combinations of filters (logical or, not) are not supported.' So it looks like you'll have to assert your conditions on the fetched result set. If the returned results are too many in number, you can use the query operation setRange to reduce the number returned... On Nov 6, 4:30 pm, Java Java passionjavaj...@gmail.com wrote: Can you please any one help me.I am using Good Data store in my application. when i try to write the query in JDO like this select from + Address.class.getName()+ where designation==+search + || suburb==+suburb It is not working and display the error message in console : 06/11/2009 11:42:59 PM com.google.apphosting.utils.jetty.JettyLogger warn WARNING: /addressInfo org.datanucleus.store.appengine.query.DatastoreQuery $UnsupportedDatastoreOperatorException: Problem with query SELECT FROM com.matchmaking.Address WHERE designation=='doc' || suburb=='': App Engine datastore does not support operator OR at org.datanucleus.store.appengine.query.DatastoreQuery.checkForUnsupportedOpe rator (DatastoreQuery.java:1197) at org.datanucleus.store.appengine.query.DatastoreQuery.addExpression (DatastoreQuery.java:706) at org.datanucleus.store.appengine.query.DatastoreQuery.addFilters (DatastoreQuery.java:663) at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute (DatastoreQuery.java:214) at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute (JDOQLQuery.java:84) at org.datanucleus.store.query.Query.executeQuery(Query.java:1489) at org.datanucleus.store.query.Query.executeWithArray(Query.java: 1371) at org.datanucleus.store.query.Query.execute(Query.java:1344) at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221) at com.matchmaking.ContactDAOImpl.listContacts(ContactDAOImpl.java: 29) at com.matchmaking.AddressInfo.listContacts(AddressInfo.java:174) at com.matchmaking.AddressInfo.doPost(AddressInfo.java:103) at com.matchmaking.AddressInfo.doGet(AddressInfo.java:28) at javax.servlet.http.HttpServlet.service(HttpServlet.java:693) 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.utils.servlet.TransactionCleanupFilter.doFilter (TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter (ServletHandler.java:1084) at com.google.appengine.tools.development.StaticFileFilter.doFilter (StaticFileFilter.java:121) 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.utils.jetty.DevAppEngineWebAppContext.handle (DevAppEngineWebAppContext.java:54) at org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java:139) at com.google.appengine.tools.development.JettyContainerService $ApiProxyHandler.handle(JettyContainerService.java:342) at org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:313) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java: 506) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete (HttpConnection.java:830) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at org.mortbay.io.nio.SelectChannelEndPoint.run (SelectChannelEndPoint.java:396) at org.mortbay.thread.BoundedThreadPool$PoolThread.run (BoundedThreadPool.java:442) --~--~-~--~~~---~--~~ 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] ability to implement queue or wrapper to queue with an internal latch
Hello, Thanks for use of the app engine! I'm wondering if there are future plans to implement something like the ability to use a concurrent count down latch with a wrapper to or within a queue implementation? It would be nice to be able to set a condition upon which multiple processors operating on the same task are done and the next in a sequence of tasks can be started. I'm implementing this in other ways currently... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---