[appengine-java] Query not working
I have a pojo CurrencyPair which I have successfully saved in the database using jdo. CurencyPair has a field currencyPair. Now trying to select in jdo the query works fine so long as there are no conditions/filters involved. ie I can select all currency pairs like this PersistenceManager pm= getPersistenceManager(); Query query = pm.newQuery(CurrencyPair.class); ListCurrencyPair l = (ListCurrencyPair)query.execute(); This gives USD.JPY GBP.JPY EUR.GBP EUR.USD USD.CAD AUD.USD USD.CHF EUR.JPY EUR.CHF GBP.USD PersistenceManager pm= getPersistenceManager(); Query query = pm.newQuery(CurrencyPair.class,currencyPair == 'AUD.USD'); ListCurrencyPair l = (ListCurrencyPair)query.execute(); returns no data. I've tried all all combinatioins of setting a filter and declaring a parameter or putting the whole query in 1 String according to the gae getting started guide. I have no idea what I'm doing wrong. any help would be appreciated. Thanks. Dukha -- 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=.
Re: [appengine-java] Query not working
Have you tried using an outside tool like TOAD or DBVIS to run your query first as a test? Or can you JUnit your query? On Thu, Nov 12, 2009 at 2:11 AM, dukha mplen...@gmail.com wrote: I have a pojo CurrencyPair which I have successfully saved in the database using jdo. CurencyPair has a field currencyPair. Now trying to select in jdo the query works fine so long as there are no conditions/filters involved. ie I can select all currency pairs like this PersistenceManager pm= getPersistenceManager(); Query query = pm.newQuery(CurrencyPair.class); ListCurrencyPair l = (ListCurrencyPair)query.execute(); This gives USD.JPY GBP.JPY EUR.GBP EUR.USD USD.CAD AUD.USD USD.CHF EUR.JPY EUR.CHF GBP.USD PersistenceManager pm= getPersistenceManager(); Query query = pm.newQuery(CurrencyPair.class,currencyPair == 'AUD.USD'); ListCurrencyPair l = (ListCurrencyPair)query.execute(); returns no data. I've tried all all combinatioins of setting a filter and declaring a parameter or putting the whole query in 1 String according to the gae getting started guide. I have no idea what I'm doing wrong. any help would be appreciated. Thanks. Dukha -- 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=. -- 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=.
[appengine-java] Spring Web Flow
Hi everyone, I’m having an error using Spring + Spring Web Flow in my java web application. I have already fixed lots of small problems to get it working, but this one I can’t figure out. The app is: http://toverexpressforever.appspot.com When you click on the ‘register’ button, a new Spring Web Flow is started and it takes you to the first view-state of the float, /WEB- INF/jsp/subscription/details.jsp Then you can continue in the flow, by clicking on one of the two links. One leads you to another jsp (WEB-INF/jsp/subscription/ summary.jsp), the second will lead you back to the homepage /home.do The first time when I try this, it always works... But whenever I try to go to /subscription.do a second time (or 3rd ,4rd, ...) it fails... What am I doing wrong here? He always gives me the error message: Error: Not Found The requested URL /subscription was not found on this server. And in the logs, I see this error message for the /subscription.do URL: # 1. 11-12 01:27AM 36.070 /subscription 404 1ms 0cpu_ms 0kb Mozilla/ 5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe) See details ***.***.***.*** - - [12/Nov/2009:01:27:36 -0800] GET / subscription HTTP/1.1 404 0 http://toverexpressforever.appspot.com/; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4) Gecko/ 20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe) toverexpressforever.appspot.com 2. W 11-12 01:27AM 36.070 No handlers matched this URL. Anyone know what I'm doing wrong here? On a local Tomcat server (in Eclipse) it works, as well as with the Eclipse plugin server (by doing Run As - Web Application)... Any help is greatly appreciated!! Kind regards, Dieter H -- 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=.
[appengine-java] Re: How to use picasa upload api on Google App Engine
why are you not using another class that implements the MediaSource interface - e.g., MediaByteSource or MediaStreamSource? regards, andr On 11 Nov., 21:22, Ikai L (Google) ika...@google.com wrote: Kishore, Here are the docs related to sending the data as binary:http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_proto... This is the raw protocol. Here are the steps you'll have to take: 1. Accept a file upload and buffer it in memory (http://code.google.com/appengine/kb/java.html#fileforms) 2. Format the authorization headers and POST body as necessary 3. Open an HTTP connection using URLFetch:http://code.google.com/appengine/docs/java/urlfetch/overview.html(Note the limits) You'll need to do some research into the exact format for uploads to the Picasa API. I don't have any code samples for doing this, but it looks very similar to standard HTTP multipart form data with XML metadata. On Tue, Nov 10, 2009 at 8:36 PM, Kishore Jaladi kishorejal...@gmail.comwrote: Hi Ikai, Thanks for the response. The protocol section describes format of the post body. But the Java guide does not explain how to send binary image data other than teh approach of creating MediaFileSource with the java.io.File as refered at http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_java . And Java GAE does not support new File(/home/liz/puppies.jpg) snippet of this sample. Can you please give me a sample or refer to a doc that explains how the other approach (sending binary image data) works in jsp/java world? Thanks in advance - Kishore On Nov 10, 5:58 pm, Ikai L (Google) ika...@google.com wrote: You may want to look here: http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_proto... If you are looking to upload photos that a user has uploaded, you will not be able to save the image in the file system. You'll have to buffer the data in memory and post to Picasa's API. On Sun, Nov 8, 2009 at 10:43 PM, Kishore Jaladi kishorejal...@gmail.com wrote: Hi, Is there a way to upload files on local file system to picasa on google app Engine? The google app engine cannot read local files. I tried to use GAEVFS (Virtual File system), but I could not figure out how to create MediaFileSource from FileObject. Any help please? - kjaladi -- Ikai Lan Developer Programs Engineer, Google App Engine -- Ikai Lan Developer Programs Engineer, Google App Engine- Zitierten Text ausblenden - - Zitierten Text anzeigen - -- 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=.
[appengine-java] Re: Paging in java application
I think this may help you http://code.google.com/p/gae-query-pager/ On 11 Nov., 18:50, Sanjith Chungath csanj...@gmail.com wrote: Greetings to All, I found this documentationhttp://code.google.com/appengine/articles/paging.htmlon paging in python. Can some one suggest the best way to implement pagin in a java application deployed in GAE and data store in GAE data store. I want to show say 10 images in every page out of around 1000 (available in DB). Also please let me know any widgets available to implement pagination. -Sanjith -- 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=.
[appengine-java] Re: why my app on GAE first access is so slow
1 minute works for me, I used a commercial service that tracks uptime to check it. Trouble is that the commercial service checks randomly from different locations all over the world. meaning that the application loads out of memory because its hosted in different locations, effectivly killing my CPU qouta. On Nov 12, 3:36 am, zhiw...@gmail.com zhiw...@gmail.com wrote: i only test it in my country, i don't know whether it is still effective for request that from a foreign country. but to me it is enough On Nov 12, 10:30 am, zhiw...@gmail.com zhiw...@gmail.com wrote: i turn it to 1min, the cron job access a servlet that do nothing just for active the app. every 24h it only used 1% of the free cpu-time . now at least when i access my app, it was not slow like before. but sometime the app still be inactive, although the cron job active the app, when i access sush as mainpage, it still took sometime to load the servlet. gae doc wrote: load-on-start doesn't work , the servlet will be load on first accessed. i think use cron job to access mainpage is better. now i have not try ths. On Nov 12, 5:04 am, James H james.hollier...@gmail.com wrote: So, 1-3 minute intervals seem to do the trick? Is this technique still working for you? On Nov 10, 8:24 pm, zhiw...@gmail.com zhiw...@gmail.com wrote: i think the gae cloud envrionment does not have the region concept. every app run on a virtual server , the cron job is used to make the virtual server active. if the virtual server is active, when access the app, there is no need to reinit such as spring listener etc, so delay time is short, that is so simple i think. On Nov 10, 7:30 am, James H james.hollier...@gmail.com wrote: How would a single cron task really help in an environment where multitudes of app servers are involved based on demand, geography, etc? So, how will the task that just ran help someone in U.S. and simultaneously help someone in Russia on the same app? I assume they are potentially running on different app servers. On Nov 10, 1:51 am, m seleron seler...@gmail.com wrote: Thank you for useful information. Though various situations are thought I think that a detailed analysis might be necessary to decrease the CPU TIME. thunks 2009/11/10 zhiw...@gmail.com zhiw...@gmail.com: now i set the schedule time to 3min, it seems work, every time i access my app, i can hardly feel slow. my cron job access a servlet that do nothing and just for active my app. set the schedule time to 1min is better i think,although it will take some cpu time. On Nov 9, 11:31 pm, m seleron seler...@gmail.com wrote: I'm sorry very much. It examined. ServletContextListener#contextDestoryed was not called. It was necessary to examine it accurately. Nichole. Thank you for advice. Does not the page access speed become early? When you access that I think access speed is open in since the second times always because by the thing that keeps being accessed with cron If the display speed is still slow, the cause might be different. thanks, On Nov 9, 11:30 pm, zhiw...@gmail.com zhiw...@gmail.com wrote: i set the time to 5min , but i can still find the contextInitialized info, seems gae's time-out is very short, now i test set it to 3min On Nov 9, 10:18 pm, Joseph Stano joseph.st...@gmail.com wrote: have you noticed if that solves the timeout issue? On Mon, Nov 9, 2009 at 5:04 AM, zhiw...@gmail.com zhiw...@gmail.com wrote: it seems only contextInitialized method can be executed, and contextDestroyed never be executed. so i can not get the time my app alive after it was actived. i have use cron job to access a servlet in my app every 10min to avoid app be inactive, if necessary i will turn the time to 5min or less On Nov 9, 11:40 am, zhiw...@gmail.com zhiw...@gmail.com wrote: thanks , i will try it On Nov 9, 10:18 am, philburk p...@softsynth.com wrote: The logging/query idea is probably the best workaround, but I don't have such a client to do this querying. If I did, I'd just host my app on it :) You could schedule a cron job in GAE that tickled your app. If it ran often enough it might keep it resident. http://code.google.com/appengine/docs/java/config/cron.html-Hidequote... - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Google App Engine
[appengine-java] Sending HTTPS request.
how to send request to 'https' urls in google app engine ? how to send authentication details and body in java.net.HttpURLConnection ? i tried using java.net api code as shown below. but i got the exception :- java.security.AccessControlException: access denied (java.net.NetPermission setDefaultAuthenticator) import java.net.Authenticator; import java.net.HttpURLConnection; import java.net.InetAddress; import java.net.PasswordAuthentication; import java.net.URL; public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { Authenticator.setDefault(new MyAuthenticator()); try { URL url = new URL(https://..;); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod(GET); System.out.println(Response Code : + connection.getResponseCode ()); System.out.println(Response Message :\n + connection.getResponseMessage()); if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { //OK } else { //Error code } } catch (Exception e) { } } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { String username = username; String password = password; return new PasswordAuthentication(username, password.toCharArray ()); } } -- 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=.
[appengine-java] Re: Cannot Install Ecipse Plug-in
Jason, would you have any other ideas. Based on the fact it the other librairy does not install either, could it be a more fundemental issue in the set-up ? On Nov 9, 4:34 pm, Jason Parekh jasonpar...@gmail.com wrote: Hi, Could you try enabling the Web Tools update site and attempt installing the Google plugin again? Help Install new software Click on the 'Available Software Sites' hyperlink Scroll down to the URL of http://download.eclipse.org/webtools/updates;, select this and click Enable. Press OK Try the GPE installation again Thanks, jason On Mon, Nov 9, 2009 at 3:51 PM, Emmanuel emmanuel.gon...@gem-up.com wrote: Hello, I am not using Ubuntu. I have a fresh install of eclipse 3.5 jor Java (32-bits for windows), working under Vista home 64bits with a an install of Java SE SDJ 1.6_17/ Emmanuel On Nov 9, 2:41 pm, Jason Parekh jasonpar...@gmail.com wrote: Hi Emmanuel, Are you using Ubuntu 9.10 by any chance? If so, please see the thread athttp://groups.google.com/group/google-web-toolkit/browse_thread/threa... instructions on how to enable the proper update sites that the Google plugin depends on. If not, could you describe your setup? Operating system, Eclipse version and which flavor of Eclipse (Eclipse for Java, Eclipse Platform, etc.) would be useful. Thanks! jason On Mon, Nov 9, 2009 at 8:23 AM, Emmanuel emmanuel.gon...@gem-up.com wrote: I am trying to install the 3 Eclipse plug-in (Google App Engine, Eclipse Plug-in and Google web-tool kit). The process works well untill the selected packaged are submitted and then the server/tool returns a : Cannot complete the install because one or more required items could not be found. Software being installed: Google Web Toolkit SDK 1.7.1 1.7.1.v200909221731 (com.google.gwt.eclipse.sdkbundle.e35.feature.feature.group 1.7.1.v200909221731) Missing requirement: Google Web Toolkit Plugin 1.1.2.v200910131704 (com.google.gwt.eclipse.core 1.1.2.v200910131704) requires 'bundle org.eclipse.wst.sse.ui 0.0.0' but it could not be found Cannot satisfy dependency: From: Google Web Toolkit SDK 1.7.1 1.7.1.v200909221731 (com.google.gwt.eclipse.sdkbundle.e35.feature.feature.group 1.7.1.v200909221731) To: com.google.gwt.eclipse.sdkbundle.win32 [1.7.1.v200909221731] Cannot satisfy dependency: From: Google Web Toolkit SDK for Win32 1.7.1.v200909221731 (com.google.gwt.eclipse.sdkbundle.win32 1.7.1.v200909221731) To: bundle com.google.gwt.eclipse.core 0.0.0 for all 3 packages. Any idea why ?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-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=.
[appengine-java] Re: Deployment problems
He is screenshot http://yfrog.com/0isnapshot2jzp On Nov 12, 4:45 pm, Max max.seven@gmail.com wrote: I was able to deploy project until yesterday. When I deploy project throw plugin in eclipse I get messages in console as usually Creating staging directory Scanning for jsp files. Scanning files on local disk. Scanned 250 files. Initiating update. Cloning 92 static files. Cloning 236 application files. Cloned 100 files. Cloned 200 files. Uploading 0 files. Deploying new version. Will check again in 1 seconds Will check again in 2 seconds Closing update: new version is ready to start serving. Uploading index definitions. Deployment completed successfully But in Admin logs last update was yesterday. Yesterday I had similar problems but after eclipse restart it was updating project. Today nothing helps. I can run project locally and it has all latest updates. How can I fix it? 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-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=.
[appengine-java] Re: Spring Web Flow
Anyone? If you need extra information, I'm willing to paste more of the code here.. On Nov 12, 10:29 am, Dieter Hubau dhu...@gmail.com wrote: Hi everyone, I’m having an error using Spring + Spring Web Flow in my java web application. I have already fixed lots of small problems to get it working, but this one I can’t figure out. The app is:http://toverexpressforever.appspot.com When you click on the ‘register’ button, a new Spring Web Flow is started and it takes you to the first view-state of the float, /WEB- INF/jsp/subscription/details.jsp Then you can continue in the flow, by clicking on one of the two links. One leads you to another jsp (WEB-INF/jsp/subscription/ summary.jsp), the second will lead you back to the homepage /home.do The first time when I try this, it always works... But whenever I try to go to /subscription.do a second time (or 3rd ,4rd, ...) it fails... What am I doing wrong here? He always gives me the error message: Error: Not Found The requested URL /subscription was not found on this server. And in the logs, I see this error message for the /subscription.do URL: # 1. 11-12 01:27AM 36.070 /subscription 404 1ms 0cpu_ms 0kb Mozilla/ 5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe) See details ***.***.***.*** - - [12/Nov/2009:01:27:36 -0800] GET / subscription HTTP/1.1 404 0 http://toverexpressforever.appspot.com/; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4) Gecko/ 20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe) toverexpressforever.appspot.com 2. W 11-12 01:27AM 36.070 No handlers matched this URL. Anyone know what I'm doing wrong here? On a local Tomcat server (in Eclipse) it works, as well as with the Eclipse plugin server (by doing Run As - Web Application)... Any help is greatly appreciated!! Kind regards, Dieter H -- 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=.
[appengine-java] Re: Deployment problems
I made mistake. Admin logs show that I have uploaded updates today. But application works just like yesterday app. When I run it locally I see changes. On Nov 12, 4:46 pm, Max max.seven@gmail.com wrote: He is screenshot http://yfrog.com/0isnapshot2jzp On Nov 12, 4:45 pm, Max max.seven@gmail.com wrote: I was able to deploy project until yesterday. When I deploy project throw plugin in eclipse I get messages in console as usually Creating staging directory Scanning for jsp files. Scanning files on local disk. Scanned 250 files. Initiating update. Cloning 92 static files. Cloning 236 application files. Cloned 100 files. Cloned 200 files. Uploading 0 files. Deploying new version. Will check again in 1 seconds Will check again in 2 seconds Closing update: new version is ready to start serving. Uploading index definitions. Deployment completed successfully But in Admin logs last update was yesterday. Yesterday I had similar problems but after eclipse restart it was updating project. Today nothing helps. I can run project locally and it has all latest updates. How can I fix it? 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-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=.
[appengine-java] Re: Deployment problems
It started to work and now projects updates. It is very odd. I sorry for bothering. On Nov 12, 4:53 pm, Max max.seven@gmail.com wrote: I made mistake. Admin logs show that I have uploaded updates today. But application works just like yesterday app. When I run it locally I see changes. On Nov 12, 4:46 pm, Max max.seven@gmail.com wrote: He is screenshot http://yfrog.com/0isnapshot2jzp On Nov 12, 4:45 pm, Max max.seven@gmail.com wrote: I was able to deploy project until yesterday. When I deploy project throw plugin in eclipse I get messages in console as usually Creating staging directory Scanning for jsp files. Scanning files on local disk. Scanned 250 files. Initiating update. Cloning 92 static files. Cloning 236 application files. Cloned 100 files. Cloned 200 files. Uploading 0 files. Deploying new version. Will check again in 1 seconds Will check again in 2 seconds Closing update: new version is ready to start serving. Uploading index definitions. Deployment completed successfully But in Admin logs last update was yesterday. Yesterday I had similar problems but after eclipse restart it was updating project. Today nothing helps. I can run project locally and it has all latest updates. How can I fix it? 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-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=.
[appengine-java] image resize transform
I am trying to resize JPEG images from 100x100 original to smaller 85x85 size. The transformation apparently works, but the smaller image is LARGER bytes-wise?! An important reason for my making the images smaller is to reduce their data size. The same transformation using ImageMagick's 'convert' makes images smaller in data size. Additionally 'convert' takes 'quality' option that helps to further reduce the image size; it would make a great addition to the API! Why are my transformed images bigger than the originals? -- 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=.
[appengine-java] Re: Entity Group limitations
I was under the impression that transaction updates could only occur to 1 Entity Group at a time and I understand that. But, it appears during the transaction we also can NOT read another Entity Group...is that correct? If so, that seems to be quite limiting to NOT be able to collect information from other Entity Groups A, B (ie reads) in preparation for the update to the targeted Entity Group C. Am I missing something? J On Nov 10, 4:37 pm, Ikai L (Google) ika...@google.com wrote: James, For all practical intents and purposes, there are no limits on the number of entity kinds per entity group or limits imposed by the underlying physical hardware. On Fri, Nov 6, 2009 at 6:56 PM, James H james.hollier...@gmail.com wrote: Is there any limit on number of entity kinds per entity group or any limit on amount of physical storage consumed by a single entity group? -- 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-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=.
[appengine-java] Re: JDO/JPA Snippets That Work - Updating a bidirectional, owned, one-to-many relationship with a new child
Max Ross, I took time to review and enter discussion relating to your snippet. In that thread above I raised questions, but never heard back...please have a look. On Nov 2, 12:55 pm, Max Ross (Google) maxr+appeng...@google.com wrote: Looking in the debugger is not a good indication of what is and is not set because jdo-enhanced classes perform lazy loading when the fields are accessed. If you call a getter method and System.out.println() the result is it still null? Feel free to send me your model objects and your persistence code with some println()s showing me the problem and I'll have a look. Max On Tue, Oct 27, 2009 at 5:28 PM, stanlick stanl...@gmail.com wrote: Hey Max -- At what point are you validating this? I am breaking after the commit and also after a subsequent query.execute(). Dude, it is about to make me jump off a bridge. P.S. I'm not a good swimmer, so please throw me a clue. Scott On Oct 27, 12:25 pm, Max Ross (Google) maxr+appeng...@google.commaxr%2bappeng...@google.com wrote: At what point are you checking to see if the parent property of the child is populated? I see that the newly created Chapter's Book property is populated when addChapterToBook() completes. Max On Tue, Oct 27, 2009 at 8:31 AM, stanlick stanl...@gmail.com wrote: This code saves the child for me, however, the parent property of the child (in your case book) is null in the child. I have tried deliberately setting this child parent property myself to the parent prior to commit, but nothing seems to work. On Sep 28, 6:45 pm, Max Ross maxr+appeng...@google.commaxr%2bappeng...@google.com maxr%2bappeng...@google.com maxr%252bappeng...@google.com wrote: Hello again and welcome to Episode 3 of JDO/JPA Snippets That Work. Today's episode is called.. Updating A Bidrectional Owned One-To-Many With A New Child All the way back in episode one we demonstrated how to create both a parent and a child of a bidirectional, owned, one-to-many relationship at the same time. This week we're going to see how to add a child to an existing parent. We'll use the same model objects we used in episode one: JPA: @Entity public class Book { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Key id; private String title; @OneToMany(mappedBy = book, cascade = CascadeType.ALL) private ListChapter chapters = new ArrayListChapter(); // getters and setters } @Entity public class Chapter { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Key id; private String title; private int numPages; @ManyToOne(fetch = FetchType.LAZY) private Book book; // getters and setters } Now let's assume we've already created a book with a few chapters in the datastore and we want to add a brand new chapter to a Book with a given id (we'll assume someone else is creating and closing an EntityManager named 'em' for us): public void addChapterToBook(EntityManager em, Key bookKey, Chapter chapter) { em.getTransaction().begin(); try { Book b = em.find(Book.class, bookKey); if (b == null) { throw new RuntimeException(Book + bookKey + not found!); } b.getChapters().add(chapter); em.getTransaction().commit(); } finally { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } } } JDO: @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = true) public class Book { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key id; private String title; @Persistent(mappedBy = book) @Element(dependent = true) @Order(extensions = @Extension(vendorName=datanucleus, key= list-ordering, value=id asc)) private ListChapter chapters = new ArrayListChapter(); // getters and setters } @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = true) public class Chapter { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key id; private String title; private int numPages; @Persistent private Book book; // getters and setters } Now let's assume we've already created a book with a few chapters in the datastore and we want to add a brand new chapter to a Book with a given id (we'll assume someone else is creating and closing a PersistenceManager named 'pm' for us): public void
[appengine-java] Re: Singleton / Single Thread / Table Lock
Ikai, This is not really a relational data question. It is a summary data question. To give a brief overview on my approach; here is the history over the past 20 years on my approach to summary information: 1. Calculate the summary information on the fly per user request. Very database intensive and potentially slow performance for the user. 2. Create summary data tables which the application can read very quickly, use database triggers to create/update the summary values. Improved user experience, but has a penalty at write time and requires developers to know two tools (database triggers and application language). 3. Same approach as number 2, but create/update the summary values in the application code. Reduces maintenance headaches by having a single tool, makes the write performance a little worse because now the transaction spans computers/servers. Since servers are cheap and developers are not, this became the preferred approach. 4. Avoid the possible create/search of step two/three and assume a summary record exists at time of write. Increases performance by eliminating the check for a summary record at each write, downside; need an asynchronous process to pre-create all possible summary records and prune ones which never were used after a reasonable time. Depending on the requirements, I prefer the first or forth choice (mostly read to write ratio is what matters). However, it is hard to create a long running process via the existing toolset and constraints provided by GAE. Because of this, I was falling back to the third option; which was the basis for my original question. (I am looking into trying to break the process into many 30 seconds or less tasks, but it is not looking like a practical solution yet. This is another reason we need to get support for long running batch processes within GAE.) Tim On Nov 10, 5:44 pm, Ikai L (Google) ika...@google.com wrote: Tim, It really depends on what you're doing. One of the challenges of developing on a distributed store like the App Engine data store is adjusting the way you approach persistence for objects. For instance, suppose you store favorite colors per application user. The canonical way of solving this problem in a relational environment is to normalize the color data and create a lock around inserting each individual new color. In App Engine's environment, we would likely recommend that you take advantage of data store list properties as a much more performant alternative to data normalization: App Engine will handle all the indexing for you. If you are working with objects in parent/child relationships and require transactional integrity, you should take a look at our documentation describing Entities and Entity Groups:http://code.google.com/appengine/docs/java/datastore/transactions.html. On Fri, Nov 6, 2009 at 12:12 PM, tsp...@tangiblesoftware.com tsp...@tangiblesoftware.com wrote: Guys, In a normal relational database, I am used to using a combination of singletons (single application server), synchronized objects in a dedicated thread (single application server) or table locks (multiple application servers) to manage the creation of summary data records which could created by multiple simultaneous requests. In GAE, none of the methods seem to be supported; what would be the suggested method? I am using the JPA method of accessing the data store. Thanks, Tim -- 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-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=.
[appengine-java] Preventing GWT compile during deployment
How do I stop the GAE Deploy process from doing a GWT compile? -- 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=.
[appengine-java] Jetty compiled JSPs
Where are the compiled JSPs stored on the local filesystem? I don't see them in my workspace files. -- 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=.
Re: [appengine-java] ClassCastException when calling remove on a one to many owned relationship
Looks like you're running into http://code.google.com/p/datanucleus-appengine/issues/detail?id=126 This is a lousy bug report, and I can say that without fear of offending anyone because I'm responsible for it. The fix will be available in the next SDK (currently working its way through QA). In the meantime the workaround is to use a Key primary key on the parent object. Sorry for the trouble, Max On Wed, Nov 11, 2009 at 10:23 PM, Peter Recore peterrec...@gmail.comwrote: Here's the stacktrace I get when calling remove on a list containing child elements of a one to many owned relationship. java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String at org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.removeAt (DatastoreFKListStoreSpecialization.java:155) at org.datanucleus.store.mapped.scostore.FKListStore.removeAt (FKListStore.java:525) at org.datanucleus.store.mapped.scostore.AbstractListStore.remove (AbstractListStore.java:318) at org.datanucleus.sco.backed.List.remove(List.java:907) at usabletek.plyus.server.TestEntity.demonstrateProblem (TestEntity.java:31) I'm trying to figure out if I'm not allowed to use Longs as primary keys, or if this is a bug, or if I'm doing something else wrong with the relationship. Here's as minimal an example as I can come up with: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class TestEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent(mappedBy = parent) private ListTestChildEntity childEntities; public ListTestChildEntity getChildEntities() { return childEntities; } public static void demonstrateProblem(){ PersistenceManager pm = PMF.get().getPersistenceManager(); TestEntity te = new TestEntity(); pm.makePersistent(te); te.getChildEntities().add(new TestChildEntity(a)); te.getChildEntities().remove(0); pm.close(); } } @PersistenceCapable(identityType = IdentityType.APPLICATION) public class TestChildEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName = datanucleus, key = gae.encoded-pk, value = true) private String encodedKey; @Persistent @Extension(vendorName = datanucleus, key = gae.pk-name, value = true) private String keyName; @Persistent private TestEntity parent; public TestChildEntity(String k){ this.keyName = k; } } -- 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=. -- 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=.
[appengine-java] 500 Internal Server Error, when update appl
Hi Team, Last two day i can't update appl, what is wrong? Please see detail log: Unable to update: java.io.IOException: Error posting to URL: http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcoreversion=2; 500 Internal Server Error Server Error (500) A server error has occurred. at com.google.appengine.tools.admin.ServerConnection.send (ServerConnection.java:143) at com.google.appengine.tools.admin.ServerConnection.post (ServerConnection.java:81) at com.google.appengine.tools.admin.AppVersionUpload.send (AppVersionUpload.java:427) at com.google.appengine.tools.admin.AppVersionUpload.cloneFiles (AppVersionUpload.java:293) at com.google.appengine.tools.admin.AppVersionUpload.beginTransaction (AppVersionUpload.java:255) at com.google.appengine.tools.admin.AppVersionUpload.doUpload (AppVersionUpload.java:98) at com.google.appengine.tools.admin.AppAdminImpl.update (AppAdminImpl.java:56) at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute (AppCfg.java:521) at com.google.appengine.tools.admin.AppCfg.init(AppCfg.java:130) at com.google.appengine.tools.admin.AppCfg.init(AppCfg.java:58) at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54) com.google.appengine.tools.admin.AdminException: Unable to update app: Error posting to URL: http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcoreversion=2; 500 Internal Server Error Server Error (500) A server error has occurred. at com.google.appengine.tools.admin.AppAdminImpl.update (AppAdminImpl.java:62) at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute (AppCfg.java:521) at com.google.appengine.tools.admin.AppCfg.init(AppCfg.java:130) at com.google.appengine.tools.admin.AppCfg.init(AppCfg.java:58) at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54) Caused by: java.io.IOException: Error posting to URL: http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcoreversion=2; 500 Internal Server Error Server Error (500) A server error has occurred. at com.google.appengine.tools.admin.ServerConnection.send (ServerConnection.java:143) at com.google.appengine.tools.admin.ServerConnection.post (ServerConnection.java:81) at com.google.appengine.tools.admin.AppVersionUpload.send (AppVersionUpload.java:427) at com.google.appengine.tools.admin.AppVersionUpload.cloneFiles (AppVersionUpload.java:293) at com.google.appengine.tools.admin.AppVersionUpload.beginTransaction (AppVersionUpload.java:255) at com.google.appengine.tools.admin.AppVersionUpload.doUpload (AppVersionUpload.java:98) at com.google.appengine.tools.admin.AppAdminImpl.update (AppAdminImpl.java:56) ... 4 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-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=.
[appengine-java] Re: Session handleing example
I am having the same problem. Object on my local GAE install can't be stored in the session. Very detrimental for user session management. Here is the line in my appengine-web.xml: sessions-enabledtrue/sessions-enabled I store my user in session from inside a Filter: HttpSession session = httpRequest.getSession(); session.setAttribute(WebConstants.USER_KEY, user); When I try to retrieve the user in my JSP, I get a null for % User user = (User) session.getAttribute(WebConstants.USER_KEY); % How is this possible such basic JSP handling could be failing? Could you please explain? Thanks. On Nov 11, 11:51 am, Ikai L (Google) ika...@google.com wrote: Ilya, One thing you will want to check will be if sessions are enabled. Sessions are off by default, so you'll have to add this line to your appengine-web.xml file: sessions-enabledtrue/sessions-enabled http://code.google.com/appengine/docs/java/config/appconfig.html#Enab... On Tue, Nov 10, 2009 at 12:03 PM, IlyaE ilyaelk...@gmail.com wrote: I'm looking to track a user session if they have logged in using my own user manager, but i was having trouble passing my user object back to the session once the app was deployed. I will give this a shot but i wonder if this was because i was redirecting instead of forwarding. I was doing this in my servlet ListMyUser results = (ListMyUser) query.execute(email,password); if (results.size() == 0) { redirect = /index.html; } else { req.getSession().setAttribute(user, results.get(0)); } resp.sendRedirect(redirect); and this in my jsp % MyUser u = (MyUser) request.getSession().getAttribute(user); if (u != null) { } else { % User is null % } % So i was always getting null even though i was redirected properly. Can you explain On Nov 10, 1:36 pm, Ikai L (Google) ika...@google.com wrote: Ilya, Are you looking to persist objects for a lifetime of a session, or are you looking to minimize the logic you are using in your JSPs? As a general design principle, we recommend that you minimize usage of session scope. Variables bound to session scope are serialized and stored to distributed memory, and as a result, it will work best if you use it to pass around small, simple, immutable objects. If you're looking to pass a variable to a view, Java Servlets have a concept of page scope as well as session scope. You don't need to store a variable in session scope if you just want to dispatch the request to a JSP. For instance, you can define a Servlet that looks like this: public class MyServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String myVar = this is a string that will be passed to the JSP; request.setAttribute(myVar, myVar); RequestDispatcher dispatcher = request.getRequestDispatcher(/WEB-INF/my.jsp); dispatcher.forward(request, response); } } In my.jsp, you can now refer to this variable: %@ page isELIgnored=false % body h1${myVar}/h1 /body Ikai Lan Developer Programs Engineer, Google App Engine On Tue, Nov 10, 2009 at 2:39 PM, IlyaE ilyaelk...@gmail.com wrote: Well as i found out, session attributes don't always guarantee that they are sent back to the same JVM thus i keep getting null objects in my view. While i saw a similar discussion before the only examples i found were for Python. I'm looking for a simple java example that saves an object in the servlet and retrieves it in the jsp. On Nov 9, 5:44 pm, victor victoraco...@gmail.com wrote: What issue are you encountering? When you make changes to a session object state, make sure to explicitly call the session.setAttribute(you session ID, you modified session state object) again. i think there is an issue discussed about this before. On Nov 9, 10:58 am, IlyaE ilyaelk...@gmail.com wrote: Does anyone have a java session handleing example? It seems that saving objects in the session only works locally. -- 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-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=.
[appengine-java] Re: Watermark an image
I ran into the same problem. Also the only background color that shows up is black even though I set the color to green. Anyone with suggestions? Thanks On Oct 8, 9:36 pm, Mike m...@mikeprince.com wrote: I am using thecompositemethods mentioned above, but the transparency of my PNG is not honored. I have tried running the code both on my Windows dev machine and also on the google servers with the same results. Any workarounds or is this a known problem? Thanks, Mike -- 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=.
[appengine-java] plz ignore my previous post... my mistake... about the actionlistener.... sorry....
sorry shit happens :) -- 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=.
[appengine-java] Can't set object in Session of Request from javax.servlet.Filter
Using Java app-engine SDK 1.2.2, running locally. 1. My session is enabled in appengine-web.xml : sessions- enabledtrue/sessions-enabled 2. From a javax.servlet.Filter filtering all requests, I create a user object and set it in the session: HttpServletRequest httpRequest = (HttpServletRequest) request; HttpSession session = httpRequest.getSession(); // create a user User user = myfactory... session.setAttribute(WebConstants.USER_KEY, user); 3. I try to retrieve that object in JSP: User currentUser = (User) session.getAttribute(WebConstants.USER_KEY); - Result: null Why is this not working? -- 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=.
[appengine-java] @MappedSuperclass containing Key is causing DataNucleus NPE on remove
I created a JPA @MappedSuperclass containing the Key for all my model objects, so that I could encapsulate the GAE-specific code. (Instead of using Keys directly, inter-component communication is using Long ID's for possible compatibility with other backing stores.) When I put the Key instance in the superclass instead of the concrete instance, most things work -- except for removing children. Both removing from a Collection and calling em.remove() on the instance results in a NPE from the guts of DataNucleus, though I have not yet been able to try out a RDBMS with standalone DataNucleus JARs to verify the error in other environments. Exception can be seen here: http://entitytest.latest.duh-test.appspot.com/ The sample code to reproduce the issue is available here: http://entitytest.latest.duh-test.appspot.com/src/entitytest/GaeDatum.java http://entitytest.latest.duh-test.appspot.com/src/entitytest/ParentTestEntity.java http://entitytest.latest.duh-test.appspot.com/src/entitytest/ChildTestEntity.java http://entitytest.latest.duh-test.appspot.com/src/entitytest/EntityTestServlet.java Backtrace contents also preserved below (snipped at servlet entry point) for search history: = successfully added parent successfully added child; parent now shows 1 java.lang.NullPointerException at org.datanucleus.store.mapped.mapping.PersistenceCapableMapping.getObjectForApplicationIdentity (PersistenceCapableMapping.java:971) at org.datanucleus.store.mapped.mapping.PersistenceCapableMapping.getObject (PersistenceCapableMapping.java:720) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.lookupParent (DatastoreRelationFieldManager.java:309) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.fetchRelationField (DatastoreRelationFieldManager.java:289) at org.datanucleus.store.appengine.DatastoreFieldManager.fetchObjectField (DatastoreFieldManager.java:271) at org.datanucleus.state.AbstractStateManager.replacingObjectField (AbstractStateManager.java:1197) at entitytest.ChildTestEntity.jdoReplaceField(ChildTestEntity.java) at entitytest.ChildTestEntity.jdoReplaceFields(ChildTestEntity.java) at org.datanucleus.state.JDOStateManagerImpl.replaceFields (JDOStateManagerImpl.java:2772) at org.datanucleus.state.JDOStateManagerImpl.replaceFields (JDOStateManagerImpl.java:2791) at org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject (DatastorePersistenceHandler.java:443) at org.datanucleus.state.JDOStateManagerImpl.loadSpecifiedFields (JDOStateManagerImpl.java:1519) at org.datanucleus.state.JDOStateManagerImpl.isLoaded (JDOStateManagerImpl.java:1925) at org.datanucleus.jpa.JPAAdapter.isLoaded(JPAAdapter.java:834) at org.datanucleus.store.mapped.mapping.PersistenceCapableMapping.preDelete (PersistenceCapableMapping.java:1132) at org.datanucleus.store.appengine.DependentDeleteRequest.execute (DependentDeleteRequest.java:71) at org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject (DatastorePersistenceHandler.java:533) at org.datanucleus.state.JDOStateManagerImpl.internalDeletePersistent (JDOStateManagerImpl.java:4198) at org.datanucleus.state.JDOStateManagerImpl.deletePersistent (JDOStateManagerImpl.java:4166) at org.datanucleus.ObjectManagerImpl.deleteObjectInternal (ObjectManagerImpl.java:1470) at org.datanucleus.store.mapped.scostore.FKListStore.clear (FKListStore.java:585) at org.datanucleus.sco.queued.ClearOperation.perform (ClearOperation.java:39) at org.datanucleus.sco.backed.List.flush(List.java:270) at org.datanucleus.store.mapped.mapping.CollectionMapping.postUpdate (CollectionMapping.java:208) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.runPostUpdateMappingCallbacks (DatastoreRelationFieldManager.java:232) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.access $400(DatastoreRelationFieldManager.java:49) at org.datanucleus.store.appengine.DatastoreRelationFieldManager $1.apply(DatastoreRelationFieldManager.java:114) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.storeRelations (DatastoreRelationFieldManager.java:80) at org.datanucleus.store.appengine.DatastoreFieldManager.storeRelations (DatastoreFieldManager.java:795) at org.datanucleus.store.appengine.DatastorePersistenceHandler.updateObject (DatastorePersistenceHandler.java:494) at org.datanucleus.state.JDOStateManagerImpl.flush (JDOStateManagerImpl.java:4576) at org.datanucleus.ObjectManagerImpl.flushInternal (ObjectManagerImpl.java:2814) at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java: 2754) at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java: 2893) at org.datanucleus.TransactionImpl.internalPreCommit (TransactionImpl.java:369)
[appengine-java] long ID of child objects restarts at 1 for every parent?
I haven't programmatically tested this for problems yet, but looking at the datastore viewer for the app that I created for the @MappedSuperclass test case (other thread), all the child objects seem to have id=1 rather than pulling from a common ID generation pool as is done on the localhost development server. This is disturbing because EntityManager.find(Long) is supposed to work for all Kinds, AFAIK, and does in the dev server. Should I expect Key.getId() to return a globally unique number for all persisted objects, or is it only unique relative to its parent Key? (The objects in question are using Key references for the underlying classes, not Long references, to avoid other problems with Long @Id fields noted in other threads.) -- 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=.
[appengine-java] JSF 2.0.1 java.lang.ClassNotFoundException: void
Problem using majorra 2.0.1 and GAE 1.2.6, but some times pages render correctly. javax.servlet.ServletException: java.lang.RuntimeException: java.lang.ClassNotFoundException: void at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle (AppVersionHandlerMap.java:240) 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 com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable (RpcRequestParser.java:76) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest (JettyServletEngineAdapter.java:139) at com.google.apphosting.runtime.JavaRuntime.handleRequest (JavaRuntime.java:239) at com.google.apphosting.base.RuntimePb$EvaluationRuntime $6.handleBlockingRequest(RuntimePb.java:5135) at com.google.apphosting.base.RuntimePb$EvaluationRuntime $6.handleBlockingRequest(RuntimePb.java:5133) at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest (BlockingApplicationHandler.java:24) at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java: 363) at com.google.net.rpc.impl.Server$2.run(Server.java:814) at com.google.tracing.LocalTraceSpanRunnable.run (LocalTraceSpanRunnable.java:56) at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan (LocalTraceSpanBuilder.java:516) at com.google.net.rpc.impl.Server.startRpc(Server.java:769) at com.google.net.rpc.impl.Server.processRequest(Server.java:351) at com.google.net.rpc.impl.ServerConnection.messageReceived (ServerConnection.java:437) at com.google.net.rpc.impl.RpcConnection.parseMessages (RpcConnection.java:319) at com.google.net.rpc.impl.RpcConnection.dataReceived (RpcConnection.java:290) at com.google.net.async.Connection.handleReadEvent(Connection.java: 436) at com.google.net.async.EventDispatcher.processNetworkEvents (EventDispatcher.java:762) at com.google.net.async.EventDispatcher.internalLoop (EventDispatcher.java:207) at com.google.net.async.EventDispatcher.loop(EventDispatcher.java: 101) at com.google.net.rpc.RpcService.runUntilServerShutdown (RpcService.java:251) at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run (JavaRuntime.java:396) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: void at com.google.apphosting.runtime.jetty.SessionManager.deserialize (SessionManager.java:389) at com.google.apphosting.runtime.jetty.SessionManager.loadSession (SessionManager.java:307) at com.google.apphosting.runtime.jetty.SessionManager.getSession (SessionManager.java:282) at org.mortbay.jetty.servlet.AbstractSessionManager.getHttpSession (AbstractSessionManager.java:237) at org.mortbay.jetty.Request.getSession(Request.java:998) at com.sun.faces.application.WebappLifecycleListener.syncSessionScopedBeans (WebappLifecycleListener.java:393) at com.sun.faces.application.WebappLifecycleListener.requestDestroyed (WebappLifecycleListener.java:117) at com.sun.faces.config.ConfigureListener.requestDestroyed (ConfigureListener.java:341) at org.mortbay.jetty.handler.ContextHandler.handle (ContextHandler.java:725) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java: 405) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle (AppVersionHandlerMap.java:238) ... 27 more Caused by: java.lang.ClassNotFoundException: void at com.google.appengine.runtime.Request.process-7a0672406190a0e0 (Request.java) ... 35 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-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=.
[appengine-java] Re: @MappedSuperclass containing Key is causing DataNucleus NPE on remove
FWIW. I see little point in trying with RDBMS since the calling code here is the GAE/J plugin org.datanucleus.store.appengine.DatastoreRelationFieldManager.lookupParent (DatastoreRelationFieldManager.java:309) and the JPA TCK tests all such operations for RDBMS and DataNucleus passes for RDBMS. -- 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=.
[appengine-java] duplicate jdoconfig.xml due to unit testing (eclipse)
hello, my GAE project in eclipse has the following structure (maven-like) *) src/main contains my application - it is comiled to war/WEB-INF/ classes *) src/test contain my junit tests - it is compiled to target/test in both source folders (src/main and src/test) I have a META-INF folder with a jdoconfig.xml, since I am using a different config for the unit tests. When running the junit tests, I get a JDOFatalUserException since there is a duplicate PMF with the same name. Consequently, when running the junit tests it seems to load the jdoconfig from both locations - war/WEB-INF/classes and target/test. Has anybody experienced similar problems and a solution or workaround for that? Thanks and regards, andr -- 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=.
[appengine-java] Re: trouble with SDK 1.2.6
same here, when I try to have my junit tests in the same project. anyone got a solution? On 28 Okt., 18:22, Vince Bonfanti vbonfa...@gmail.com wrote: No, that didn't help. Again, just to make sure I'm being clear: - The only reason appengine-api-stubs.jar and appengine-local-runtime.jar are in my project classpath is to be able to compile my junit tests. They're not needed for debugging my project. However... - When creating a debug configuration, Eclipse automatically uses the project classpath by default, which causes the exceptions I showed earlier when trying to debug. Adding appengine-agent.jar to the top of the project and debug classpaths did not solve the problem. - By manually editing my debug configuration to remove appengine-api-stubs.jar and appengine-local-runtime.jar from the debug classpath, everything works fine. At this point I'm happy. Vince On Fri, Oct 23, 2009 at 3:55 PM, Toby Reyelts to...@google.com wrote: Vince, You should be able to workaround the problem you're having with your unit tests by adding $SDK/lib/agent/appengine-agent.jar to the very top of your system classpath. Please let me know if that does not work for you. On Fri, Oct 23, 2009 at 3:23 PM, Vince Bonfanti vbonfa...@gmail.com wrote: It looks like the Eclipse debug configuration automatically picks up the complete build path for the project as its classpath. Manually editing the debug configuration to remove appengine-api-stubs.jar and appengine-local-runtime.jar from the classpath fixes the problem. Vince On Fri, Oct 23, 2009 at 3:01 PM, Vince Bonfanti vbonfa...@gmail.com wrote: I just figured out the problem. I had added appengine-api-stubs.jar and appengine-local-runtime.jar to my project build path to support junit testing. Upgrading to the 1.2.6 versions only changed the error message, but removing them from the build path solved the problem. Now I just have to figure out how to configure things properly to support junit testing... Thanks. Vince 2009/10/23 Miguel Méndez mmen...@google.com: I'm going to check and see if I can reproduce this using your project.- Zitierten Text ausblenden - - Zitierten Text anzeigen - -- 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=.
[appengine-java] Re: Session handleing example
Steph, I have modified my code to make use of RequestDispatcher dispatcher = req.getRequestDispatcher(redirect); dispatcher.forward(req, resp); and this seems to fix the issue. Once i have authenticated my user and forwarded, every subsequent redirect or forward maintains the proper session. On Nov 12, 3:35 am, Steph steph@gmail.com wrote: I am having the same problem. Object on my local GAE install can't be stored in the session. Very detrimental for user session management. Here is the line in my appengine-web.xml: sessions-enabledtrue/sessions-enabled I store my user in session from inside a Filter: HttpSession session = httpRequest.getSession(); session.setAttribute(WebConstants.USER_KEY, user); When I try to retrieve the user in my JSP, I get a null for % User user = (User) session.getAttribute(WebConstants.USER_KEY); % How is this possible such basic JSP handling could be failing? Could you please explain? Thanks. On Nov 11, 11:51 am, Ikai L (Google) ika...@google.com wrote: Ilya, One thing you will want to check will be if sessions are enabled. Sessions are off by default, so you'll have to add this line to your appengine-web.xml file: sessions-enabledtrue/sessions-enabled http://code.google.com/appengine/docs/java/config/appconfig.html#Enab... On Tue, Nov 10, 2009 at 12:03 PM, IlyaE ilyaelk...@gmail.com wrote: I'm looking to track a user session if they have logged in using my own user manager, but i was having trouble passing my user object back to the session once the app was deployed. I will give this a shot but i wonder if this was because i was redirecting instead of forwarding. I was doing this in my servlet ListMyUser results = (ListMyUser) query.execute(email,password); if (results.size() == 0) { redirect = /index.html; } else { req.getSession().setAttribute(user, results.get(0)); } resp.sendRedirect(redirect); and this in my jsp % MyUser u = (MyUser) request.getSession().getAttribute(user); if (u != null) { } else { % User is null % } % So i was always getting null even though i was redirected properly. Can you explain On Nov 10, 1:36 pm, Ikai L (Google) ika...@google.com wrote: Ilya, Are you looking to persist objects for a lifetime of a session, or are you looking to minimize the logic you are using in your JSPs? As a general design principle, we recommend that you minimize usage of session scope. Variables bound to session scope are serialized and stored to distributed memory, and as a result, it will work best if you use it to pass around small, simple, immutable objects. If you're looking to pass a variable to a view, Java Servlets have a concept of page scope as well as session scope. You don't need to store a variable in session scope if you just want to dispatch the request to a JSP. For instance, you can define a Servlet that looks like this: public class MyServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String myVar = this is a string that will be passed to the JSP; request.setAttribute(myVar, myVar); RequestDispatcher dispatcher = request.getRequestDispatcher(/WEB-INF/my.jsp); dispatcher.forward(request, response); } } In my.jsp, you can now refer to this variable: %@ page isELIgnored=false % body h1${myVar}/h1 /body Ikai Lan Developer Programs Engineer, Google App Engine On Tue, Nov 10, 2009 at 2:39 PM, IlyaE ilyaelk...@gmail.com wrote: Well as i found out, session attributes don't always guarantee that they are sent back to the same JVM thus i keep getting null objects in my view. While i saw a similar discussion before the only examples i found were for Python. I'm looking for a simple java example that saves an object in the servlet and retrieves it in the jsp. On Nov 9, 5:44 pm, victor victoraco...@gmail.com wrote: What issue are you encountering? When you make changes to a session object state, make sure to explicitly call the session.setAttribute(you session ID, you modified session state object) again. i think there is an issue discussed about this before. On Nov 9, 10:58 am, IlyaE ilyaelk...@gmail.com wrote: Does anyone have a java session handleing example? It seems that saving objects in the session only works locally. -- 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
[appengine-java] Re: long ID of child objects restarts at 1 for every parent?
On Nov 12, 12:53 pm, Todd Vierling t...@duh.org wrote: Should I expect Key.getId() to return a globally unique number for all persisted objects, or is it only unique relative to its parent Key? (The objects in question are using Key references for the underlying classes, not Long references, to avoid other problems with Long @Id fields noted in other threads.) Ah, I see the issue after further dev-testing: when Key is the embedded field, it's the only way to retrieve child instances via find () (the long id embedded in the Key is not valid for lookups in that case). This question can be ignored. -- 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=.
Re: [appengine-java] HELP WITH ACCOUNT SETUP
Can you submit your request to the SMS waitlist? https://appengine.google.com/waitlist/sms_issues On Thu, Nov 12, 2009 at 6:10 AM, Brickhouse aaron.s...@gmail.com wrote: Apparently there was a problem on my end that prevented me from getting the sms code during account set up. Since I had tried to send the validation code a number of times, I am now unable to resend the code to my number due to me sending too many SMS messages. Is there someone who can clear this for me so I can proceed? 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-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=. -- 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-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=.
Re: [appengine-java] Re: Session handleing example
Ilya, This will surface the object in request scope, but you should not be having problems with objects stored in session scope. I'm investigating the issues regarding objects in session scope when deployed. On Thu, Nov 12, 2009 at 10:39 AM, IlyaE ilyaelk...@gmail.com wrote: Steph, I have modified my code to make use of RequestDispatcher dispatcher = req.getRequestDispatcher(redirect); dispatcher.forward(req, resp); and this seems to fix the issue. Once i have authenticated my user and forwarded, every subsequent redirect or forward maintains the proper session. On Nov 12, 3:35 am, Steph steph@gmail.com wrote: I am having the same problem. Object on my local GAE install can't be stored in the session. Very detrimental for user session management. Here is the line in my appengine-web.xml: sessions-enabledtrue/sessions-enabled I store my user in session from inside a Filter: HttpSession session = httpRequest.getSession(); session.setAttribute(WebConstants.USER_KEY, user); When I try to retrieve the user in my JSP, I get a null for % User user = (User) session.getAttribute(WebConstants.USER_KEY); % How is this possible such basic JSP handling could be failing? Could you please explain? Thanks. On Nov 11, 11:51 am, Ikai L (Google) ika...@google.com wrote: Ilya, One thing you will want to check will be if sessions are enabled. Sessions are off by default, so you'll have to add this line to your appengine-web.xml file: sessions-enabledtrue/sessions-enabled http://code.google.com/appengine/docs/java/config/appconfig.html#Enab. .. On Tue, Nov 10, 2009 at 12:03 PM, IlyaE ilyaelk...@gmail.com wrote: I'm looking to track a user session if they have logged in using my own user manager, but i was having trouble passing my user object back to the session once the app was deployed. I will give this a shot but i wonder if this was because i was redirecting instead of forwarding. I was doing this in my servlet ListMyUser results = (ListMyUser) query.execute(email,password); if (results.size() == 0) { redirect = /index.html; } else { req.getSession().setAttribute(user, results.get(0)); } resp.sendRedirect(redirect); and this in my jsp % MyUser u = (MyUser) request.getSession().getAttribute(user); if (u != null) { } else { % User is null % } % So i was always getting null even though i was redirected properly. Can you explain On Nov 10, 1:36 pm, Ikai L (Google) ika...@google.com wrote: Ilya, Are you looking to persist objects for a lifetime of a session, or are you looking to minimize the logic you are using in your JSPs? As a general design principle, we recommend that you minimize usage of session scope. Variables bound to session scope are serialized and stored to distributed memory, and as a result, it will work best if you use it to pass around small, simple, immutable objects. If you're looking to pass a variable to a view, Java Servlets have a concept of page scope as well as session scope. You don't need to store a variable in session scope if you just want to dispatch the request to a JSP. For instance, you can define a Servlet that looks like this: public class MyServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String myVar = this is a string that will be passed to the JSP; request.setAttribute(myVar, myVar); RequestDispatcher dispatcher = request.getRequestDispatcher(/WEB-INF/my.jsp); dispatcher.forward(request, response); } } In my.jsp, you can now refer to this variable: %@ page isELIgnored=false % body h1${myVar}/h1 /body Ikai Lan Developer Programs Engineer, Google App Engine On Tue, Nov 10, 2009 at 2:39 PM, IlyaE ilyaelk...@gmail.com wrote: Well as i found out, session attributes don't always guarantee that they are sent back to the same JVM thus i keep getting null objects in my view. While i saw a similar discussion before the only examples i found were for Python. I'm looking for a simple java example that saves an object in the servlet and retrieves it in the jsp. On Nov 9, 5:44 pm, victor victoraco...@gmail.com wrote: What issue are you encountering? When you make changes to a session object state, make sure to explicitly call the session.setAttribute(you session ID, you modified session state object) again. i think there is an issue discussed about this
Re: [appengine-java] logs in dashboard ... how do they work?
Mark, Glad you like it! Unfortunately, this isn't open source. We store and index log entries in BigTable rather than append to a file, so it wouldn't be particularly useful to most users of Java logging. I could have sworn I've seen this feature in Glassfish's admin GUI before, but I might be thinking of a different feature. I've also seen people use Splunk which collects and indexes logs, displaying them in a pretty slick web interface. It's not open source, but there is a free version that handles a reasonable amount of logging before requiring a paid upgrade. On Wed, Nov 11, 2009 at 9:59 AM, fence markrsteph...@gmail.com wrote: I love the way that the google app engine does logs. It's very useful to filter by info / error / warn and then just click the + to expand the message complete with stack trace. I want be able to do this with my spring app in a normal tomcat / glassfish container. Is this backed by some open source software that might make this possible? --~--~-~--~~~---~--~~ 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~--- -- 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-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=.
Re: [appengine-java] Re: Entity design tips for global Membership data
James, Yes, it seems like I misunderstood your original question. Our data store is distributed. Static assets are distributed via a CDN, however, dynamic requests that are handing by App Engine apps are routed to data centers serving App Engine requests. We don't currently route requests to the nearest data center, though if we did we'd probably do it by IP addresses and not email domain. On Wed, Nov 11, 2009 at 6:57 AM, James H james.hollier...@gmail.com wrote: Ok, so if we have a single entity named Membership and a property could be their email domain suffix like Membership.domainSuffix=.com, .net, .uk, etc right? And querying on this property would auto-create an Index on domainSuffix. How would this alone help GAE to distribute the data such that .uk member data is likely to be located on servers in the UK and so on? distributing CRUD operations for you...what is actually distributed here Ikai? Do you mean the processing is distributed (ie the use of app servers) or the data partitions are distributed near their originating Users within google infrastructure. Virtually every google app has this same problem to solve and if there is a Best Practice offered then as a whole the entire google infrastructure will benefit from efficient implementations of this most common requirement. Please advise. On Nov 10, 5:41 pm, Ikai L (Google) ika...@google.com wrote: James, The way I would probably do this would be to create an enum in the scope of the Membership class representing a region and store it as an indexed property. The App Engine data store will take care of distributing the CRUD operations of related data for you. You probably won't get much bang for your buck by creating different entities. By maintaining a single Membership entity, you'll be able to more easily reuse related class. At its most low level, the App Engine datastore is simply a distributed, type agnostic key-value store. App Engine recognizes entities by creating an index for all of your application's Entities, and indexes are created for each property by default. I would recommend creating a Data Access layer and doing the segmentation there. On Tue, Nov 10, 2009 at 1:48 PM, James H james.hollier...@gmail.com wrote: Is there a best practice entity design for storing Membership data that targets a global market? Ideally, the Membership data is partitioned geographically since a Membership in the U.S. is independent of one in the U.K. and elsewhere, for example. The motive is that operations (searches, inserts, updates, deletes) on U.S. data need NOT involve data from the U.K. and elsewhere. Can GAE transparently provide this based on the design of a single Membership Entity or do you have to create separate Entities for each region in your design such as MembershipUS, MembershipUK, etc? -- 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~--- -- 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-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=.
[appengine-java] Re: query.deletePersistentAll() not working !
correction : earlier, even with DeadLineExceed Error query.deletePersistentAll() used to delete entities, now, it doesn't. not sure what happens if DeadLineExceed Error doesn't occur. -- 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=.
Re: [appengine-java] Re: Session handleing example
Steph, Ilya is actually having the opposite problem. I'm can't reproduce either issue. Can you give me more information about what you are trying to set into the session? What version of the SDK are you using? On Thu, Nov 12, 2009 at 12:35 AM, Steph steph@gmail.com wrote: I am having the same problem. Object on my local GAE install can't be stored in the session. Very detrimental for user session management. Here is the line in my appengine-web.xml: sessions-enabledtrue/sessions-enabled I store my user in session from inside a Filter: HttpSession session = httpRequest.getSession(); session.setAttribute(WebConstants.USER_KEY, user); When I try to retrieve the user in my JSP, I get a null for % User user = (User) session.getAttribute(WebConstants.USER_KEY); % How is this possible such basic JSP handling could be failing? Could you please explain? Thanks. On Nov 11, 11:51 am, Ikai L (Google) ika...@google.com wrote: Ilya, One thing you will want to check will be if sessions are enabled. Sessions are off by default, so you'll have to add this line to your appengine-web.xml file: sessions-enabledtrue/sessions-enabled http://code.google.com/appengine/docs/java/config/appconfig.html#Enab... On Tue, Nov 10, 2009 at 12:03 PM, IlyaE ilyaelk...@gmail.com wrote: I'm looking to track a user session if they have logged in using my own user manager, but i was having trouble passing my user object back to the session once the app was deployed. I will give this a shot but i wonder if this was because i was redirecting instead of forwarding. I was doing this in my servlet ListMyUser results = (ListMyUser) query.execute(email,password); if (results.size() == 0) { redirect = /index.html; } else { req.getSession().setAttribute(user, results.get(0)); } resp.sendRedirect(redirect); and this in my jsp % MyUser u = (MyUser) request.getSession().getAttribute(user); if (u != null) { } else { % User is null % } % So i was always getting null even though i was redirected properly. Can you explain On Nov 10, 1:36 pm, Ikai L (Google) ika...@google.com wrote: Ilya, Are you looking to persist objects for a lifetime of a session, or are you looking to minimize the logic you are using in your JSPs? As a general design principle, we recommend that you minimize usage of session scope. Variables bound to session scope are serialized and stored to distributed memory, and as a result, it will work best if you use it to pass around small, simple, immutable objects. If you're looking to pass a variable to a view, Java Servlets have a concept of page scope as well as session scope. You don't need to store a variable in session scope if you just want to dispatch the request to a JSP. For instance, you can define a Servlet that looks like this: public class MyServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String myVar = this is a string that will be passed to the JSP; request.setAttribute(myVar, myVar); RequestDispatcher dispatcher = request.getRequestDispatcher(/WEB-INF/my.jsp); dispatcher.forward(request, response); } } In my.jsp, you can now refer to this variable: %@ page isELIgnored=false % body h1${myVar}/h1 /body Ikai Lan Developer Programs Engineer, Google App Engine On Tue, Nov 10, 2009 at 2:39 PM, IlyaE ilyaelk...@gmail.com wrote: Well as i found out, session attributes don't always guarantee that they are sent back to the same JVM thus i keep getting null objects in my view. While i saw a similar discussion before the only examples i found were for Python. I'm looking for a simple java example that saves an object in the servlet and retrieves it in the jsp. On Nov 9, 5:44 pm, victor victoraco...@gmail.com wrote: What issue are you encountering? When you make changes to a session object state, make sure to explicitly call the session.setAttribute(you session ID, you modified session state object) again. i think there is an issue discussed about this before. On Nov 9, 10:58 am, IlyaE ilyaelk...@gmail.com wrote: Does anyone have a java session handleing example? It seems that saving objects in the session only works locally. -- 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-j...@googlegroups.com. To unsubscribe from this
[appengine-java] Re: Query not working
No, I didn't know about either toad or dbvis. I'll look into them now. I don't think junit would give me anymore info than I can get from the eclipse debugger in this situation. Dukha On Nov 12, 6:18 pm, David Brown geezens...@gmail.com wrote: Have you tried using an outside tool like TOAD or DBVIS to run your query first as a test? Or can you JUnit your query? On Thu, Nov 12, 2009 at 2:11 AM, dukha mplen...@gmail.com wrote: I have a pojo CurrencyPair which I have successfully saved in the database using jdo. CurencyPair has a field currencyPair. Now trying to select in jdo the query works fine so long as there are no conditions/filters involved. ie I can select all currency pairs like this PersistenceManager pm= getPersistenceManager(); Query query = pm.newQuery(CurrencyPair.class); ListCurrencyPair l = (ListCurrencyPair)query.execute(); This gives USD.JPY GBP.JPY EUR.GBP EUR.USD USD.CAD AUD.USD USD.CHF EUR.JPY EUR.CHF GBP.USD PersistenceManager pm= getPersistenceManager(); Query query = pm.newQuery(CurrencyPair.class,currencyPair == 'AUD.USD'); ListCurrencyPair l = (ListCurrencyPair)query.execute(); returns no data. I've tried all all combinatioins of setting a filter and declaring a parameter or putting the whole query in 1 String according to the gae getting started guide. I have no idea what I'm doing wrong. any help would be appreciated. Thanks. Dukha -- 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=. -- 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=.
[appengine-java] Re: Session handleing example
Ikai, I'm not sure i understand. I was having issues doing something like this in my servlet request.getSession().setAttribute(a,a); and then resp.sendRedirect (redirect); When trying to access 'a' in the redirected jsp, i kept getting null. Once i changed my redirect to a forward, i did not have any issues. Am i not doing this properly? On Nov 12, 1:59 pm, Ikai L (Google) ika...@google.com wrote: Ilya, This will surface the object in request scope, but you should not be having problems with objects stored in session scope. I'm investigating the issues regarding objects in session scope when deployed. On Thu, Nov 12, 2009 at 10:39 AM, IlyaE ilyaelk...@gmail.com wrote: Steph, I have modified my code to make use of RequestDispatcher dispatcher = req.getRequestDispatcher(redirect); dispatcher.forward(req, resp); and this seems to fix the issue. Once i have authenticated my user and forwarded, every subsequent redirect or forward maintains the proper session. On Nov 12, 3:35 am, Steph steph@gmail.com wrote: I am having the same problem. Object on my local GAE install can't be stored in the session. Very detrimental for user session management. Here is the line in my appengine-web.xml: sessions-enabledtrue/sessions-enabled I store my user in session from inside a Filter: HttpSession session = httpRequest.getSession(); session.setAttribute(WebConstants.USER_KEY, user); When I try to retrieve the user in my JSP, I get a null for % User user = (User) session.getAttribute(WebConstants.USER_KEY); % How is this possible such basic JSP handling could be failing? Could you please explain? Thanks. On Nov 11, 11:51 am, Ikai L (Google) ika...@google.com wrote: Ilya, One thing you will want to check will be if sessions are enabled. Sessions are off by default, so you'll have to add this line to your appengine-web.xml file: sessions-enabledtrue/sessions-enabled http://code.google.com/appengine/docs/java/config/appconfig.html#Enab. .. On Tue, Nov 10, 2009 at 12:03 PM, IlyaE ilyaelk...@gmail.com wrote: I'm looking to track a user session if they have logged in using my own user manager, but i was having trouble passing my user object back to the session once the app was deployed. I will give this a shot but i wonder if this was because i was redirecting instead of forwarding. I was doing this in my servlet ListMyUser results = (ListMyUser) query.execute(email,password); if (results.size() == 0) { redirect = /index.html; } else { req.getSession().setAttribute(user, results.get(0)); } resp.sendRedirect(redirect); and this in my jsp % MyUser u = (MyUser) request.getSession().getAttribute(user); if (u != null) { } else { % User is null % } % So i was always getting null even though i was redirected properly. Can you explain On Nov 10, 1:36 pm, Ikai L (Google) ika...@google.com wrote: Ilya, Are you looking to persist objects for a lifetime of a session, or are you looking to minimize the logic you are using in your JSPs? As a general design principle, we recommend that you minimize usage of session scope. Variables bound to session scope are serialized and stored to distributed memory, and as a result, it will work best if you use it to pass around small, simple, immutable objects. If you're looking to pass a variable to a view, Java Servlets have a concept of page scope as well as session scope. You don't need to store a variable in session scope if you just want to dispatch the request to a JSP. For instance, you can define a Servlet that looks like this: public class MyServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String myVar = this is a string that will be passed to the JSP; request.setAttribute(myVar, myVar); RequestDispatcher dispatcher = request.getRequestDispatcher(/WEB-INF/my.jsp); dispatcher.forward(request, response); } } In my.jsp, you can now refer to this variable: %@ page isELIgnored=false % body h1${myVar}/h1 /body Ikai Lan Developer Programs Engineer, Google App Engine On Tue, Nov 10, 2009 at 2:39 PM, IlyaE ilyaelk...@gmail.com wrote: Well as i found out, session attributes don't always guarantee that they are sent back to the same JVM thus i keep getting null objects in my view. While i saw a similar discussion before the only
Re: [appengine-java] Re: A newbie question about logging using java.util.logging
Did you try com.zas.test.level=INFO instead of com.zas.test=INFO ? On Fri, Nov 13, 2009 at 1:22 AM, Zaske yair.zaslav...@gmail.com wrote: Yes, I tried filtering info - and did not get the messsage. In the end I changed the file to look like: .level = FINEST # Set the default logging level for ORM, specifically, to WARNING DataNucleus.JDO.level=WARNING DataNucleus.Persistence.level=WARNING DataNucleus.Cache.level=WARNING DataNucleus.MetaData.level=WARNING DataNucleus.General.level=WARNING DataNucleus.Utility.level=WARNING DataNucleus.Transaction.level=WARNING DataNucleus.Datastore.level=WARNING DataNucleus.ClassLoading.level=WARNING DataNucleus.Plugin.level=WARNING DataNucleus.ValueGeneration.level=WARNING DataNucleus.Enhancer.level=WARNING DataNucleus.SchemaTool.level=WARNING com.zas.test=INFO That is - I changed the default logging level to FINEST. I dont like this solution - it's not a clean solution and does not remind me the log4j usage I'm used to. I would still appreciate if someone can help me fully understand this. On Nov 13, 1:54 am, Rusty Wright rwright.li...@gmail.com wrote: 1) Appcfg gets the request (access) logs, not the error logs. 2) On the web page console, did you change the filtered log level to INFO? It starts out filtering for ERROR or WARN. Zaskewrote: Hi all, I want to log (at INFO level) all classes that their package begin with com.zas.test - For this I added the line: com.zas.test=INFO to my logging.properties file - so now it looks like this: .level = WARNING # Set the default logging level for ORM, specifically, to WARNING DataNucleus.JDO.level=WARNING DataNucleus.Persistence.level=WARNING DataNucleus.Cache.level=WARNING DataNucleus.MetaData.level=WARNING DataNucleus.General.level=WARNING DataNucleus.Utility.level=WARNING DataNucleus.Transaction.level=WARNING DataNucleus.Datastore.level=WARNING DataNucleus.ClassLoading.level=WARNING DataNucleus.Plugin.level=WARNING DataNucleus.ValueGeneration.level=WARNING DataNucleus.Enhancer.level=WARNING DataNucleus.SchemaTool.level=WARNING com.zas.test=INFO At my code I tried this: private static final Logger log = Logger.getLogger(com.zas.test); and then later on: log.info(Test logging); When using appcfg to retrieve the logs or viewing them using the administration consoleI did not see the Test logging message. The name of my servlet class is TestServlet (under package com.zas.test.googleapp.server), so I also tried obtaining the logger object like this: private static final Logger log = Logger.getLogger (TestServlet.class.getName()); But still, failed to log. Can you please explain me what I'm doing wrong? -- 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/google-appengine-java?hl=. -- 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=. -- 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=.