[appengine-java] Extending GAE's Jetty config

2010-03-09 Thread alesj
Does GAE use JettyWebXmlConfiguration to allow for WebAppContext
custom configuration - via jetty-web.xml?
I see that class in appengine-local-runtime.jar, but is it part of
Jetty' default Configuration instances?
My guess would be no, as putting invalid jetty-web.xml in WEB-INF
doesn't output any exception.

This would be useful to allow for different extensions; e.g. custom
injection support -- jsr299/CDI.

-Ales

-- 
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: Extending GAE's Jetty config

2010-03-10 Thread alesj
OK, filled this here:
* http://code.google.com/p/googleappengine/issues/detail?id=2943

On Mar 9, 8:21 pm, Don Schwarz  wrote:
> No, at the moment we specifically disable jetty-web.xml for security
> purposes.  Feel free to file a feature request in our issue tracker asking
> us to re-enable it.
>
> On Tue, Mar 9, 2010 at 9:52 AM, alesj  wrote:
> > Does GAE use JettyWebXmlConfiguration to allow for WebAppContext
> > custom configuration - via jetty-web.xml?
> > I see that class in appengine-local-runtime.jar, but is it part of
> > Jetty' default Configuration instances?
> > My guess would be no, as putting invalid jetty-web.xml in WEB-INF
> > doesn't output any exception.
>
> > This would be useful to allow for different extensions; e.g. custom
> > injection support -- jsr299/CDI.
>
> > -Ales
>
> > --
> > 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] Using app's ELResolver class

2010-04-07 Thread alesj
I'm trying to use new EL api - version 2.2. - which knows how to deal
with parameterized invocations; e.g. #{FooBarDAO.getInfos('alesj')}.
Hence I'm bundling this new EL jars with my app.

At runtime I get this

java.lang.NoSuchMethodError: javax.el.ELResolver.invoke(Ljavax/el/
ELContext;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Class;[Ljava/
lang/Object;)Ljava/lang/Object;
at com.sun.el.parser.AstValue.getValue(AstValue.java:111)
at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:
219)
at
org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:
71)
at
com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:
71)

which lead me to this finding (cl is the ClassLoader of my servlet)

 Class elc = cl.loadClass("javax.el.ELResolver");
 String info =
elc.getProtectionDomain().getCodeSource().getLocation().toExternalForm();
 System.out.println("info = " + info);
 // info ==> file:/foobar/appengine-java-sdk-1.3.2/lib/shared/
geronimo-el_1.0_spec-1.0.1.jar

This looks wrong per web CL spec, which is children first (or current
CL first, then parent CL).
Any reason for this?

-- 
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: Using app's ELResolver class

2010-04-07 Thread alesj
While this finds the right jar

 URL url = cl.getResource("META-INF/maven/javax.el/el-api/
pom.properties");
 String info = url.toExternalForm();
 System.out.println("info = " + info);
 // jar:file:/foobar/projects/foobar/trunk/server/target/
foobar-server-0.0.1-SNAPSHOT/WEB-INF/lib/el-api-2.2.jar!/META-INF/
maven/javax.el/el-api/pom.properties

So we know the resources are there.

-- 
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: Using app's ELResolver class

2010-04-08 Thread alesj
I tried all sorts of things -- implementing my own child-first
classloader,
then passing it around as Thread.getContextClassLoader,
creating my listeners and servlets with it, but w/o success.

The issue is, that JSF is already installed/deployed as part of custom
Jetty/GAE initialization,
hence my "wrapped" FacesServlet wasn't able to find proper factories --
> breaking at initialization.
Not wanting to go deeper into JSF, I stopped there.

Even if we by-passed this factory lookup, my guess is we would
encounter other EL related problems,
as I would suspect that GAE's EL classes would sometimes leak into our
code --> CCE.

On Apr 7, 8:21 pm, Joel Weight  wrote:
> I ran into this a few months ago when first getting jsf 2 going.
>  Unfortunately I didn't find a resolution and wound up on the old EL
> version, so if you figure something out, please let us know.
>
> Thanks,
> Joel
>
> On Wed, Apr 7, 2010 at 5:10 AM, alesj  wrote:
> > While this finds the right jar
>
> > URL url = cl.getResource("META-INF/maven/javax.el/el-api/
> > pom.properties");
> > String info = url.toExternalForm();
> >  System.out.println("info = " + info);
> >  // jar:file:/foobar/projects/foobar/trunk/server/target/
> > foobar-server-0.0.1-SNAPSHOT/WEB-INF/lib/el-api-2.2.jar!/META-INF/
> > maven/javax.el/el-api/pom.properties
>
> > So we know the resources are there.
>
> > --
> > 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] urlfetch and embedded gae usage error

2010-08-09 Thread alesj
When running (embedded) GAE via appengine-tools-api API

 DevAppServerFactory factory = new DevAppServerFactory();
 server = factory.createDevAppServer(appLocation,
containerConfig.getBindAddress(), containerConfig.getBindHttpPort());
 Map properties = System.getProperties();
 //noinspection unchecked
 server.setServiceProperties(properties);
 server.start();

I get a known error, although I don't understand the reason behind it.

Running this test code

  URL url = new URL("http://localhost:8080/test";);
  URLConnection conn = url.openConnection();
  conn.setDoOutput(true);
  conn.setDoInput(true);
  OutputStream out = conn.getOutputStream();
  FooBar ping = new FooBar();
  out.write(SerializationFactory.serialize(ping));
  out.flush();
  out.close();
  InputStream in = conn.getInputStream(); // <-- ERROR

produces

com.google.apphosting.api.ApiProxy$CallNotFoundException: The API
package 'urlfetch' or call 'Fetch()' was not found.
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:95)
at
com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:
34)
at
com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler
$Connection.fetchResponse(URLFetchServiceStreamHandler.java:404)
at
com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler
$Connection.getInputStream(URLFetchServiceStreamHandler.java:283)

I found this old post, but I don't see how to enable this to fix my
problem.
e.g. when, how, where to setup this, ...

*
http://groups.google.com/group/google-appengine-java/browse_thread/thread/9512c09af2e969bc/e55ed5e2456865b9?lnk=gst&q=%27urlfetch%27+or+call+%27Fetch%28%29%27+was+not+found#e55ed5e2456865b9

Any idea what can be done to make this exception go away? :-)

-- 
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: urlfetch and embedded gae usage error

2010-08-09 Thread alesj
> The URL fetch API service has not been registered.  You might need to  
> set the environment and/or ApiProxy.Delegate.

Why is it not registered?

I tried setting up the Delegate, but to no effect.
I probably did it too late?

-- 
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: urlfetch and embedded gae usage error

2010-08-09 Thread alesj
> See an example here which allows running GAE from a normal main() method
>
> http://code.google.com/p/remote-datastore/source/browse/src/main/java...

How should appId and warPath look like?
(I see here are "no-local-appid-set" ands ".")
Or what's their purpose?

-- 
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: urlfetch and embedded gae usage error

2010-08-09 Thread alesj
In which jar are these classes located?

import com.google.appengine.tools.development.ApiProxyLocal;
import com.google.appengine.tools.development.ApiProxyLocalFactory;
import com.google.appengine.tools.development.LocalServerEnvironment;

-- 
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: urlfetch and embedded gae usage error

2010-08-09 Thread alesj
OK, found it

Skywalker:impl alesj$ jar -tf appengine-local-runtime.jar | grep
ServerEnv
com/google/appengine/tools/development/LocalServerEnvironment.class

On Aug 9, 4:52 pm, alesj  wrote:
> In which jar are these classes located?
>
> import com.google.appengine.tools.development.ApiProxyLocal;
> import com.google.appengine.tools.development.ApiProxyLocalFactory;
> import com.google.appengine.tools.development.LocalServerEnvironment;

-- 
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: urlfetch and embedded gae usage error

2010-08-09 Thread alesj
I've added this just after the server is started, but no luck. :-(

  ApiProxy.Environment env = new DelegatingEnvironment(new
DummyEnvironment())
  {
 @Override
 public String getAppId()
 {
return archive.getName();
 }
  };
  ApiProxyLocalFactory aplf = new ApiProxyLocalFactory();
  ApiProxy.Delegate delegate = aplf.create(new
DummyLocalServerEnvironment(appLocation, containerConfig));

  ApiProxy.setEnvironmentForCurrentThread(env);
  ApiProxy.setDelegate(delegate);

-- 
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: urlfetch and embedded gae usage error

2010-08-11 Thread alesj
OK, got a bit further.
After adding dummy Environment and Delegate, I now get this:

com.google.appengine.repackaged.com.google.protobuf.UninitializedMessageException:
Message missing required fields: StatusCode
at com.google.appengine.repackaged.com.google.protobuf.AbstractMessage
$Builder.newUninitializedMessageException(AbstractMessage.java:522)
at com.google.appengine.api.urlfetch.URLFetchServicePb
$URLFetchResponse$Builder.build(URLFetchServicePb.java:2034)
at
com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:
49)
at
com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler
$Connection.fetchResponse(URLFetchServiceStreamHandler.java:404)
at
com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler
$Connection.getInputStream(URLFetchServiceStreamHandler.java:283)
at java.net.URL.openStream(URL.java:1010)

I guess the dummy Delegate needs to be smarter. :)

Again, do we know what's the reason the Environment and Delegate are
not set in this embedded GAE usage?

-- 
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] EL update or CL fix

2010-10-10 Thread alesj
It's been a while since I reported this odd ClassLoading (and EL)
behavior:
* 
http://groups.google.com/group/google-appengine-java/browse_thread/thread/e9c9578f034dd1f9

Any plans on fixing this?
Or, are there perhaps valid reasons why EL is included in GAE
distribution AND loaded by the app's CL?

-- 
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: EL update or CL fix

2010-10-10 Thread alesj
Related post:
* 
http://groups.google.com/group/google-appengine-java/browse_thread/thread/67c8c345d386eaec

-- 
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] JPA query + missing the obvious?

2010-10-14 Thread alesj
I have this query:

  Query query = getEM().createQuery("select s from Subscription s
where s.clientId = ?1 and s.topicId = ?2");
  query.setParameter(1, client.getId());
  query.setParameter(2, topic.getId());
  return getSingleResult(query);

I'm pretty sure it should return some results - the proper data is
persisted before this,
but yet, I don't get any results.

Which obvious thing am I missing?

My entity class:

@Entity
public class Subscription extends AbstractEntity
{
   private static long serialVersionUID = 1l;

   private Long clientId;
   private Long topicId;

   public Long getClientId()
   {
  return clientId;
   }

   public void setClientId(Long client)
   {
  this.clientId = client;
   }

   public Long getTopicId()
   {
  return topicId;
   }

   public void setTopicId(Long topicId)
   {
  this.topicId = topicId;
   }
}

-- 
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: JPA query + missing the obvious?

2010-10-14 Thread alesj
A missing info -- the matching data is persisted before, in a separate/
different transaction.

-- 
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: JPA query + missing the obvious?

2010-10-15 Thread alesj
Experimenting a bit more, I'm now even more confused ...

  Set set = new HashSet();

  Query query = getEM().createQuery("select s from Subscription s
where s.clientId = ?1");
  Long cid = client.getId();
  query.setParameter(1, cid);
  List list = query.getResultList(); // <-- not empty
  set.addAll(list);

  query = getEM().createQuery("select s from Subscription s where
s.topicId = ?1");
  Long tid = topic.getId();
  query.setParameter(1, tid);
  list = query.getResultList(); // <-- same results as
before -- as we have proper "intersection" data
  set.addAll(list);

  query = getEM().createQuery("select s from Subscription s where
s.clientId = ?1 and s.topicId = ?2");
  query.setParameter(1, cid);
  query.setParameter(2, tid);
  list = query.getResultList(); // <- no results?!?
  set.addAll(list);

  return getSingleResult(set);

-- 
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] memcache and id parsing error

2010-10-17 Thread alesj
Any idea why this happens?

javax.servlet.ServletContext log: unavailable
com.google.appengine.api.memcache.InvalidValueException: IO exception
parsing value of '1'
at
com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:
289)
at com.google.appengine.api.memcache.stdimpl.GCache.get(GCache.java:
158)
at
org.datanucleus.cache.javaxcache.JavaxCacheLevel2Cache.get(JavaxCacheLevel2Cache.java:
116)
at
org.datanucleus.ObjectManagerImpl.getObjectFromCache(ObjectManagerImpl.java:
3658)
at
org.datanucleus.ObjectManagerImpl.findObjectUsingAID(ObjectManagerImpl.java:
2123)
at
org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:
555)
at
org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:
520)
at org.datanucleus.store.appengine.query.DatastoreQuery.access
$300(DatastoreQuery.java:110)
at org.datanucleus.store.appengine.query.DatastoreQuery
$6.apply(DatastoreQuery.java:638)
at org.datanucleus.store.appengine.query.DatastoreQuery
$6.apply(DatastoreQuery.java:630)
at
org.datanucleus.store.appengine.query.LazyResult.resolveNext(LazyResult.java:
94)
at org.datanucleus.store.appengine.query.LazyResult
$LazyAbstractListIterator.computeNext(LazyResult.java:215)
at
org.datanucleus.store.appengine.query.AbstractIterator.tryToComputeNext(AbstractIterator.java:
132)
at
org.datanucleus.store.appengine.query.AbstractIterator.hasNext(AbstractIterator.java:
127)
at org.datanucleus.store.appengine.query.LazyResult
$AbstractListIterator.hasNext(LazyResult.java:169)

-- 
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: memcache and id parsing error

2010-10-17 Thread alesj
Is there a way to clear memcache from admin console?

On Oct 17, 3:26 pm, alesj  wrote:
> Any idea why this happens?
>
> javax.servlet.ServletContext log: unavailable
> com.google.appengine.api.memcache.InvalidValueException: IO exception
> parsing value of '1'
>         at
> com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:
> 289)
>         at com.google.appengine.api.memcache.stdimpl.GCache.get(GCache.java:
> 158)
>         at
> org.datanucleus.cache.javaxcache.JavaxCacheLevel2Cache.get(JavaxCacheLevel2Cache.java:
> 116)
>         at
> org.datanucleus.ObjectManagerImpl.getObjectFromCache(ObjectManagerImpl.java:
> 3658)
>         at
> org.datanucleus.ObjectManagerImpl.findObjectUsingAID(ObjectManagerImpl.java:
> 2123)
>         at
> org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:
> 555)
>         at
> org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:
> 520)
>         at org.datanucleus.store.appengine.query.DatastoreQuery.access
> $300(DatastoreQuery.java:110)
>         at org.datanucleus.store.appengine.query.DatastoreQuery
> $6.apply(DatastoreQuery.java:638)
>         at org.datanucleus.store.appengine.query.DatastoreQuery
> $6.apply(DatastoreQuery.java:630)
>         at
> org.datanucleus.store.appengine.query.LazyResult.resolveNext(LazyResult.java:
> 94)
>         at org.datanucleus.store.appengine.query.LazyResult
> $LazyAbstractListIterator.computeNext(LazyResult.java:215)
>         at
> org.datanucleus.store.appengine.query.AbstractIterator.tryToComputeNext(AbstractIterator.java:
> 132)
>         at
> org.datanucleus.store.appengine.query.AbstractIterator.hasNext(AbstractIterator.java:
> 127)
>         at org.datanucleus.store.appengine.query.LazyResult
> $AbstractListIterator.hasNext(LazyResult.java:169)

-- 
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: memcache and id parsing error

2010-10-17 Thread alesj
> Any idea why this happens?

To answer things myself.
This one is actually pretty obvious, if the error reporting would be
less confusing / better.
It's a plain simple issue of forgetting to change serialVersionUID
when changing entity's class signature.

-- 
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: JPA query + missing the obvious?

2010-10-17 Thread alesj
Again, to answer things myself.

This one looks like a bug in JPA query parameter setting,
or I'm using it the wrong way -- what's the index start, 0 or 1?
(I would expect if I set ?1, then I should use 1 as parameter index,
right?)

The query works correctly if you use named version of parameter
setting.
e.g. setParameter("some_id", id) vs. setParamter(1, id)

-- 
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] MailService::sendToAdmins, what should To look like?

2010-10-17 Thread alesj
Reading this:
*
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/mail/MailService.html#sendToAdmins%28com.google.appengine.api.mail.MailService.Message%29

I'm not able to gather what the "to" property should look like in
Message.
>From the javadoc, I would expect it to be "" - empty string.

Using that

 MailService.Message msg = new MailService.Message(sender, "",
subject, textBody);
 mailService.sendToAdmins(msg);

throws me this exception

java.lang.IllegalArgumentException: Bad Request: Unexpected recipients

Tried putting null there (into "to") -- I get NPE.

So, what's the right value or way to have this working?

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



[appengine-java] Re: MailService::sendToAdmins, what should To look like?

2010-10-18 Thread alesj
The solution is here:

 MailService.Message msg = new MailService.Message();
 msg.setSender(sender);
 msg.setSubject(subject);
 msg.setTextBody(textBody);
 mailService.sendToAdmins(msg);


On Oct 18, 12:11 am, alesj  wrote:
> Reading this:
> *http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
>
> I'm not able to gather what the "to" property should look like in
> Message.
> From the javadoc, I would expect it to be "" - empty string.
>
> Using that
>
>          MailService.Message msg = new MailService.Message(sender, "",
> subject, textBody);
>          mailService.sendToAdmins(msg);
>
> throws me this exception
>
> java.lang.IllegalArgumentException: Bad Request: Unexpected recipients
>
> Tried putting null there (into "to") -- I get NPE.
>
> So, what's the right value or way to have this working?

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



[appengine-java] Re: Recommended maximum number of entities in an entity group

2010-10-21 Thread alesj
I think you're confusing entity *group* with actual entities stored in
datastore, as I doubt you'll have thousands of related entities.
--> 
http://code.google.com/appengine/docs/java/datastore/transactions.html#Using_Transactions
see "Entity groups"

On Oct 20, 7:39 pm, "nicanor.babula"  wrote:
> Hi everbody,
>
> I have a question regarding the datastore best-practices.
>
> The appengine's official documentation says that is not a good
> practice to put too many entities in the same entity group. What does
> "too many" mean in this case? Hundreds? Thousands? Milions?
>
> Thanks in advance,
> Cristian Babula.

-- 
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] Phantom JPA entity

2010-11-02 Thread alesj
We have a simple Java web app - using JPA with 2nd level cache
enabled.
We're running 2 instances of this app simultaneously -- test env and
real production.
Atm the two instances don't diff much; both use the same persistence-
unit name, same cache name, same entities, ...
OK, the application name in the app engine (appengone-
web.xml#application) is of course different.


 
org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider










When running our app in production, we sometimes get "phantom" entity
results.
e.g. we see an entity result that matches (is equal to) some result we
put in out test app instance.

Searching for this, let me to this old post:
* 
http://stackoverflow.com/questions/3033286/appengine-datastore-phantom-entity-inconsistent-state
which might be similar.

Is this a know issue?

Or are we missing something to do a proper split?
e.g. too much of the "same" stuff -- PU name, cache name, ...?

Thanks for any info.

-- 
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: Memcache: can't get it working

2010-11-05 Thread alesj
http://code.google.com/appengine/docs/java/memcache/overview.html

>> Values can expire from the memcache at any time, and may be expired prior to 
>> the expiration deadline set for the value.

All looks fine, but like it says, cached value can go away at any
time.
Which is probably what's happening in your case.

On Nov 5, 1:45 pm, Lennart Benoot  wrote:
> Hi all,
>
> I'm trying to implement Memcache but without success so far. I have
> difficulties finding examples containing fully working code so I tried
> to construct based on what I could find. Here's the code to get a
> reference to the cache:
>
> cache= CacheManager.getInstance().getCache("fourturemark");
> if (cache == null) {
> cache =
> CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
> CacheManager.getInstance().registerCache("fourturemark", cache);
>
> }
>
> If I'm right, this code should return the cache in case it already
> exists. However, based on performance, I see that data stored in cache
> is reloaded from resource instead of cache.
>
> Any idea what I'm doing wrong here?
>
> BR,
> Lennart

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