[appengine-java] Re: HTTP POST failing in dev environment with SDK 1.4.3

2011-04-03 Thread rml
No, I'm not hitting deadline. I'm POSTing login credentials so it's a
small HTTP request. The problem disappears as soon as I switch back to
1.4.2.


On Apr 3, 4:54 am, branflake2267 branflake2...@gmail.com wrote:
 My posts are working for 1.4.3, although, you can hit deadlines. What are
 you posting?

 Brandon Donnelsonhttp://gwt-examples.googlecode.com

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



[appengine-java] Best practice for multithreaded access/update to entity

2011-04-03 Thread Peter Backx
I have an application that accesses a user entity. This entity also contains 
a number of user specific settings that the user can update. Some of those 
settings are updated by different servlets in parallel (for instance 
uploading a profile picture to the blobstore)

I'm having some serious issues keeping everything in sync. If I'm not 
careful, I can easily overwrite updates that have been done in another 
thread.

I have the feeling this is a recurring issue for many GAE application, so 
I'm looking for some best practices of how to deal with it.

In the relational world, often a version column is added. Before updating 
a row, the version number in the database is compared to the one in memory. 
I suppose I can implement something like that on GAE too, but I was 
wondering whether there are better/other options available in the NoSQL 
world.


Regards,
Peter

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



[appengine-java] Help ! Datanucleus class cast Exception

2011-04-03 Thread Martin Newstead
Firstly apologies if I have posted in the wrong place, I am sure someone 
will kindly tell me where is more appropriate.

I have built a new application, I have already deployed one with identical 
architecture successfully but not encountered this error before. My 
application runs well on Tomcat  accessing a local H2 database but when I 
test again the GAEJ Development server and when I deploy to Google Apps and 
run for real I get the following exception. I have check all my jar files 
for multipe versions etc but can't get to the bottom of this, can someone 
help ? (This trace is from the development server pointing at the same 
location that Tomcat runs from)

java.lang.ClassCastException: 
org.datanucleus.query.expression.ParameterExpression cannot be cast to 
org.datanucleus.query.expression.PrimaryExpression
at 
org.datanucleus.store.appengine.query.DatastoreQuery.getSortProperty(DatastoreQuery.java:793)
at 
org.datanucleus.store.appengine.query.DatastoreQuery.addSorts(DatastoreQuery.java:772)
at 
org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:231)
at 
org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:89)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at 
org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:243)
at mseries.routes.model.DataModel.saveTrack(DataModel.java:107)
at 
mseries.routes.servlet.TrackUploadServlet.doGet(TrackUploadServlet.java:74)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at 
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at 
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at 
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at 
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at 
com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351)
at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

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



[appengine-java] Re: Help ! Datanucleus class cast Exception

2011-04-03 Thread Martin Newstead
Update:
Digging into the source code for 
 org.datanucleus.store.appengine.query.DatastoreQuery.getSortProperty
allowed me to figure out what was causing the problem. In the follow code, 
the emboldened on is the one that threw the exception, it will be noticed 
that I have ordered by 'keyx' which is my parameter name and NOT the name or 
my attribute in the class JDOTrack, changing it to a proper attribute name 
works as expected. NB This was not a problem with Datanucleus and the rdbms 
persistence manager there.

Query q = pm.newQuery(JDOTrack.class);
q.setFilter(key == keyx );
q.declareParameters(String keyx);
q.setUnique(true);
   * q.setOrdering(keyx ascending);*
res = (JDOTrack) q.execute(key);

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



[appengine-java] Re: HTTP POST failing in dev environment with SDK 1.4.3

2011-04-03 Thread Thomas Visser
I also experienced it using the dyuproject library for OpenID
authentication. It remained working fine on the app engine and I
managed to get it to work locally as well by removing the Content-
length header parameter.

On Apr 2, 12:33 pm, rml radomi...@gmail.com wrote:
 I have an issue with local development server after upgrading to SDK
 1.4.3. All HTTP POST requests fail with:

     java.io.IOException: Could not fetch URL:http://sitename/login.php

 Can anyone confirm that POST is working or failing in dev environment?

 I create an issue for this so if anyone else is experiencing this,
 please starhttp://code.google.com/p/googleappengine/issues/detail?id=4836

 Thanks.

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



[appengine-java] Re: 1.4.3 Javadocs? Looking for the FileServiceFactory docs:

2011-04-03 Thread Mitch Rudominer
I apologize, we neglected to include the JavaDoc for the new File API
in the 1.4.3 release. It will be in 1.4.4 but I will look into posting
it somewhere temporarily. In the mean time, here is the JavaDoc for
the method you asked about:

/**
   * Creates a new empty file in the BlobStore of the specified mime-
type and
   * returns an {@code AppEngineFile} representing the file. The
returned
   * instance will have a {@link AppEngineFile#getFileSystem() file
system} of
   * {@link
com.google.appengine.api.files.AppEngineFile.FileSystem#BLOBSTORE
   * BLOBSTORE}.
   *
   * @param mimeType the mime-type of the file to be created. This
parameter may
   *be used to inform the BlobStore of the mime-type for the
file. The
   *mime-type will be returned by the BlobStore in an HTTP
response if
   *the file is requested directly from the BlobStore using
the
   *blob-key.
   * @param blobInfoUploadedFileName BlobStore will store this name in
the
   *BlobInfo's fileName field. This string will emnot/em
be
   *the {@link AppEngineFile#getNamePart() name} of the
returned
   *{@code AppEngineFile}. It will be returned by the
BlobStore in an HTTP
   *response if the file is requested directly from the
BlobStore using
   *the blob-key.
   * @return A {@code AppEngineFile} representing the newly created
file.
   * @throws IOException If there is any problem communicating with
the backend
   * system
   */
  AppEngineFile createNewBlobFile(String mimeType, String
blobInfoUploadedFileName)
  throws IOException;

On Apr 2, 8:54 am, branflake2267 branflake2...@gmail.com wrote:
 I'm looking for the new javadocs for FileServiceFactory and didn't see them
 yet.

 I wanted to find out what the method parameters were for
 fileService.createNewBlobFile(param,param)? Is there a parameter for
 filename?

     AppEngineFile file = null;
     try {
       file = fileService.createNewBlobFile(contentType);
     } catch (IOException e) {
       e.printStackTrace();
     }

 Brandon Donnelsonhttp://gwt-examples.googlecode.com

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



[appengine-java] Re: Could Not Verify SSL Certificate

2011-04-03 Thread xtrawurst
 Add this JVM arg to the appengine startup runtime, -Djavax.net.debug=ssl

How can I do that? Is there an Eclipse setting for that?

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



[appengine-java] JPA Error : When tried to use the type Key or encoded String

2011-04-03 Thread Pradeep
Hi Everyone ,

  I am getting an error when tried to persist my class using the JPA.
I am about to persist my child model . here is the snippet that
generates the error,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName=datanucleus, key=gae.encoded-pk,
value=true)
private String personId;

I have tried key as well,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key personaId;

I am getting the following error when tried to persist the object of
the above class.

Invalid Key PB: no elements.
Caused by:

java.lang.IllegalArgumentException: Invalid Key PB: no elements.
at
com.google.appengine.api.datastore.KeyTranslator.createFromPb(KeyTranslator.java:
26)
at
com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:
197)


Can anyone kindly help me to get out of this problem ?

Thanks,
Pradeep.

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



[appengine-java] Resize image to exact size using ImagesService

2011-04-03 Thread mscwd01
Hi

Is there a way to resize an image to an exact size?

I am currently using this:

ImagesServiceFactory.makeResize(width, height);

However, this scales the image until it reaches either the height or
width value to ensure the aspect ratio is maintained. This is not what
I want, I would like to enter a specific width and height and have the
image transformed to that size, even if it means the aspect ratio is
changed.

Thanks

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



[appengine-java] Re: JPA/JDO vs low level API

2011-04-03 Thread emurmur
I've been using Java AppEngine since it became available.   I chose
JDO for portability and so I could get started very quickly.  I can
say that JDO offers very little real portability for significant apps
because of the very different semantics of the underlying datastore.
If I were developing for an SQL datastore, my datamodel would be
pretty different.  For instance, it is easy in most SQL datastores to
use one or more fields as a unique, mutable secondary key (like an
email address or Social Security Number).  In the appengine datastore,
if you have the datastore generate unique primary keys, but you want
to enforce a unique mutable secondary key, you need to use a separate
entity to serve as the secondary key mutex.  This is a fine solution
if you are using the low level API, because you can have your data
access layer create and check this mutex so this does not bubble up to
your application code.  However, with JDO, you have to create another
pojo and manage it so it can serve as the mutex.  Ick.

When I chose JDO, no wrapper for the low level existed and
documentation of the low level was not great.  JDO was well documented
so I could get going fast.  However, there are now several good
alternative frameworks for using the low level datastore.  If I were
to start today, I would choose one of them and avoid JDO.  Now that I
know what I know, I will probably write my own low level wrapper so I
have more flexibility and control.


On Apr 2, 8:46 am, Jeff Schnitzer j...@infohazard.org wrote:
 An incomplete list of things that are difficult or impossible with
 JDO/JPA, but easy with Objectify/LowLevelAPI:

  * Partial indexes
  * Running multiple concurrent transactions, or (more likely) a
 transaction + a nontransaction.  Because of GAE's transaction model,
 this is actually necessary quite often.
  * Migrating your schema.  JDO/JPA is particularly brittle, you can't
 even add primitive fields to a class.
  * Serializing your entities.  With JDO you must detach them
 explicitly, with JPA (as implemented by DataNucleus) you simply can't.

 In practice, the biggest difference after abandoning JDO/JPA is that
 you will stop screaming loudly at your computer, annoying your
 coworkers.

 Jeff
 (copied from the response to the same question on the objectify mailing list)







 On Fri, Apr 1, 2011 at 4:50 AM, SkYlEsS shou...@gmail.com wrote:
  I have a question :

  What are the differences between JPA/JDO and low level API (and
  Objectify) in practice ? I read everywhere the low level API provides
  more flexibility, but there are never samples code or evidences to
  demonstrate it. So I'm wondering in which cases exactly, the low level
  API is useful ?

  Thanks in advance

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

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



[appengine-java] 1.4.3 remote_api upload Parent with Children

2011-04-03 Thread mattkrae34
I'm trying to use to the new remote_api features to upload data.  What
is the best way to upload a parent with a list of owned children.

Class Parent has ListChild children

I tried uploading the Parent and using its key to create Keys for each
of the children.

child.setProperty(key, KeyFactory.createKey(parentKey, Child,
null));

The KeyFactory call won't let name = null (even though all the
existing entities have name = null) so I set name to an arbitrary
string.  When I did that the Parent and children were created but the
Parents list of children was empty.  So the association between the
parent and children did not happen.

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



[appengine-java] Re: 1.4.3 remote_api upload Parent with Children

2011-04-03 Thread mattkrae34
Figured it out, just create the the child entity with:

Entity child = new Entity(Child, parentKey);
children.add(child);
ds.put(children)

On Apr 3, 5:42 pm, mattkrae34 matt.krae...@gmail.com wrote:
 I'm trying to use to the new remote_api features to upload data.  What
 is the best way to upload a parent with a list of owned children.

 Class Parent has ListChild children

 I tried uploading the Parent and using its key to create Keys for each
 of the children.

 child.setProperty(key, KeyFactory.createKey(parentKey, Child,
 null));

 The KeyFactory call won't let name = null (even though all the
 existing entities have name = null) so I set name to an arbitrary
 string.  When I did that the Parent and children were created but the
 Parents list of children was empty.  So the association between the
 parent and children did not happen.

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



[appengine-java] Re: 1.4.3 Javadocs? Looking for the FileServiceFactory docs:

2011-04-03 Thread branflake2267
Ah, just what I needed. Thanks!

Brandon

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



[appengine-java] Re: Best practice for multithreaded access/update to entity

2011-04-03 Thread Didier Durand
Hi,

Having a version (or even better a timestamp) for last update is also
what I use to maintain integrity of my data.

To manage it simply,
a) I use a hierarchy of object all inheriting from a DsObject so that
I to manage this version only in one place
b) I use the @PrePersist annotation (from Objectify) to make it as
transparent as possible

regards

didier

On Apr 3, 2:10 pm, Peter Backx peter.ba...@gmail.com wrote:
 I have an application that accesses a user entity. This entity also contains
 a number of user specific settings that the user can update. Some of those
 settings are updated by different servlets in parallel (for instance
 uploading a profile picture to the blobstore)

 I'm having some serious issues keeping everything in sync. If I'm not
 careful, I can easily overwrite updates that have been done in another
 thread.

 I have the feeling this is a recurring issue for many GAE application, so
 I'm looking for some best practices of how to deal with it.

 In the relational world, often a version column is added. Before updating
 a row, the version number in the database is compared to the one in memory.
 I suppose I can implement something like that on GAE too, but I was
 wondering whether there are better/other options available in the NoSQL
 world.

 Regards,
 Peter

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



[appengine-java] Re: 1.4.3 Javadocs? Looking for the FileServiceFactory docs:

2011-04-03 Thread Jay Young
On Sunday, April 3, 2011 12:59:23 PM UTC-4, Mitch Rudominer wrote:

 I will look into posting it somewhere temporarily.


files-javadoc.appspot.com?  :-) 

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