[appengine-java] Re: File Access on App Engine

2009-12-09 Thread andy.booth
Use a relative path, not an absolute path. So remove the forward slash
prefix, to just FileInputStream(test.xml). So a file located in /
projectfolder/war/data/anothertest.xml would be accessed using
FileInputStream(data/anothertest.xml).

Andy


On Dec 8, 10:49 pm, mattkrae34 matt.krae...@gmail.com wrote:
 I'm using 1.2.8 SDK and on both local and the app engine I get the
 following exception:

 java.security.AccessControlException: access denied
 (java.io.FilePermission file.xml read)

 When I ever I try to open a FileInputStream

 XMLEventReader r = factory.createXMLEventReader(new FileInputStream(/
 test.xml));

 My appengine-web.xml contains the following:

         static-files
         include path=/**.xml /
     /static-files

         resource-files
         include path=/**.xml /
     /resource-files

 The file is located in the WEB-INF directory.

--

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




[appengine-java] Re: Any single entity or entity group can only be updated about five times a second.

2009-12-09 Thread Ratamovic
Hi Tim,

Ithink you ran into the same problem as me. You can see in my post
(http://groups.google.com/group/google-appengine-java/browse_thread/
thread/a0be8114353d9798/c3b9e94f1942d661?lnk=gstq=entity+updated
+twice#c3b9e94f1942d661) an example where I just call make persistence
once on an entity, but JDO seems to consider that it is updated twice.

It seems that there is a kind of problem when you create a hierarchy
of objects when the parents are detached (it works perfect is
everything is created at once).
One of the way to solve that problem for me was to set
datanucleus.attachPolicy to attach-dirty (which is the default
value) instead of attach-all. I think high level persistence
frameworks are still not mature in Appengine.

But if you want to be able to persist entities without modifying any
of their field (which was my case as I was trying to save entities in
memory and roll them back by hand if a set of commit operation
failed), then you are stuck...


Hope that helps.

On 6 déc, 11:00, Tim Cooper tco...@gmail.com wrote:
 Thanks Peter for your reply.

 In fact, after doing some experimentation, I'm able to answer most of
 my own questions, at least unless a Google engineer corrects my
 answers:

 * What is an update exactly?  Is it a call to pm.makePersistent
 ()?  Is it a call to tx.commit()?  Is it a call to pm.flush()?
 Is it an update of a single field in a single Java object?  Is it an
 invocation of doGet()/doPost()?

 tim If you're not using transactions, then an update seems to mean a
 call to pm.makePersistent(), (or pm.makePersistentAll() on objects
 within anentitygroup.)  If you are using transactions, the answer
 seems more complicated and I don't know.

 * Suppose you want to do multiple updates within the oneentitygroup
 within a single Java function.  At what point is the 100ms cost
 incurred?   Which function call blocks for the 100ms?
 tim If you're not using transactions, then it's pm.makePersistent()
 which blocks.  If you are using transactions, then I *think* there's
 significant time elapsed in both pm.makePersistent() and tx.commit
 ().

 * Is it possible to create 900 child entities in anentitygroup in a
 single Java function call, by structuring this creation of 900
 objects as a single update?
 tim Yes, if I use pm.makePersistentAll()   (duh!).   I got my
 request running extremely quickly, (as quickly as I'd ever expect) by
 using pm.makePersistentAll().   I passed in a collection:
 ArrayListObject.    I used an ArrayListObject in order that I
 can persist child objects if different types, and also even the head
 object, in a single call.

 * If I don't use transactions, does this 1-10 updates per second
 limitation go away?
 tim No.   The critical difference is the use of pm.makePersistentAll
 ().   (However, for the record:  it seems that transactions can
 somewhat mitigate the mistake of using pm.makePersistent() when you
 should be using pm.makePersistentAll():  for me, it made things runtwiceas 
 quick).

--

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




[appengine-java] Re: JDO bug (entity groups and double update)

2009-12-09 Thread Ratamovic
Just a short answer to say that I found a similar issue (http://
code.google.com/p/datanucleus-appengine/issues/detail?id=67) about
entities that does not work with unidirectional one to many
relationship after being detached. However converting all my model to
bidirectional relationships does not solve my problem (only setting
the child keys by hand which is not that great...).

On 5 déc, 19:34, Ratamovic ratamo...@gmail.com wrote:
 Hi everybody,

 My model contains a Class A ---Bidi one to many--- B ---one to
 many--- C ---one to one--- D.
 I wrote 3 unit tests with appengine 1.2.8 and JDO on eclipse 3.5 which
 generate an error.
 It looks like a bug in JDO to me but I may be wrong:

 1- org.springframework.orm.jdo.JdoSystemException: can't update the
 sameentitytwicein a transaction or operation; nested exception is
 javax.jdo.JDOException: can't update the sameentitytwicein a
 transaction or operation
 NestedThrowables:
 java.lang.IllegalArgumentException: can't update the sameentitytwice
 in a transaction or operation
         at
 org.springframework.orm.jdo.PersistenceManagerFactoryUtils.convertJdoAccessException
 (PersistenceManagerFactoryUtils.java:247)
         at org.springframework.orm.jdo.DefaultJdoDialect.translateException
 (DefaultJdoDialect.java:230)
         at
 org.springframework.orm.jdo.JdoTransactionManager.convertJdoAccessException
 (JdoTransactionManager.java:503)
         at org.springframework.orm.jdo.JdoTransactionManager.doCommit
 (JdoTransactionManager.java:427)

 However (see the code below), when I change the member variable
 expList of class A then it works. An other way is not to call setEmail
 of class A (but if I set the firstName which is also a String then it
 works)...
 This look like a JDO bug or bug to me.

 2- com.testgae.xp.server.dao.DaoException:
 javax.jdo.JDOFatalUserException: Illegal argument
 NestedThrowables:
 java.lang.IllegalArgumentException: can't operate on multipleentity
 groups in a single transaction. found both Element {
   type: A
   id: 1}

  and Element {
   type: C
   id: 3

 }

 Here I don't understand because A and C should be in the same group.
 There are only owned relationship between them. If I create the
 hierarchy A-B-C-D all at once it works. But not if I do A-B and
 then -C-D like in my second test. Is it a bug in my code or a JDO
 bug again?
 If I set manually the key of class C (as a child of B) then that
 works... Another way to make it works is to change the Set of C to a
 List of C in class B.
 Isn't it a bug in JDO or something?

 3- my childs are never loaded. But if I used theupdatedobject
 returned by my DAO instead of loading it from the datastore, then that
 works. All my requests return null. I can't understand why because
 this was working in appengine 1.2.1.
 This is likely something about my code is missing or wrong but I can't
 see what.

 You can find my source code below and also a full packed eclipse
 project ready to import 
 :D:http://www.mediafire.com/file/0rwmfnfjtqg/TestGAE_src.ziphttp://www.mediafire.com/file/tmknjaaoxwn/TestGAE_full.zip
 Thanks a lot for your help!

 Here is an extract of my code:

 @PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable=true)
 public class A {
         private static final long serialVersionUID = 7061281232540895192L;

         @PrimaryKey
         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
         private Key _key;
         @Persistent
         private String _firstName;
         @Persistent
         private String _email;
         @Persistent(mappedBy=_parent, defaultFetchGroup=true)
         /
         // If I rename _expList in _aList, then test1 works
         /
         private ListB _expList;
 ...
 @PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable=true)
 public class B {
         private static final long serialVersionUID = 829289483086117887L;

         @PrimaryKey
         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
         private Key _key;
         @Persistent
         private String _string;
         @Persistent(defaultFetchGroup=true)
         private A _parent;
         @Persistent(defaultFetchGroup=true)
         /
         // If I change this to ListC, then test2 works
         /
         private SetC _cUpdates;
 ...
 @PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable=true)
 public class C {
         private static final long serialVersionUID = -5806378892487300728L;

         @PrimaryKey
         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
         private Key _key;
         @Persistent
         private int _level;
     @Persistent(defaultFetchGroup=true)
     private D _sList;
 ...
 @PersistenceCapable(identityType = 

[appengine-java] Re: JDO bug (entity groups and double update)

2009-12-09 Thread datanucleus
1. Any exception from Spring is of use to one group of people only ...
Spring. I'd guess it has a nested exception, so that would provide
more basis for comment.

3. Perhaps you could define what my childs are never loaded means,
cos I don't see a field called that. JDO loads as per the FetchPlan,
and the maxFetchDepth of that. Don't set them and you get depth of 1
only, as per the JDO spec.

--

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




[appengine-java] Re: updating object doesn't work anymore

2009-12-09 Thread tal
Thanks for the quick response!
I tried switching to getPersistenceManagerProxy() but didn't get any
change.
After experimenting some more I finally found my problem...
my object of User had a list of Category, and I carelessly used
@Transient (javax.persistence) instead of @NonPersistent
(javax.jdo.annotations)
when persisting my User, JDO damaged my Category table...



On Dec 8, 8:28 pm, a.maza andr.m...@gmail.com wrote:
 I am using Spring and OpenPersistenceManagerInView as well.

 I experienced various problems. I am now using

 pmf.getPersistenceManagerProxy() (instead of pmf.getPersistenceManager
 ()) and it works quite fine.

 regards,
 andreas

 On 8 Dez., 17:30, tal tal.j@gmail.com wrote:

  I might be having the same problem.
  took me a while to find the consistency: i have 2 unrelated model
  classes (User and Category). creating or updating Category objects
  initially works, but when i read users from the datastore, creating
  and updating of Category stops working until I restart my server.
  I am using a differentpersistenceManagerfor each class, retrieved
  from a joint persistenceManagerFactory.

  was your problem resolved?

  On Nov 20, 1:47 am, randal rdgo...@gmail.com wrote:

   No not yet.- 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=en.




[appengine-java] Re: JDO bug (entity groups and double update)

2009-12-09 Thread Ratamovic
Thx for your answer. To clarify these points:

1- The transaction is really a JDO/datastore exception encapsulated by
Spring (as I am using the transactional components of Spring). To be
sure, I tried to execute these tests with manual transactions instead
of not Spring and the result was the same (except that it was not a
Spring exception but the message was the same).

3- You're right my comment is a bit imprecise:

Sorry for the confusions or imprecisions :D. My problem is when I load
an object A which contains a list of B. Although one B was added to A,
it does not get loaded when I load A. But it is in the object returned
by makePersistent within my DAO:

public final void testBug3() throws DaoException {
...
// Here I add B to A
a.addB(b);
//
A a2 = _aDao.update(a);
a = _aDao.loadByKey(a.getKey());
...
// Returns an empty list if I use object a but contains one
element if I use a2 instead.
a.getBList()
}

In my DAO (which is not in my previous post, only in my Zip), I set
the fetchDepth to 3 and used defaultFetchGroup to force loading (I
also tried -1). But usually errors returned by JDO in that case are of
the kind object not detached and the list still contain the correct
number of elements even if they are not loaded.

However I have just realized that I am getting the persistence manager
through the PersistenceManagerFactoryUtils of Spring several times
(once in getPersistenceManager() and once in getFetchPlan() in my
DAO). Although I think it gives the persistence manager for the
current thread, I should make it sure. I'll give it a try this
evening.



Here is an extract of my DAO:
public class ADao implements IADao
{
...
public final PersistenceManager getPersistenceManager() {
return PersistenceManagerFactoryUtils.getPersistenceManager
(_persistenceManagerFactory, true);
}

public final FetchPlan getFetchPlan() {
return PersistenceManagerFactoryUtils.getPersistenceManager
(_persistenceManagerFactory, true).getFetchPlan();
}

...

public final A loadByKey(Key pKey) throws DaoException {
PersistenceManager lPersistenceManager = getPersistenceManager
();
try {
getFetchPlan().setMaxFetchDepth(3);
A lAggregate = lPersistenceManager.getObjectById(A.class,
pKey);
return lPersistenceManager.detachCopy(lAggregate);
}
catch (JDOObjectNotFoundException eJDOObjectNotFoundException)
{
return null;
}
catch (Exception eException)
{
throw new DaoException(eException);
}
}

@Transactional(readOnly = false, propagation =
Propagation.REQUIRES_NEW)
public final A update(A pA) throws DaoException {
PersistenceManager lPersistenceManager = getPersistenceManager
();

try {
A lUpdatedAggregate = lPersistenceManager.makePersistent
(pA);
return lUpdatedAggregate;
}
catch (Exception eException)
{
throw new DaoException(eException);
}
}

@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public A loadByEmail(String email) throws DaoException {
Query lQuery = getPersistenceManager().newQuery(A.class);
lQuery.setFilter(_email == emailParam);
lQuery.declareParameters(String emailParam);
lQuery.setUnique(true);

getFetchPlan().setMaxFetchDepth(3);

return executeUniqueQuery(lQuery, email);
}
}


On 9 déc, 11:54, datanucleus andy_jeffer...@yahoo.com wrote:
 1. Any exception from Spring is of use to one group of people only ...
 Spring. I'd guess it has a nested exception, so that would provide
 more basis for comment.

 3. Perhaps you could define what my childs are never loaded means,
 cos I don't see a field called that. JDO loads as per the FetchPlan,
 and the maxFetchDepth of that. Don't set them and you get depth of 1
 only, as per the JDO spec.

--

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




[appengine-java] Re: JDO bug (entity groups and double update)

2009-12-09 Thread datanucleus
 1- The transaction is really a JDO/datastore exception encapsulated by
 Spring (as I am using the transactional components of Spring). To be
 sure, I tried to execute these tests with manual transactions instead
 of not Spring and the result was the same (except that it was not a
 Spring exception but the message was the same).

Yes but the exception means nothing to me. The stack trace maybe
would ;-)


 3- You're right my comment is a bit imprecise:

 Sorry for the confusions or imprecisions :D. My problem is when I load
 an object A which contains a list of B. Although one B was added to A,
 it does not get loaded when I load A. But it is in the object returned
 by makePersistent within my DAO:

So look in the log when you want to load some object, and see what
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=en.




[appengine-java] HttpUnit with GAE

2009-12-09 Thread Don
Hi,

I am trying to tweak HttpUnit 1.7.2 to run under GAE, and stumbled
accross the URLStreamHandler error.
As HttpUnit uses URLStreamHandler to process javascript and https,
removing URLStreamHandler means I can only access plain html website.

How do I use GAE UrlFetch service to replace URLStreamHandler ?

Many 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=en.




[appengine-java] Datastore properties with more than one value Restrictions

2009-12-09 Thread gopoto
Hi,

I would like to know if Properties with more than on value has
restrictions on the numbers of elements you can set on these fields ?

Ex:

@Persistent
ListString favoriteFoods;

Do we have some restrictions on favoriteFoods ?

Thanks a lot

--

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




Re: [appengine-java] Re: Collections usge in Appengine Java

2009-12-09 Thread andy stevko
Sorry for not seeing this earlier - I missed your reply post in the mail
stream.

FetchGroups are documented at
http://www.datanucleus.org/products/accessplatform_1_1/jdo/fetchgroup.html#dfg

The xml metadata they show is generated by the @FetchGroup annotation which
is documented at
http://www.datanucleus.org/products/accessplatform_1_1/jdo/annotations.html#FetchGroup

Strings and other basic java.lang types are in the default fetch group.
User defined types need to be added to a user named fetch group (or may be
added to the default group).

HTH,
--Andy

On Thu, Dec 3, 2009 at 11:10 PM, Avis developer
sivaram.subb...@gmail.comwrote:

 Sir thanks for the reply , but pl help me sir, am jus a beginner, can
 u pls be elaborate, thanks for spending ur time and effort

 --

 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=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-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Is it possible to store ContactEntrys in the appengine datastore?

2009-12-09 Thread Josh
I'm trying to store a list of ContactEntrys in the appengine
datastore.  When I persist the group, I get the following error.  Is
there anyway to get around this?

Thanks,

HTTP ERROR: 500

contacts: com.google.gdata.data.contacts.ContactEntry is not a
supported property type.

RequestURI=/update
Caused by:

java.lang.IllegalArgumentException: contacts:
com.google.gdata.data.contacts.ContactEntry is not a supported
property type.
at
com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue
(DataTypeUtils.java:145)
at
com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue
(DataTypeUtils.java:123)
at com.google.appengine.api.datastore.Entity.setProperty(Entity.java:
268)
at
org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField
(DatastoreFieldManager.java:781)
at org.datanucleus.state.AbstractStateManager.providedObjectField
(AbstractStateManager.java:1037)
at contacts.Group.jdoProvideField(Group.java)
at contacts.Group.jdoProvideFields(Group.java)
at org.datanucleus.state.JDOStateManagerImpl.provideFields
(JDOStateManagerImpl.java:2715)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.updateObject
(DatastorePersistenceHandler.java:490)
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)
at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:256)
at org.datanucleus.ObjectManagerImpl.close(ObjectManagerImpl.java:
801)
at org.datanucleus.jdo.JDOPersistenceManager.close
(JDOPersistenceManager.java:271)
at contacts.UpdateGroup.doGet(UpdateGroup.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at com.google.appengine.tools.development.StaticFileFilter.doFilter
(StaticFileFilter.java:121)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
(DevAppEngineWebAppContext.java:54)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:342)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
506)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(HttpConnection.java:830)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at org.mortbay.io.nio.SelectChannelEndPoint.run
(SelectChannelEndPoint.java:396)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run
(BoundedThreadPool.java:442)


--

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




[appengine-java] URLFetch HTTPRequest.fetch throws NPE

2009-12-09 Thread Satheesh Babu Vattekkat
Hi,

I've a code like this to a remote web service (under https) that
expects a form data post. Output is XML.

 URLFetchService f = URLFetchServiceFactory.getURLFetchService();
 HTTPRequest req = new HTTPRequest(url, HTTPMethod.POST);
 req.setPayload(data.toString().getBytes());
 HTTPResponse resp = f.fetch(req);

It fails with an NPE on f.fetch() above.
   java.lang.NullPointerException
atcom.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch
(URLFetchServiceImpl.java:31  )

Any thoughts on what could be wrong here?

I access this service regularly through python and it works.

--

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




[appengine-java] Re: Is it possible to store ContactEntrys in the appengine datastore?

2009-12-09 Thread Josh
One other thing I should add.  The ContactEntrys are currently stored
in an ArrayList.  I'm trying to persist the whole list.

--

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




Re: [appengine-java] An entity group that does not have a root entity supports transaction. How does it work?

2009-12-09 Thread Ikai L (Google)
Which timestamp are you referring to?

On Tue, Dec 8, 2009 at 6:35 PM, Yasuo Higa higaya...@gmail.com wrote:

 Thanks for your reply, Ikai.

  Entity groups are distributed based on the key and not necessarily the
 root
  entity. Thus, it is possible to place entities in the same entity group
  without an entity parent. Something similar to what you have done is also
  possible by creating a root entity, adding descendants, then removing the
  root entity. Transactions are possible for entities in the same entity
  group.

 Do you mean that a root key has time-stamp for transaction
 or an entity group itself is an entity?

 I would like to know where time-stamp for transaction is stored.

 Thanks,

 Yasuo Higa

 --

 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=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=en.




Re: [appengine-java] Critical issue with INDEX

2009-12-09 Thread Ikai L (Google)
Ravi,

We're aware of the issue and have already begun investigating it. I'll open
up a public issue to mirror our progress so everyone can follow it and add
their comments.

On Wed, Dec 9, 2009 at 1:09 AM, Ravi Sharma ping2r...@gmail.com wrote:

 Can anyone from google look into this issue please?


 On Mon, Dec 7, 2009 at 8:15 PM, Ravi Sharma ping2r...@gmail.com wrote:

 Hi Jason and all Google guys,
 This is real big problem and its not just canslimbot application but there
 are many applications, in today's mails i can see 3 people have faced this
 problem i ncluding m e. I am sure there is some defect in index building.
 Can you please have a look.

 Thanks,
 Ravi.


 On Mon, Dec 7, 2009 at 3:40 PM, GTZhou sharkillf...@gmail.com wrote:

 Jason:
I need your help.
Before I create the index,My app works fine,and I use the query
 below,I can get 1 row.
 SELECT  FROM StockBase where code = '600175' and season = '3' and year
 = '2009'
However,after create the index,and status of index is serving.I
 use the query above,then can not get anything.But I sure the data
 stored on the server.Because when I remove the and year = '2009'.I
 can also get the rows.
My application id is canslimbot.
Pls tell me the reason about it,thank u!

 --

 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=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-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=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=en.




Re: [appengine-java] Critical issue with INDEX

2009-12-09 Thread Ikai L (Google)
Here's the issue in our public tracker:

http://code.google.com/p/googleappengine/issues/detail?id=2481

On Wed, Dec 9, 2009 at 9:56 AM, Ikai L (Google) ika...@google.com wrote:

 Ravi,

 We're aware of the issue and have already begun investigating it. I'll open
 up a public issue to mirror our progress so everyone can follow it and add
 their comments.


 On Wed, Dec 9, 2009 at 1:09 AM, Ravi Sharma ping2r...@gmail.com wrote:

 Can anyone from google look into this issue please?


 On Mon, Dec 7, 2009 at 8:15 PM, Ravi Sharma ping2r...@gmail.com wrote:

 Hi Jason and all Google guys,
 This is real big problem and its not just canslimbot application but
 there are many applications, in today's mails i can see 3 people have faced
 this problem i ncluding m e. I am sure there is some defect in index
 building. Can you please have a look.

 Thanks,
 Ravi.


 On Mon, Dec 7, 2009 at 3:40 PM, GTZhou sharkillf...@gmail.com wrote:

 Jason:
I need your help.
Before I create the index,My app works fine,and I use the query
 below,I can get 1 row.
 SELECT  FROM StockBase where code = '600175' and season = '3' and year
 = '2009'
However,after create the index,and status of index is serving.I
 use the query above,then can not get anything.But I sure the data
 stored on the server.Because when I remove the and year = '2009'.I
 can also get the rows.
My application id is canslimbot.
Pls tell me the reason about it,thank u!

 --

 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=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-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=en.




 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine




-- 
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=en.




Re: [appengine-java] Re: oid is not instanceof javax.jdo.identity.ObjectIdentity

2009-12-09 Thread Max Ross (Google)
I don't see a class that is owned by more than one entity in your latest
example.  What exactly should I be looking at?

Your understanding of the BigTable layout is correct, but you're bumping
into a limitation of how we've mapped JDO on to that layout.  The low-level
api knows nothing about your data model and will allow you to create
whatever parent/child relationships you want.  However, the low-level api
also knows nothing about ownership and dependent data.  We need JDO to
enforce these expectations, and in order to enforce these expectations
transactionally we need to put owned entities in the same entity group as
their parents.  We also assume that each child object only has one type of
parent, and that restriction is causing problems for you.

Why do we have that last restriction?  To be honest, I never considered not
having it because in a relational database, if you're modeling ownership
with foreign keys, the foreign key that points to your owner typically
points to a record in a specific table - the schema dictates the type of the
parent.  With JDO on top of the datastore, however, it does seem like we can
take advantage of the underlying flexibility.  So long as the relationship
isn't bidirectional (no parent pointer on the child), you should be able to
have an object be the child of any number of different parents.  Very
interesting, thanks for pushing!  I'll file an issue for this.  It might be
easy or it might be hard, I'm not sure.

So what can you do right now?  Unfortunately you're stuck with unowned
relationships.  Note, however, that just because you've implemented
something as an unowned relationship doesn't mean you need to expose it that
way in your object model.  The datastore doesn't do joins, so something like
this:

class Person {

  Key addressKey;
  transient Address address;

  synchronized Address getAddress() {
if (address == null) {
address = loadAddress();
}
return address;
  }

is not actually any less efficient than using an owned relationship.  Yes,
you have to write more code and it's up to you to ensure that the Address
gets deleted when the Person gets deleted, but in terms of the code you need
to write to interact with the model objects it shouldn't be that different.

Hope this helps,
Max
On Tue, Dec 8, 2009 at 11:15 PM, bryce cottam bcot...@gmail.com wrote:

 Thanks for filing that Max.

 I'm kind of interested in your findings because there is another place
 where I'm doing about the same thing (i.e. making a RatePlan instance
 a direct child of an Entity other than Activity) and it works fine in
 that case most of the time.  Sometimes it gives me the oid is not an
 instance of javax.jdo.identity.ObjectIdentity exception.

 here's the model:
 @PersistenceCapable(identityType=IdentityType.APPLICATION)
 public class ActivityReservation extends BaseBean
 {
@PrimaryKey
@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
private Key id;

 @Embedded(
members={
@Persistent(name=key,
 column=activityKey),
@Persistent(name=name, column=name),
@Persistent(name=pricingModel,
 column=pricingModel)
}
)
@Persistent(defaultFetchGroup=true)
private ActivityFK activity;

@Embedded
@Persistent(defaultFetchGroup=true)
private ActivityLaunchFK launch;

@Persistent
private RatePlan ratePlan;
@Persistent
 private BigDecimal totalCost;
@Persistent
private ListGuest guests = new ArrayListGuest();
 }

 and

 @PersistenceCapable(identityType=IdentityType.APPLICATION)
 public class Reservation extends BaseBean
 {
@PrimaryKey
@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
private Key id;

@Persistent
 private SetActivityReservation activityReservations = new
 HashSetActivityReservation();

@Persistent
private Date createdOn;
@Persistent
private String contactName;
@Persistent
private BigDecimal totalCost;
@Persistent
private BigDecimal totalPaid;
@Persistent
private BigDecimal balanceDue;
 }

 I'd really like to avoid using a Key instance rather than a RatePlan
 instance because I want to ensure that the RatePlan linked to a
 BundledActivity or an ActivityReservation is not used anywhere else in
 the system.  If I allow a Key instance there, someone may be tempted
 to put the Key of an un-owned RatePlan which can be edited out of
 context.  So, I need to make sure I understand this limitation: if
 class A has an instance (or instances) of class B in your data model,
 then class C is not allowed to have an instance (or instances) of
 class B?  I don't remember reading that in any of the docs, but
 perhaps I simply missed it.  That's kind of a big deal for me.  I'm
 almost to the point 

[appengine-java] java.lang.NoClassDefFoundError: java.rmi.server.UID -using commons-fileupload-1.2.1.jar

2009-12-09 Thread Henry
Hi Guys,

Im trying to store and image with GWT to Google App engine, I'm using
the packages:
  commons-codec-1.4.jar
  commons-fileupload-1.2.1.jar
  commons-io-1.4.jar
to get the widgets from the formPanel that I'm sending to the server
which contain the widgets FileUpload that has my image.
When I'm using this packages to recover the image and store it I've
the following error:

java.lang.NoClassDefFoundError: java.rmi.server.UID is a restricted
class. Please see the Google App Engine developer's guide for more
details.
at
com.google.apphosting.runtime.security.shared.stub.java.rmi.server.UID.clinit
(UID.java)
at org.apache.commons.fileupload.disk.DiskFileItem.clinit
(DiskFileItem.java:103)
at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem
(DiskFileItemFactory.java:196)
at org.apache.commons.fileupload.FileUploadBase.parseRequest
(FileUploadBase.java:358)
at
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest
(ServletFileUpload.java:126)
at com.handizo.server.service.FileUploadAnnouncementServlet.doPost
(FileUploadAnnouncementServlet.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
(SaveSessionFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
(AppVersionHandlerMap.java:238)
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:5235)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:5233)
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:838)
at com.google.tracing.LocalTraceSpanRunnable.run
(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
(LocalTraceSpanBuilder.java:536)
at com.google.net.rpc.impl.Server.startRpc(Server.java:793)
at com.google.net.rpc.impl.Server.processRequest(Server.java:368)
at com.google.net.rpc.impl.ServerConnection.messageReceived
(ServerConnection.java:448)
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:
466)
at com.google.net.async.EventDispatcher.processNetworkEvents
(EventDispatcher.java:759)
at com.google.net.async.EventDispatcher.internalLoop
(EventDispatcher.java:205)
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)


This  java.rmi.server.UID class is not in the jre class white list
of Google App Engine, this mean that I can't use these packages
because they need this class?
In that case how I can 

[appengine-java] TransformerFactory.newInstance() not working in App Engine SDK 1.2.8

2009-12-09 Thread Dan Dubois
Dear All,

I just migrated my code to App Engine SDK 1.2.8 and GWT SDK 2.0.0.

I have a method that converts an XML Document object into a string:

public static String getStringFromDocument(Document doc) throws
TransformerException {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
return writer.toString();
}

Unfortunately I now get this error in the SDK:

javax.xml.transform.TransformerFactoryConfigurationError: Provider
org.apache.xalan.processor.TransformerFactoryImpl not found
at javax.xml.transform.TransformerFactory.newInstance
(TransformerFactory.java:108)

I do not get this error when I upload my app. Any idea what is going
on?

Best wishes,
Dan

--

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




Re: [appengine-java] java.lang.NoClassDefFoundError: java.rmi.server.UID -using commons-fileupload-1.2.1.jar

2009-12-09 Thread Toby Reyelts
http://code.google.com/appengine/kb/java.html#fileforms

On Wed, Dec 9, 2009 at 12:44 PM, Henry enricrequ...@gmail.com wrote:

 Hi Guys,

 Im trying to store and image with GWT to Google App engine, I'm using
 the packages:
  commons-codec-1.4.jar
  commons-fileupload-1.2.1.jar
  commons-io-1.4.jar
 to get the widgets from the formPanel that I'm sending to the server
 which contain the widgets FileUpload that has my image.
 When I'm using this packages to recover the image and store it I've
 the following error:

 java.lang.NoClassDefFoundError: java.rmi.server.UID is a restricted
 class. Please see the Google App Engine developer's guide for more
 details.
at

 com.google.apphosting.runtime.security.shared.stub.java.rmi.server.UID.clinit
 (UID.java)
at org.apache.commons.fileupload.disk.DiskFileItem.clinit
 (DiskFileItem.java:103)
at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem
 (DiskFileItemFactory.java:196)
at org.apache.commons.fileupload.FileUploadBase.parseRequest
 (FileUploadBase.java:358)
at
 org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest
 (ServletFileUpload.java:126)
at com.handizo.server.service.FileUploadAnnouncementServlet.doPost
 (FileUploadAnnouncementServlet.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at
 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
 487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
 (ServletHandler.java:1093)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
 (SaveSessionFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
 (ServletHandler.java:1084)
at
 com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
 (TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
 (ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
 (ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
 (SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
 (SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
 (ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
 405)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
 (AppVersionHandlerMap.java:238)
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:5235)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
 $6.handleBlockingRequest(RuntimePb.java:5233)
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:838)
at com.google.tracing.LocalTraceSpanRunnable.run
 (LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
 (LocalTraceSpanBuilder.java:536)
at com.google.net.rpc.impl.Server.startRpc(Server.java:793)
at com.google.net.rpc.impl.Server.processRequest(Server.java:368)
at com.google.net.rpc.impl.ServerConnection.messageReceived
 (ServerConnection.java:448)
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:
 466)
at com.google.net.async.EventDispatcher.processNetworkEvents
 (EventDispatcher.java:759)
at com.google.net.async.EventDispatcher.internalLoop
 (EventDispatcher.java:205)
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)


Re: [appengine-java] Inherit one-to-many relationship

2009-12-09 Thread Max Ross (Google)
Thanks for the report, investigating now

On Tue, Dec 8, 2009 at 2:33 PM, Pierre Lavignotte 
pierre.lavigno...@gmail.com wrote:

 Hi,

 I have a problem when I try to inherit a one-to-many relation ship
 from a base entity class.

 The following model works fine :

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
 public abstract class BaseEntity {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

public Key getKey() {
return key;
}
 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 public class Community extends BaseEntity {

@Persistent
@Element(dependent = true)
private ListSpeciesStats stats = new ArrayListSpeciesStats();

public ListSpeciesStats getStats() {
return stats;
}

@Persistent(dependent = true)
TackleBox tackleBox;

public TackleBox getTackleBox() {
return tackleBox;
}

public void setTackleBox(TackleBox tackleBox) {
this.tackleBox = tackleBox;
}
 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 public class TackleBox extends BaseEntity {
 /* some other properties that eventually extend BaseEntity and so on
 */
 }

 But if I move private ListSpeciesStats stats from Community to
 BaseEntity, I get a runtime exception when trying to read a Community
 entity :
 Caused by: java.lang.NullPointerException
at org.datanucleus.store.appengine.DatastoreTable.runCallBacks
 (DatastoreTable.java:1025)
at org.datanucleus.store.appengine.DatastoreTable.initializeNonPK
 (DatastoreTable.java:391)
at org.datanucleus.store.appengine.DatastoreTable.buildMapping
 (DatastoreTable.java:285)
at org.datanucleus.store.appengine.DatastoreManager.buildStoreData
 (DatastoreManager.java:405)
at org.datanucleus.store.appengine.DatastoreManager.newStoreData
 (DatastoreManager.java:363)
at org.datanucleus.store.AbstractStoreManager.addClasses
 (AbstractStoreManager.java:788)
at org.datanucleus.store.AbstractStoreManager.addClass
 (AbstractStoreManager.java:759)
at org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass
 (MappedStoreManager.java:358)
at
 org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass
 (DatastoreManager.java:631)
at
 org.datanucleus.store.appengine.query.DatastoreQuery.performExecute
 (DatastoreQuery.java:212)
at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute
 (JDOQLQuery.java:85)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:
 1371)
at org.datanucleus.store.query.Query.execute(Query.java:1344)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)

 Or trying to persist one :

 java.lang.NullPointerException
at org.datanucleus.store.appengine.DatastoreTable.runCallBacks
 (DatastoreTable.java:1025)
at org.datanucleus.store.appengine.DatastoreTable.initializeNonPK
 (DatastoreTable.java:391)
at org.datanucleus.store.appengine.DatastoreTable.buildMapping
 (DatastoreTable.java:285)
at org.datanucleus.store.appengine.DatastoreManager.buildStoreData
 (DatastoreManager.java:405)
at org.datanucleus.store.appengine.DatastoreManager.newStoreData
 (DatastoreManager.java:363)
at org.datanucleus.store.AbstractStoreManager.addClasses
 (AbstractStoreManager.java:788)
at org.datanucleus.store.AbstractStoreManager.addClass
 (AbstractStoreManager.java:759)
at org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass
 (MappedStoreManager.java:358)
at
 org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass
 (DatastoreManager.java:631)
at
 org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer
 (DatastoreFieldManager.java:1008)
at
 org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer
 (DatastoreFieldManager.java:998)
at org.datanucleus.store.appengine.DatastoreFieldManager.init
 (DatastoreFieldManager.java:133)
at org.datanucleus.store.appengine.DatastoreFieldManager.init
 (DatastoreFieldManager.java:167)
at

 org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess
 (DatastorePersistenceHandler.java:316)
at
 org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects
 (DatastorePersistenceHandler.java:236)
at
 org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject
 (DatastorePersistenceHandler.java:225)
at org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent
 (JDOStateManagerImpl.java:3185)
at org.datanucleus.state.JDOStateManagerImpl.makePersistent
 

Re: [appengine-java] Re: oid is not instanceof javax.jdo.identity.ObjectIdentity

2009-12-09 Thread bryce cottam
On the ActivityReservation model object, there is an instance of
RatePlan (which is also a child object of Activity).

So, here's a thought, I will try it out later, but I thought I'd ask
right now about it:
how about having subclasses of RatePlan that live on different parent
objects?  since RatePlan does not have a pointer up to it's parent, I
think this could work, but I don't know about the underlying
app-engine JDO implementation issues that might cause.  I'm thinking
something like ActivityRatePlan, BundledRatePlan etc. that don't
really add any api/field functionality, but do make it so that only a
Bundle is the parent of a BundledRatePlan, and only Activity is the
parent of ActivityRatePlan etc. etc.  do you think that would cause
any issues?
I'd love it if you could look into allowing more than one parent
object type for a given child object type.  If it's not too much
trouble, it'd really help me out.

in your Person example above, the loadAddress() method probably uses
either a PersistenceManager or some generic wrapper for it?  If that's
the case, I'm wondering how that scales.  I've kind of viewed one of
the main advantages of using JDO/JPA is that the persistence framework
deals with that lazy loading/orphan deletion for you.
I could also make some kind of embedded field that is embedded only, I
think I've had luck with putting those kinds of objects on multiple
parent object without an issue.  That may work for me.

thanks again Max, you've been a big help.
-bryce




On Wed, Dec 9, 2009 at 11:49 AM, Max Ross (Google)
maxr+appeng...@google.com wrote:
 I don't see a class that is owned by more than one entity in your latest
 example.  What exactly should I be looking at?

 Your understanding of the BigTable layout is correct, but you're bumping
 into a limitation of how we've mapped JDO on to that layout.  The low-level
 api knows nothing about your data model and will allow you to create
 whatever parent/child relationships you want.  However, the low-level api
 also knows nothing about ownership and dependent data.  We need JDO to
 enforce these expectations, and in order to enforce these expectations
 transactionally we need to put owned entities in the same entity group as
 their parents.  We also assume that each child object only has one type of
 parent, and that restriction is causing problems for you.

 Why do we have that last restriction?  To be honest, I never considered not
 having it because in a relational database, if you're modeling ownership
 with foreign keys, the foreign key that points to your owner typically
 points to a record in a specific table - the schema dictates the type of the
 parent.  With JDO on top of the datastore, however, it does seem like we can
 take advantage of the underlying flexibility.  So long as the relationship
 isn't bidirectional (no parent pointer on the child), you should be able to
 have an object be the child of any number of different parents.  Very
 interesting, thanks for pushing!  I'll file an issue for this.  It might be
 easy or it might be hard, I'm not sure.

 So what can you do right now?  Unfortunately you're stuck with unowned
 relationships.  Note, however, that just because you've implemented
 something as an unowned relationship doesn't mean you need to expose it that
 way in your object model.  The datastore doesn't do joins, so something like
 this:

 class Person {

   Key addressKey;
   transient Address address;

   synchronized Address getAddress() {
     if (address == null) {
     address = loadAddress();
     }
     return address;
   }

 is not actually any less efficient than using an owned relationship.  Yes,
 you have to write more code and it's up to you to ensure that the Address
 gets deleted when the Person gets deleted, but in terms of the code you need
 to write to interact with the model objects it shouldn't be that different.

 Hope this helps,
 Max
 On Tue, Dec 8, 2009 at 11:15 PM, bryce cottam bcot...@gmail.com wrote:

 Thanks for filing that Max.

 I'm kind of interested in your findings because there is another place
 where I'm doing about the same thing (i.e. making a RatePlan instance
 a direct child of an Entity other than Activity) and it works fine in
 that case most of the time.  Sometimes it gives me the oid is not an
 instance of javax.jdo.identity.ObjectIdentity exception.

 here's the model:
 @PersistenceCapable(identityType=IdentityType.APPLICATION)
 public class ActivityReservation extends BaseBean
 {
       �...@primarykey
       �...@persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
        private Key id;

       �...@embedded(
                members={
                               �...@persistent(name=key,
 column=activityKey),
                               �...@persistent(name=name, column=name),
                               �...@persistent(name=pricingModel,
 column=pricingModel)
                }
        )
       �...@persistent(defaultFetchGroup=true)
        private 

Re: [appengine-java] Inherit one-to-many relationship

2009-12-09 Thread Max Ross (Google)
Could you please post all the model objects that are involved in the
example?  Looks like SpeciesStats is missing.  Also, it would be great if
you could post the code that shows how you populate the Community object
before persisting.

Thanks,
Max

On Wed, Dec 9, 2009 at 11:40 AM, Max Ross (Google) 
maxr+appeng...@google.com maxr%2bappeng...@google.com wrote:

 Thanks for the report, investigating now


 On Tue, Dec 8, 2009 at 2:33 PM, Pierre Lavignotte 
 pierre.lavigno...@gmail.com wrote:

 Hi,

 I have a problem when I try to inherit a one-to-many relation ship
 from a base entity class.

 The following model works fine :

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
 public abstract class BaseEntity {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

public Key getKey() {
return key;
}
 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 public class Community extends BaseEntity {

@Persistent
@Element(dependent = true)
private ListSpeciesStats stats = new ArrayListSpeciesStats();

public ListSpeciesStats getStats() {
return stats;
}

@Persistent(dependent = true)
TackleBox tackleBox;

public TackleBox getTackleBox() {
return tackleBox;
}

public void setTackleBox(TackleBox tackleBox) {
this.tackleBox = tackleBox;
}
 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 public class TackleBox extends BaseEntity {
 /* some other properties that eventually extend BaseEntity and so on
 */
 }

 But if I move private ListSpeciesStats stats from Community to
 BaseEntity, I get a runtime exception when trying to read a Community
 entity :
 Caused by: java.lang.NullPointerException
at org.datanucleus.store.appengine.DatastoreTable.runCallBacks
 (DatastoreTable.java:1025)
at org.datanucleus.store.appengine.DatastoreTable.initializeNonPK
 (DatastoreTable.java:391)
at org.datanucleus.store.appengine.DatastoreTable.buildMapping
 (DatastoreTable.java:285)
at org.datanucleus.store.appengine.DatastoreManager.buildStoreData
 (DatastoreManager.java:405)
at org.datanucleus.store.appengine.DatastoreManager.newStoreData
 (DatastoreManager.java:363)
at org.datanucleus.store.AbstractStoreManager.addClasses
 (AbstractStoreManager.java:788)
at org.datanucleus.store.AbstractStoreManager.addClass
 (AbstractStoreManager.java:759)
at
 org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass
 (MappedStoreManager.java:358)
at
 org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass
 (DatastoreManager.java:631)
at
 org.datanucleus.store.appengine.query.DatastoreQuery.performExecute
 (DatastoreQuery.java:212)
at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute
 (JDOQLQuery.java:85)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:
 1371)
at org.datanucleus.store.query.Query.execute(Query.java:1344)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)

 Or trying to persist one :

 java.lang.NullPointerException
at org.datanucleus.store.appengine.DatastoreTable.runCallBacks
 (DatastoreTable.java:1025)
at org.datanucleus.store.appengine.DatastoreTable.initializeNonPK
 (DatastoreTable.java:391)
at org.datanucleus.store.appengine.DatastoreTable.buildMapping
 (DatastoreTable.java:285)
at org.datanucleus.store.appengine.DatastoreManager.buildStoreData
 (DatastoreManager.java:405)
at org.datanucleus.store.appengine.DatastoreManager.newStoreData
 (DatastoreManager.java:363)
at org.datanucleus.store.AbstractStoreManager.addClasses
 (AbstractStoreManager.java:788)
at org.datanucleus.store.AbstractStoreManager.addClass
 (AbstractStoreManager.java:759)
at
 org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass
 (MappedStoreManager.java:358)
at
 org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass
 (DatastoreManager.java:631)
at
 org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer
 (DatastoreFieldManager.java:1008)
at
 org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer
 (DatastoreFieldManager.java:998)
at org.datanucleus.store.appengine.DatastoreFieldManager.init
 (DatastoreFieldManager.java:133)
at org.datanucleus.store.appengine.DatastoreFieldManager.init
 (DatastoreFieldManager.java:167)
at

 org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess
 (DatastorePersistenceHandler.java:316)
at
 org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects

Re: [appengine-java] Critical issue with INDEX

2009-12-09 Thread Ravi Sharma
Thanks Ikai.


On Wed, Dec 9, 2009 at 6:30 PM, Ikai L (Google) ika...@google.com wrote:

 Here's the issue in our public tracker:

 http://code.google.com/p/googleappengine/issues/detail?id=2481


 On Wed, Dec 9, 2009 at 9:56 AM, Ikai L (Google) ika...@google.com wrote:

 Ravi,

 We're aware of the issue and have already begun investigating it. I'll
 open up a public issue to mirror our progress so everyone can follow it and
 add their comments.


 On Wed, Dec 9, 2009 at 1:09 AM, Ravi Sharma ping2r...@gmail.com wrote:

 Can anyone from google look into this issue please?


 On Mon, Dec 7, 2009 at 8:15 PM, Ravi Sharma ping2r...@gmail.com wrote:

 Hi Jason and all Google guys,
 This is real big problem and its not just canslimbot application but
 there are many applications, in today's mails i can see 3 people have faced
 this problem i ncluding m e. I am sure there is some defect in index
 building. Can you please have a look.

 Thanks,
 Ravi.


 On Mon, Dec 7, 2009 at 3:40 PM, GTZhou sharkillf...@gmail.com wrote:

 Jason:
I need your help.
Before I create the index,My app works fine,and I use the query
 below,I can get 1 row.
 SELECT  FROM StockBase where code = '600175' and season = '3' and year
 = '2009'
However,after create the index,and status of index is serving.I
 use the query above,then can not get anything.But I sure the data
 stored on the server.Because when I remove the and year = '2009'.I
 can also get the rows.
My application id is canslimbot.
Pls tell me the reason about it,thank u!

 --

 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=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-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=en.




 --
 Ikai Lan
 Developer Programs Engineer, Google App Engine




 --
 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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.


--

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




[appengine-java] Re: Class XXX has multiple relationship fields of type YYYY

2009-12-09 Thread David Fuelling
Thanks Max!  Just updated to 1.2.8 and ran into this problem.  The
workaround looks good, though I think you specified the boolean value
wrong if you want to disable this error.  Should be:

property
name=datanucleus.appengine.multipleRelationsOfSameTypeAreErrors
value=false/

In my case, the app builds fine with no Enhancer errors or warnings.
However, when I run my app, I'm get the following error when I try to
load entities that extend an abstract base class:

javax.persistence.PersistenceException: Persistent class XXX does not
seem to have been enhanced.

XXX is an abstract class similar to your B class above.

Any ideas?  My abstract class is not marked as an Entity.

--

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




Re: [appengine-java] Re: Processing incoming email

2009-12-09 Thread Ikai L (Google)
I've just tested this code out with Yahoo, Gmail and Hotmail for processing
an attachment. It's working well. Thanks to Jeremy Blythe for looking into
this and posting about it! I'll add this to the cookbook when I get a
chance.

// IncomingMailHandlerServlet.java

import com.google.appengine.api.datastore.Blob;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import javax.mail.Session;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.BodyPart;
import javax.jdo.PersistenceManager;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Logger;

import javatest.PMF;
import javatest.models.Image;

public class IncomingMailHandlerServlet extends HttpServlet {

private static final Logger log =
Logger.getLogger(IncomingMailHandlerServlet.class.getName());

protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try {
MimeMessage message = new MimeMessage(session,
request.getInputStream());
Object content = message.getContent();

if (content instanceof String) {
// do something
} else if (content instanceof Multipart) {
MimeMultipart inboundMultipart = (MimeMultipart) content;
for (int i = 0; i  inboundMultipart.getCount(); i++) {
BodyPart part = inboundMultipart.getBodyPart(i);

if (part.getDisposition() == null) {
// This is just a plain text part
} else if (part.getDisposition().equals(attachment)) {
// Create a new ByteArrayDataSource with this part
MimeBodyPart inboundMimeBodyPart = (MimeBodyPart)
part;

// The call to getContentType here may return a
filename along with content type. Ex:
// image/jpeg; name=filename.jpg
// Gmail and Yahoo add the filename, Hotmail
does not
// It doesn't seem to affect display in a browser
but you may wish to sanitize it
String contentType =
inboundMimeBodyPart.getContentType();

InputStream is = part.getInputStream();

byte[] rawData, buffer = new byte[8192];
int len;
ByteArrayOutputStream output = new
ByteArrayOutputStream();

try {
while ((len = is.read(buffer, 0, buffer.length))
!= -1) output.write(buffer, 0, len);
rawData = output.toByteArray();
} finally {
output.close();
}

PersistenceManager pm =
PMF.get().getPersistenceManager();

Image image = new Image(new Blob(rawData),
contentType);
try {
pm.makePersistent(image);
} finally {
pm.close();
}

}

}


} else {
// We got something weird, shouldn't ever get here. Let's
add some logging
}

} catch (MessagingException e) {
// do something
}
}

}

// Image.java
import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;

import javax.jdo.annotations.*;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Image {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;

@Persistent
private Blob data;

@Persistent
private String contentType;

public Image(Blob data, String contentType) {
this.data = data;
this.contentType = contentType;
}

public Key getKey() {
return key;
}

public Blob getData() {
return data;
}

public void setData(Blob data) {
this.data = data;
}

public String getContentType() {
return contentType;
}

public void setContentType(String contentType) {
this.contentType = contentType;
}
}



On Mon, Dec 7, 2009 at 5:47 PM, Ikai L (Google) ika...@google.com wrote:

 Sam,

 I understand your confusion. I'm looking into it. The code I posted was to
 convert an InputStream to the proper format. My understanding is that 1.2.8
 actually fixed the issue, so our 

[appengine-java] Re: Processing incoming email

2009-12-09 Thread Peter Ondruska
Thank you Jeremy, Ikai, and tetest. I was able to finish incoming mail
handler in Java and it works fine now. I has been confusing due to
changes in 1.2.7 and 1.2.8 releases. Peter

On Dec 9, 10:52 pm, Ikai L (Google) ika...@google.com wrote:
 I've just tested this code out with Yahoo, Gmail and Hotmail for processing
 an attachment. It's working well. Thanks to Jeremy Blythe for looking into
 this and posting about it! I'll add this to the cookbook when I get a
 chance.

 // IncomingMailHandlerServlet.java

 import com.google.appengine.api.datastore.Blob;

 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.ServletException;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMultipart;
 import javax.mail.Session;
 import javax.mail.MessagingException;
 import javax.mail.Multipart;
 import javax.mail.BodyPart;
 import javax.jdo.PersistenceManager;
 import java.io.IOException;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.util.Properties;
 import java.util.logging.Logger;

 import javatest.PMF;
 import javatest.models.Image;

 public class IncomingMailHandlerServlet extends HttpServlet {

     private static final Logger log =
 Logger.getLogger(IncomingMailHandlerServlet.class.getName());

     protected void doPost(HttpServletRequest request, HttpServletResponse
 response) throws ServletException, IOException {
         Properties props = new Properties();
         Session session = Session.getDefaultInstance(props, null);
         try {
             MimeMessage message = new MimeMessage(session,
 request.getInputStream());
             Object content = message.getContent();

             if (content instanceof String) {
                 // do something
             } else if (content instanceof Multipart) {
                 MimeMultipart inboundMultipart = (MimeMultipart) content;
                 for (int i = 0; i  inboundMultipart.getCount(); i++) {
                     BodyPart part = inboundMultipart.getBodyPart(i);

                     if (part.getDisposition() == null) {
                         // This is just a plain text part
                     } else if (part.getDisposition().equals(attachment)) {
                         // Create a new ByteArrayDataSource with this part
                         MimeBodyPart inboundMimeBodyPart = (MimeBodyPart)
 part;

                         // The call to getContentType here may return a
 filename along with content type. Ex:
                         //     image/jpeg; name=filename.jpg
                         //     Gmail and Yahoo add the filename, Hotmail
 does not
                         // It doesn't seem to affect display in a browser
 but you may wish to sanitize it
                         String contentType =
 inboundMimeBodyPart.getContentType();

                         InputStream is = part.getInputStream();

                         byte[] rawData, buffer = new byte[8192];
                         int len;
                         ByteArrayOutputStream output = new
 ByteArrayOutputStream();

                         try {
                             while ((len = is.read(buffer, 0, buffer.length))
 != -1) output.write(buffer, 0, len);
                             rawData = output.toByteArray();
                         } finally {
                             output.close();
                         }

                         PersistenceManager pm =
 PMF.get().getPersistenceManager();

                         Image image = new Image(new Blob(rawData),
 contentType);
                         try {
                             pm.makePersistent(image);
                         } finally {
                             pm.close();
                         }

                     }

                 }

             } else {
                 // We got something weird, shouldn't ever get here. Let's
 add some logging
             }

         } catch (MessagingException e) {
             // do something
         }
     }

 }

 // Image.java
 import com.google.appengine.api.datastore.Blob;
 import com.google.appengine.api.datastore.Key;

 import javax.jdo.annotations.*;

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 public class Image {

     @PrimaryKey
     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     private Key key;

     @Persistent
     private Blob data;

     @Persistent
     private String contentType;

     public Image(Blob data, String contentType) {
         this.data = data;
         this.contentType = contentType;
     }

     public Key getKey() {
         return key;
     }

     public Blob getData() {
         return data;
     }

     public void setData(Blob data) {
         this.data = data;
     }

     public String getContentType() {
         return contentType;
     }

     public 

Re: [appengine-java] Re: XMPP Message not being received

2009-12-09 Thread Ravi Sharma
Hi Googlers and GAE users,
I changed code little bit, there was one problem.And then i tried sedning a
message every 2 seconds and it went fine.
I think after this fix i will be able to get a speed of 80 messages/second,
but still far away from 3000/second.
i removed this line
*  Chat chat = connection.getChatManager().createChat(
ap...@appspot.com, messgageHandler);
*from function sendToGae and then i  could send messages faster. Now Chat
chat is my class variable and get created once in constructor . And after 1
message per 2 seconds i got curious and just ran the loop to send many
messages with out any delay and after sending 92 messages continuosly i got
Constraint response.It didnt say much about what constraint but i could send
90 messages in a row without delay.*
*

public void sendToGae(String message) throws XMPPException, MessageException
 {

*  Chat chat = connection.getChatManager().createChat(
ap...@appspot.com, messgageHandler);*//this line i removed
  //messageHandler will receive the message back from server, if i receive
the
same mesage back that means my message did not reach server.If i receive
  success, that means my message reached

 chat.sendMessage(messageXml);

 }
 public void disconnect() throws XMPPException
 {
 connection.disconnect();

 }}



On Tue, Dec 1, 2009 at 11:24 PM, Ravi Sharma ping2r...@gmail.com wrote:

 Hi Ikai,
 Yes you are right you might have got 10 messages/minute. As i said i also
 got 12 messages/min once( 1 messages every 5 seconds), but this not what i
 was expecting. Iwas expecting around 3000 messages/min. I had to send around
 5 messages and it completed yesterday. And first time i started sending
 messages on 24 Nov. so total 7  nights.
 But i think for 5 messages i should have spent around 5/3000 = 17
 minutes provided i stil have quota for the day. Lets says things are bit
 slower with GAE, so i can expect 1 hours. I am sure there is something
 missing somewhere. Does gtalk.google.com(XMPP server) has any limitation?.
 or any other problem.

 Can you please try to send like 1000 mesasges in a minute and let us know
 the result.

 And in my previous mail i forgot to add the response.
 The response i was getting for those messages was Service-unavailable .
 Error code 503.


 Thanks,
 Ravi.



 On Tue, Dec 1, 2009 at 10:05 PM, Ikai L (Google) ika...@google.comwrote:

 Ravi,

 Using the sample code, I am able to get above 10 messages a minute. What
 happens when you add your application in GTalk instead of your custom
 client?  Here's the code I'm using. It's basically an XMPP echo server:

 import java.io.IOException;
 import javax.servlet.http.*;

 import com.google.appengine.api.xmpp.*;

 @SuppressWarnings(serial)
 public class XMPPReceiverServlet extends HttpServlet {
 public void doPost(HttpServletRequest req, HttpServletResponse res)
 throws IOException {
 XMPPService xmpp = XMPPServiceFactory.getXMPPService();
 Message message = xmpp.parseMessage(req);

 JID fromJid = message.getFromJid();
 String body = message.getBody();
 String msgBody = Received message:  + body;
 Message msg = new MessageBuilder()
 .withRecipientJids(fromJid)
 .withBody(msgBody)
 .build();

 boolean messageSent = false;
 if (xmpp.getPresence(fromJid).isAvailable()) {
 SendResponse status = xmpp.sendMessage(msg);
 messageSent = (status.getStatusMap().get(fromJid) ==
 SendResponse.Status.SUCCESS);
 }

 if (!messageSent) {
 // Do something, log an error

 }
 }


 On Tue, Dec 1, 2009 at 7:35 AM, Ravi ping2r...@gmail.com wrote:

 Hi Ikai L/Google App Team,
 Did you get a chance to look at this problem?

 Thanks,
 Ravi

 On Nov 30, 8:19 pm, Ravi Sharma ping2r...@gmail.com wrote:
  Hi,
  Thanks for looking into it.I am sending the small code which i am
 using. I
  am using smack library.
  This behaviour is not consistant. Once i was able to send messges at
 every 5
  seconds(and sent around 4000) and once i had to make it 15 seconds for
 each
  message.
 
  i use the following class as
  GaeClientMessanger m = new GaeClientMessanger();
  m.initConnection();
  for(some loop condiiton)
  {
  ..
  m.sendToGae(message);}
 
  m.disconnect();
 
  public class GaeClientMessanger{
  private ConnectionConfiguration config;
  private XMPPConnection connection;
  private static LocalDefaultMessageController messgageHandler;
  protected Logger logger = Logger.getLogger(this.getClass());
 
  public void initConnection() throws XMPPException
  {
  config = new ConnectionConfiguration(talk.google.com,
  5222,
  gmail.com);
 
  connection = new XMPPConnection(config);
  connection.connect();
  connection.login(gmailu...@gmail.com, 

Re: [appengine-java] Re: Processing incoming email

2009-12-09 Thread Ikai L (Google)
Peter, I'm hoping this solved your issue with CIDs and inline image
attachments. If you can, it'd be awesome if you could post some sample code
for the group.

On Wed, Dec 9, 2009 at 2:02 PM, Peter Ondruska peter.ondru...@gmail.comwrote:

 Thank you Jeremy, Ikai, and tetest. I was able to finish incoming mail
 handler in Java and it works fine now. I has been confusing due to
 changes in 1.2.7 and 1.2.8 releases. Peter

 On Dec 9, 10:52 pm, Ikai L (Google) ika...@google.com wrote:
  I've just tested this code out with Yahoo, Gmail and Hotmail for
 processing
  an attachment. It's working well. Thanks to Jeremy Blythe for looking
 into
  this and posting about it! I'll add this to the cookbook when I get a
  chance.
 
  // IncomingMailHandlerServlet.java
 
  import com.google.appengine.api.datastore.Blob;
 
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.ServletException;
  import javax.mail.internet.MimeMessage;
  import javax.mail.internet.MimeBodyPart;
  import javax.mail.internet.MimeMultipart;
  import javax.mail.Session;
  import javax.mail.MessagingException;
  import javax.mail.Multipart;
  import javax.mail.BodyPart;
  import javax.jdo.PersistenceManager;
  import java.io.IOException;
  import java.io.ByteArrayOutputStream;
  import java.io.InputStream;
  import java.util.Properties;
  import java.util.logging.Logger;
 
  import javatest.PMF;
  import javatest.models.Image;
 
  public class IncomingMailHandlerServlet extends HttpServlet {
 
  private static final Logger log =
  Logger.getLogger(IncomingMailHandlerServlet.class.getName());
 
  protected void doPost(HttpServletRequest request, HttpServletResponse
  response) throws ServletException, IOException {
  Properties props = new Properties();
  Session session = Session.getDefaultInstance(props, null);
  try {
  MimeMessage message = new MimeMessage(session,
  request.getInputStream());
  Object content = message.getContent();
 
  if (content instanceof String) {
  // do something
  } else if (content instanceof Multipart) {
  MimeMultipart inboundMultipart = (MimeMultipart) content;
  for (int i = 0; i  inboundMultipart.getCount(); i++) {
  BodyPart part = inboundMultipart.getBodyPart(i);
 
  if (part.getDisposition() == null) {
  // This is just a plain text part
  } else if
 (part.getDisposition().equals(attachment)) {
  // Create a new ByteArrayDataSource with this
 part
  MimeBodyPart inboundMimeBodyPart = (MimeBodyPart)
  part;
 
  // The call to getContentType here may return a
  filename along with content type. Ex:
  // image/jpeg; name=filename.jpg
  // Gmail and Yahoo add the filename, Hotmail
  does not
  // It doesn't seem to affect display in a browser
  but you may wish to sanitize it
  String contentType =
  inboundMimeBodyPart.getContentType();
 
  InputStream is = part.getInputStream();
 
  byte[] rawData, buffer = new byte[8192];
  int len;
  ByteArrayOutputStream output = new
  ByteArrayOutputStream();
 
  try {
  while ((len = is.read(buffer, 0,
 buffer.length))
  != -1) output.write(buffer, 0, len);
  rawData = output.toByteArray();
  } finally {
  output.close();
  }
 
  PersistenceManager pm =
  PMF.get().getPersistenceManager();
 
  Image image = new Image(new Blob(rawData),
  contentType);
  try {
  pm.makePersistent(image);
  } finally {
  pm.close();
  }
 
  }
 
  }
 
  } else {
  // We got something weird, shouldn't ever get here. Let's
  add some logging
  }
 
  } catch (MessagingException e) {
  // do something
  }
  }
 
  }
 
  // Image.java
  import com.google.appengine.api.datastore.Blob;
  import com.google.appengine.api.datastore.Key;
 
  import javax.jdo.annotations.*;
 
  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class Image {
 
  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Key key;
 
  @Persistent
  private Blob data;
 
  @Persistent
  private String contentType;
 
  public Image(Blob 

[appengine-java] Re: File Access on App Engine

2009-12-09 Thread mattkrae34
Using the relative path worked.  I thought I had tried that

Thanks

On Dec 9, 3:51 am, andy.booth andy.booth...@googlemail.com wrote:
 Use a relative path, not an absolute path. So remove the forward slash
 prefix, to just FileInputStream(test.xml). So a file located in /
 projectfolder/war/data/anothertest.xml would be accessed using
 FileInputStream(data/anothertest.xml).

 Andy

 On Dec 8, 10:49 pm, mattkrae34 matt.krae...@gmail.com wrote:



  I'm using 1.2.8 SDK and on both local and the app engine I get the
  following exception:

  java.security.AccessControlException: access denied
  (java.io.FilePermission file.xml read)

  When I ever I try to open a FileInputStream

  XMLEventReader r = factory.createXMLEventReader(new FileInputStream(/
  test.xml));

  My appengine-web.xml contains the following:

          static-files
          include path=/**.xml /
      /static-files

          resource-files
          include path=/**.xml /
      /resource-files

  The file is located in the WEB-INF directory.

--

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




Re: [appengine-java] Copy production datastore to local_db.bin?

2009-12-09 Thread Ikai L (Google)
Regarding your question about connecting development code to the hosted
datastore: there's a tool in Python for connecting to the remote datastore:

http://code.google.com/appengine/articles/remote_api.html

The article has examples on putting together an interactive console, or
otherwise working with entities programmatically using Python. A single
datastore is not specific to Python or Java (some gotchas apply, such as if
you use serialized fields), so you can deploy a Python version of the
application that only implements remote_api. The concept is similar to the
cookbook recipe for using the Python bulk loader for a Java application:
http://appengine-cookbook.appspot.com/recipe/using-the-python-bulk-exporter-tool-with-a-java-application/

On Fri, Dec 4, 2009 at 6:05 PM, Hank Beasley hankbeasleym...@gmail.comwrote:

 Is it possible? I am new, but based on my research the answer is no.
 How about connecting my development code to the hosted datastore?

 --

 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=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=en.




Re: [appengine-java] Re: JAXB doesn't work for me in 1.2.8

2009-12-09 Thread Toby Reyelts
The built-in JAXB implementation should be available now. Please let us know
if you continue to see problems.

On Sat, Dec 5, 2009 at 3:16 AM, Jeremy Blythe jeremybly...@gmail.comwrote:

 Thanks, but I'll stick with Simple XML http://simple.sourceforge.net/
 until 1.2.9 :)

 On Fri, Dec 4, 2009 at 10:55 PM, Toby Reyelts to...@google.com wrote:
  It's probably worth mentioning that, as a temporary workaround, you
 should
  be able to bundle your own JAXB implementation with your webapp. For
  example, the reference version can be obtained
  from https://jaxb.dev.java.net/.
 
  On Fri, Dec 4, 2009 at 4:31 PM, Toby Reyelts to...@google.com wrote:
 
  Thanks for the quick reports folks. We've identified this as a fault
 which
  occurred during our push to production. We're working on this and will
 post
  back on this thread when it's resolved.
 
  On Fri, Dec 4, 2009 at 2:26 PM, javaprime javapr...@gmail.com wrote:
 
  Error for /cron/url_update_delta
  java.lang.ExceptionInInitializerError
 at
  com.amazonaws.queue.AmazonSQSClient.clinit(AmazonSQSClient.java:
  108)
 at
  compareodds.webapp.server.util.SQSQueue.buildQueue(SQSQueue.java:
  65)
 at compareodds.webapp.server.util.SQSQueue.buildURLQueue
  (SQSQueue.java:57)
 at
  compareodds.webapp.server.request.URLUpdate.init(URLUpdate.java:
  33)
 at
  compareodds.webapp.server.request.handlers.cron_url_update_delta.doGet
  (cron_url_update_delta.java:37)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
 at
  org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
  487)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1093)
 at
 com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
  (SaveSessionFilter.java:35)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1084)
 at
  com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
  (TransactionCleanupFilter.java:43)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1084)
 at org.mortbay.jetty.servlet.ServletHandler.handle
  (ServletHandler.java:360)
 at org.mortbay.jetty.security.SecurityHandler.handle
  (SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle
  (SessionHandler.java:181)
 at org.mortbay.jetty.handler.ContextHandler.handle
  (ContextHandler.java:712)
 at
  org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
  405)
 at
 com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
  (AppVersionHandlerMap.java:238)
 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:5235)
 at com.google.apphosting.base.RuntimePb$EvaluationRuntime
  $6.handleBlockingRequest(RuntimePb.java:5233)
 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:838)
 at com.google.tracing.LocalTraceSpanRunnable.run
  (LocalTraceSpanRunnable.java:56)
 at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
  (LocalTraceSpanBuilder.java:536)
 at com.google.net.rpc.impl.Server.startRpc(Server.java:793)
 at
 com.google.net.rpc.impl.Server.processRequest(Server.java:368)
 at com.google.net.rpc.impl.ServerConnection.messageReceived
  (ServerConnection.java:448)
 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:
  466)
 at com.google.net.async.EventDispatcher.processNetworkEvents
  (EventDispatcher.java:759)
 at com.google.net.async.EventDispatcher.internalLoop
  (EventDispatcher.java:205)
 at
 

Re: [appengine-java] Re: Cache stops returning results under heavy load

2009-12-09 Thread Ikai L (Google)
What kind of objects are you storing the cache? Are you storing large binary
objects?

On Tue, Dec 8, 2009 at 12:23 AM, Martin Caslavsky mcaslav...@gmail.comwrote:

 Sorry, it is dmczum.
 FYI redeploy of the app helps for a few hours.

 Martin

 On Dec 8, 2:20 am, Ikai L (Google) ika...@google.com wrote:
  Martin,
 
  Can you provide your app ID? I'm not able to look up czumdm.
 
  On Sun, Dec 6, 2009 at 4:40 PM, Martin Caslavsky mcaslav...@gmail.com
 wrote:
 
 
 
   Hi,
 
   my java app (czumdm) was over quota, so I enabled billing. First
   request was processed at 12-06 04:10PM 11.559. App worked correctly --
   most request was processed  from JCache (logged as execute()
   skipping) and several request was processed directly (logged as
   execute()).
 
   But as of 12-06 04:15PM 49.099 the method call cache.containsKey(key)
   returns false, thus no request is processed from cache!
 
   Cache statistics shows some cached objects (correct) but hits count is
   stalled and miss count is increasing (weird).
 
   Greets
   Martin
 
   --
 
   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
 google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%252bunsubscr...@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.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=en.




Re: [appengine-java] Invoking another GAE Restful service in one GAE app

2009-12-09 Thread Ikai L (Google)
Which tutorial are you referring to? If you are invoking a REST call, you
can also make use of the low-level URLFetch API that we provide:
http://code.google.com/appengine/docs/java/urlfetch/overview.html

On Mon, Dec 7, 2009 at 8:57 PM, Featheast Lee featheast@gmail.comwrote:

 I have encountered this problem in my project.

 I got two applications, one is an GAE Java, another is normal Java
 app. The normal Java app will provide Restful web service to invoke.

 Now I would like to invoke those web services in one of my GAE app's
 servlet.

 The working process is like: I call the GAE service to a servlet, then
 the servlet will invoke the restful service in the normal Java app.

 I tried to use ClientResource class follow the steps in tutorial,
 however, a warning with:WARNING: The protocol used by this request is
 not declared in the list of client connectors. (HTTP).

 Can anyone tell me how to solve this problem?

 Many 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=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=en.




[appengine-java] Re: Cache stops returning results under heavy load

2009-12-09 Thread Martin Caslavsky
Yes, cache maps Strings (URLs) to byte[] blobs (RSS feed content).

Martin

On Dec 10, 12:13 am, Ikai L (Google) ika...@google.com wrote:
 What kind of objects are you storing the cache? Are you storing large binary
 objects?

 On Tue, Dec 8, 2009 at 12:23 AM, Martin Caslavsky mcaslav...@gmail.comwrote:



  Sorry, it is dmczum.
  FYI redeploy of the app helps for a few hours.

  Martin

  On Dec 8, 2:20 am, Ikai L (Google) ika...@google.com wrote:
   Martin,

   Can you provide your app ID? I'm not able to look up czumdm.

   On Sun, Dec 6, 2009 at 4:40 PM, Martin Caslavsky mcaslav...@gmail.com
  wrote:

Hi,

my java app (czumdm) was over quota, so I enabled billing. First
request was processed at 12-06 04:10PM 11.559. App worked correctly --
most request was processed  from JCache (logged as execute()
skipping) and several request was processed directly (logged as
execute()).

But as of 12-06 04:15PM 49.099 the method call cache.containsKey(key)
returns false, thus no request is processed from cache!

Cache statistics shows some cached objects (correct) but hits count is
stalled and miss count is increasing (weird).

Greets
Martin

--

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
  google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%252bunsubscr...@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.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=en.




[appengine-java] Re: Critical issue with INDEX

2009-12-09 Thread GTZhou
Thanks Ikai

On 12月10日, 上午2时30分, Ikai L (Google) ika...@google.com wrote:
 Here's the issue in our public tracker:

 http://code.google.com/p/googleappengine/issues/detail?id=2481

 On Wed, Dec 9, 2009 at 9:56 AM, Ikai L (Google) ika...@google.com wrote:



  Ravi,

  We're aware of the issue and have already begun investigating it. I'll open
  up a public issue to mirror our progress so everyone can follow it and add
  their comments.

  On Wed, Dec 9, 2009 at 1:09 AM, Ravi Sharma ping2r...@gmail.com wrote:

  Can anyone from google look into this issue please?

  On Mon, Dec 7, 2009 at 8:15 PM, Ravi Sharma ping2r...@gmail.com wrote:

  Hi Jason and all Google guys,
  This is real big problem and its not just canslimbot application but
  there are many applications, in today's mails i can see 3 people have 
  faced
  this problem i ncluding m e. I am sure there is some defect in index
  building. Can you please have a look.

  Thanks,
  Ravi.

  On Mon, Dec 7, 2009 at 3:40 PM, GTZhou sharkillf...@gmail.com wrote:

  Jason:
     I need your help.
     Before I create the index,My app works fine,and I use the query
  below,I can get 1 row.
  SELECT  FROM StockBase where code = '600175' and season = '3' and year
  = '2009'
     However,after create the index,and status of index is serving.I
  use the query above,then can not get anything.But I sure the data
  stored on the server.Because when I remove the and year = '2009'.I
  can also get the rows.
     My application id is canslimbot.
     Pls tell me the reason about it,thank u!

  --

  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=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-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=en.

  --
  Ikai Lan
  Developer Programs Engineer, Google App Engine

 --
 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=en.




Re: [appengine-java] An entity group that does not have a root entity supports transaction. How does it work?

2009-12-09 Thread Yasuo Higa
Hi Ikai,

On Thu, Dec 10, 2009 at 2:49 AM, Ikai L (Google) ika...@google.com wrote:
 Which timestamp are you referring to?

I mean timestamp as committed timestamp explained by the following
document(50p):
http://snarfed.org/space/datastore_talk.html

Thanks,

Yasuo Higa

 On Tue, Dec 8, 2009 at 6:35 PM, Yasuo Higa higaya...@gmail.com wrote:

 Thanks for your reply, Ikai.

  Entity groups are distributed based on the key and not necessarily the
  root
  entity. Thus, it is possible to place entities in the same entity group
  without an entity parent. Something similar to what you have done is
  also
  possible by creating a root entity, adding descendants, then removing
  the
  root entity. Transactions are possible for entities in the same entity
  group.

 Do you mean that a root key has time-stamp for transaction
 or an entity group itself is an entity?

 I would like to know where time-stamp for transaction is stored.

 Thanks,

 Yasuo Higa

 --

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





 --
 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=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-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: Copy production datastore to local_db.bin?

2009-12-09 Thread Dominik Steiner
Hi Ikai,

I followed the instructions in the cook book for the python uploader/
downloader in order to be able to download and backup the data of my
java application.

As already posted in the cook book article, I got the following
situation:

I would love to be able to download data in order to backup the data
of my application and I tried your steps. One thing that didn't work
for me was the line

appcfg.py --server=python.latest.appid.appspot.com download_data
exporter --filename=data.csv --kind=Thing --config_file=exporter/
thing_exporter.py

but had to write

appcfg.py --server=python.latest.xelavos.appspot.com download_data --
filename=data.csv --kind=Thing --config_file=exporter/
thing_exporter.py path/to/my/pythondirectory

Then after being able to launch the exporter i got the following error
after a while of downloading

.[INFO ] Product: No descending index on __key__, performing serial
download
.
Traceback (most recent call last):
File /usr/local/bin/appcfg.py, line 60, in
run_file(__file__, globals())
File /usr/local/bin/appcfg.py, line 57, in run_file
execfile(script_path, globals_)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/appcfg.py, line 2548, in
main(sys.argv)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/appcfg.py, line 2539, in main
result = AppCfgApp(argv).Run()
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/appcfg.py, line 1640, in Run
self.action(self)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/appcfg.py, line 2427, in __call__
return method()
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/appcfg.py, line 2293, in PerformDownload
run_fn(args)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/appcfg.py, line 2215, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 3894, in Run
return _PerformBulkload(arg_dict)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 3800, in _PerformBulkload
return_code = app.Run()
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 3158, in Run
self.progress_thread.WorkFinished()
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 2207, in WorkFinished
exporter.output_entities(self.result_db.AllEntities())
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 2788, in output_entities
for entity in entity_generator)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 2788, in
for entity in entity_generator)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 2769, in __SerializeEntity
encoding = self.__EncodeEntity(entity)
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 2757, in __EncodeEntity
writer.writerow(self.__ExtractProperties(entity))
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py, line 2738, in
__ExtractProperties
encoding.append(fn(entity[name]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in
position 7: ordinal not in range(128)


Do you know what this error means and how i can fix it?

Thanks for any help

Dominik

--

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 

Re: [appengine-java] Re: JAXB doesn't work for me in 1.2.8

2009-12-09 Thread Jeremy Blythe
It works now. Thanks.

On Wed, Dec 9, 2009 at 11:01 PM, Toby Reyelts to...@google.com wrote:
 The built-in JAXB implementation should be available now. Please let us know
 if you continue to see problems.

 On Sat, Dec 5, 2009 at 3:16 AM, Jeremy Blythe jeremybly...@gmail.com
 wrote:

 Thanks, but I'll stick with Simple XML http://simple.sourceforge.net/
 until 1.2.9 :)

 On Fri, Dec 4, 2009 at 10:55 PM, Toby Reyelts to...@google.com wrote:
  It's probably worth mentioning that, as a temporary workaround, you
  should
  be able to bundle your own JAXB implementation with your webapp. For
  example, the reference version can be obtained
  from https://jaxb.dev.java.net/.
 
  On Fri, Dec 4, 2009 at 4:31 PM, Toby Reyelts to...@google.com wrote:
 
  Thanks for the quick reports folks. We've identified this as a fault
  which
  occurred during our push to production. We're working on this and will
  post
  back on this thread when it's resolved.
 
  On Fri, Dec 4, 2009 at 2:26 PM, javaprime javapr...@gmail.com wrote:
 
  Error for /cron/url_update_delta
  java.lang.ExceptionInInitializerError
         at
  com.amazonaws.queue.AmazonSQSClient.clinit(AmazonSQSClient.java:
  108)
         at
  compareodds.webapp.server.util.SQSQueue.buildQueue(SQSQueue.java:
  65)
         at compareodds.webapp.server.util.SQSQueue.buildURLQueue
  (SQSQueue.java:57)
         at
  compareodds.webapp.server.request.URLUpdate.init(URLUpdate.java:
  33)
         at
  compareodds.webapp.server.request.handlers.cron_url_update_delta.doGet
  (cron_url_update_delta.java:37)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
         at
  org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
  487)
         at
  org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1093)
         at
  com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
  (SaveSessionFilter.java:35)
         at
  org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1084)
         at
  com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
  (TransactionCleanupFilter.java:43)
         at
  org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
  (ServletHandler.java:1084)
         at org.mortbay.jetty.servlet.ServletHandler.handle
  (ServletHandler.java:360)
         at org.mortbay.jetty.security.SecurityHandler.handle
  (SecurityHandler.java:216)
         at org.mortbay.jetty.servlet.SessionHandler.handle
  (SessionHandler.java:181)
         at org.mortbay.jetty.handler.ContextHandler.handle
  (ContextHandler.java:712)
         at
  org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
  405)
         at
  com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
  (AppVersionHandlerMap.java:238)
         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:5235)
         at com.google.apphosting.base.RuntimePb$EvaluationRuntime
  $6.handleBlockingRequest(RuntimePb.java:5233)
         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:838)
         at com.google.tracing.LocalTraceSpanRunnable.run
  (LocalTraceSpanRunnable.java:56)
         at
  com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
  (LocalTraceSpanBuilder.java:536)
         at com.google.net.rpc.impl.Server.startRpc(Server.java:793)
         at
  com.google.net.rpc.impl.Server.processRequest(Server.java:368)
         at com.google.net.rpc.impl.ServerConnection.messageReceived
  (ServerConnection.java:448)
         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:
  466)
         at com.google.net.async.EventDispatcher.processNetworkEvents
  (EventDispatcher.java:759)
         at