I also had this issue using the Eclipse plug-in.

This does not appear to be the original issue (http://code.google.com/
p/googleappengine/issues/detail?id=1876)

I think the documentation is correct. I think it's the Eclipse plug-in
that has the this new issue.
It appears that the Eclipse plug-in does not add appengine-api-
stubs.jar and appengine-local-runtime.jar to your class path (which
the JUnit documentation mentions 
http://code.google.com/appengine/docs/java/howto/unittesting.html).

These jars are distributed with the Eclipse 1.2.2-200907291526 plug-in
in the lib/impl directory. So to work around this issue I made an
eclipse user library with these two jars in and added it to my class
path.

This has solved my local issues.
I've not tried uploading this to GAE yet, nor checked for any
overlapping classpath issues with sealed jars etc.


On Jul 24, 5:18 pm, Jason Barnes <inspectorm...@gmail.com> wrote:
> Hi,  I am new to App Engine for Java.  I just downloaded Eclipse 3.4.2
> and the latest Google plug-ins.  I cannot get any of the example code
> either here or in the official documentation to compile.  I seem to be
> hung up on that fact that Eclipse cannot import
> "com.google.appengine.tools.development.ApiProxyLocalImpl"?
>
> Any help is appreciated!
>
> Thanks,
> Jason
>
> On Jul 14, 1:22 pm, Max Ross <maxr+appeng...@google.com> wrote:
>
> > Hi everyone, let's see if we can get this ironed out.
>
> > First off, the ApiProxy.Environment interface did change in 1.2.2.  There is
> > one new method (getAttributes()), and the existing methods now need to
> > return meaningful values in your tests.  If you're following the how-to
> > article on unit testing 
> > (http://code.google.com/appengine/docs/java/howto/unittesting.html) you'll
> > need to update your TestEnvironment class to look like this 
> > one:http://code.google.com/p/datanucleus-appengine/source/browse/branches...
> > (lines 34 - 66)
>
> > We're working on getting the docs updated right now.
>
> > If your TestEnvironment class looks exactly like this and your unit tests
> > are still failing, please post a complete example including model classes
> > and test code and I'll investigate.
>
> > Thanks, and sorry for the trouble.
>
> > Max
>
> > On Tue, Jul 14, 2009 at 8:08 AM, cmin <minal...@gmail.com> wrote:
>
> > > same here.. All requiree methods of TestAPIEnvironment are returning
> > > something relevant.
>
> > > Also verified, that hosted mode everything is ok , just tests fails.
>
> > > On Jul 14, 7:23 am, ivo <ivo.reduto.fre...@gmail.com> wrote:
> > > > +1 with all unit tests queries failing
> > > > every query returns empty / null
>
> > > > I tried to troubleshoot in the same ways described in the previous
> > > > messages and got the same results
>
> > > > On Jul 14, 2:43 pm, "Alejandro D. Garin" <aga...@gmail.com> wrote:
>
> > > > > I have the same TestEnvironment but my queries still fail.  what can I
> > > do?
>
> > > > > On Tue, Jul 14, 2009 at 10:18 AM, Ronald Mathies <
> > > ronaldmath...@gmail.com>wrote:
>
> > > > > > Oke, and again here i am (Man i shoult test further before
> > > > > > shouting :) )
>
> > > > > > My sollution:
>
> > > > > > In the class that implement ApiProxy.Environment make sure the
> > > > > > following methods return something meaningfull:
>
> > > > > > public class TestEnvironment  implements ApiProxy.Environment {
>
> > > > > >    public String getAppId() {
> > > > > >        return "Unit Tests";
> > > > > >    }
>
> > > > > >    public String getVersionId() {
> > > > > >        return "1.0";
> > > > > >     }
>
> > > > > >    public Map<String, Object> getAttributes() {
> > > > > >                Map<String, Object> map = new HashMap<String,
> > > Object>();
> > > > > >                return map;
> > > > > >    }
>
> > > > > >     public String getRequestNamespace() {
> > > > > >        return "gmail.com";
> > > > > >    }
>
> > > > > >    // Rest of the methods contain iether null or false.
> > > > > > }
>
> > > > > > On Jul 14, 3:13 pm, Ronald Mathies <ronaldmath...@gmail.com> wrote:
> > > > > > > I also encountered this problem, using unit tests it fails.
> > > However,
> > > > > > > when i execute the same code
> > > > > > > in hosted mode it does work. I updated the appengine-api-stubs.jar
> > > and
> > > > > > > appengine-local-runtime.jar so this cannot be the problem. I also
> > > > > > > removed my current datastore from disk so this also can't cause 
> > > > > > > the
> > > > > > > problem.
>
> > > > > > > A few things i notice, in the log at one point i see the 
> > > > > > > following:
>
> > > > > > >  datastore URL="appengine" driver="" userName=""
>
> > > > > > > Is this correct?
>
> > > > > > > And, i the problems i am having are NullPointerExceptions. Every
> > > > > > > single test i have fails.
>
> > > > > > > On Jul 14, 1:47 pm, "Alejandro D. Garin" <aga...@gmail.com> wrote:
>
> > > > > > > > I have the same problem updating to 1.2.2
>
> > > > > > > > On Tue, Jul 14, 2009 at 7:57 AM, clanger <
> > > danielmcla...@gmail.com>
> > > > > > wrote:
>
> > > > > > > > > Actually, there seems to be a problem with the Query since
> > > 1.2.2, see
> > > > > > > > > example:
>
> > > > > > > > >        ...
> > > > > > > > >        Transaction tx =
> > > persistenceManager.currentTransaction();
> > > > > > > > >        tx.begin();
> > > > > > > > >        CostCentreDAO dao = new CostCentreDAO();
> > > > > > > > >        dao.setCode("code");
> > > > > > > > >        dao.setDescription("description");
> > > > > > > > >        persistenceManager.makePersistent(dao);
> > > > > > > > >        tx.commit();
> > > > > > > > >        Query query = persistenceManager.newQuery
> > > > > > > > > (CostCentreDAO.class);
> > > > > > > > >        List<CostCentreDAO> daos =
> > > (List<CostCentreDAO>)query.execute
> > > > > > > > > ();
> > > > > > > > >        assertEquals(1, daos.size());
> > > > > > > > >        ...
>
> > > > > > > > > This code fails in 1.2.2 (no entities returned from query).
> > > This
> > > > > > > > > previously worked in SDK 1.2.0/datanucleus 1.1.4.
>
> > > > > > > > > I know the insert worked in 1.2.2 because if you do the
> > > following the
> > > > > > > > > correct result is obtained:
>
> > > > > > > > > ...
> > > > > > > > > CostCentreDAO dao = persistenceManager.getObjectById
> > > > > > > > > (CostCentreDAO.class, key);
> > > > > > > > > ...
>
> > > > > > > > > So, there seems to be a problem in GAE/J SDK 1.2.2 JUnit where
> > > the
> > > > > > > > > query is being performed by other than 'getObjectById()'.
>
> > > > > > > > > On Jul 14, 11:24 am, Zenon <zeno...@gmail.com> wrote:
> > > > > > > > > > I already read documentation, but is seems no update has 
> > > > > > > > > > been
> > > > > > committed;
> > > > > > > > > > Anyway thanks to you, now it works :)
>
> > > > > > > > > > 2009/7/14 clanger <danielmcla...@gmail.com>
>
> > > > > > > > > > > See:
> > > > > >http://code.google.com/appengine/docs/java/howto/unittesting.html
> > > > > > > > > > > in the TestEnvironment example class there, you need to 
> > > > > > > > > > > add
> > > the
> > > > > > > > > > > following method:
>
> > > > > > > > > > > class TestEnvironment implements ApiProxy.Environment {
> > > > > > > > > > > ...
> > > > > > > > > > > @Override
> > > > > > > > > > >        public Map<String, Object> getAttributes() {
> > > > > > > > > > >                Map<String, Object> map = new
> > > HashMap<String,
> > > > > > Object>
> > > > > > > > > ();
> > > > > > > > > > >                return map;
> > > > > > > > > > >        }
> > > > > > > > > > > ...
> > > > > > > > > > > }
>
> > > > > > > > > > > Hope this helps.
>
> > > > > > > > > > > On Jul 14, 10:46 am, Zenon <zeno...@gmail.com> wrote:
> > > > > > > > > > > > Hi, I upgraded App engine to 1.2.2.
>
> > > > > > > > > > > > Now I can't execute any query because I receive this
> > > error:
>
> > > > > > > > > > > > java.lang.NullPointerException
> > > > > > > > > > > >         at com.google.appengine.api.NamespaceManager.get
> > > > > > > > > > > > (NamespaceManager.java:71)
> > > > > > > > > > > >         at
>
> > > com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppIdNamesp
> > >  ace
> > > > > > > > > > > > (DatastoreApiHelper.java:81)
> > > > > > > > > > > >         at
>
> > > com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppIdNamesp
> > >  ace
> > > > > > > > > > > > (DatastoreApiHelper.java:73)
> > > > > > > > > > > >         at
> > > > > > > > > com.google.appengine.api.datastore.Key.<init>(Key.java:100)
> > > > > > > > > > > >         at
> > > > > > com.google.appengine.api.datastore.Key.<init>(Key.java:85)
> > > > > > > > > > > >         at
> > > > > > com.google.appengine.api.datastore.Key.<init>(Key.java:81)
> > > > > > > > > > > >         at
>
> > > com.google.appengine.api.datastore.Entity.<init>(Entity.java:103)
> > > > > > > > > > > >         at
>
> > > com.google.appengine.api.datastore.Entity.<init>(Entity.java:84)
> > > > > > > > > > > >         at
> > > > > > > > > org.datanucleus.store.appengine.DatastoreFieldManager.<init>
> > > > > > > > > > > > (DatastoreFieldManager.java:167)
> > > > > > > > > > > >         at
>
> > > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject
> > > > > > > > > > > > (DatastorePersistenceHandler.java:178)
> > > > > > > > > > > >         at
>
> > > org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent
> > > > > > > > > > > > (JDOStateManagerImpl.java:3185)
> > > > > > > > > > > >         at
> > > > > > org.datanucleus.state.JDOStateManagerImpl.makePersistent
> > > > > > > > > > > > (JDOStateManagerImpl.java:3161)
> > > > > > > > > > > >         at
> > > > > > org.datanucleus.ObjectManagerImpl.persistObjectInternal
> > > > > > > > > > > > (ObjectManagerImpl.java:1298)
> > > > > > > > > > > >         at
> > > org.datanucleus.ObjectManagerImpl.persistObject
> > > > > > > > > > > > (ObjectManagerImpl.java:1175)
> > > > > > > > > > > >         at
> > > > > > > > > org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent
> > > > > > > > > > > > (JDOPersistenceManager.java:669)
> > > > > > > > > > > >         at
> > > > > > org.datanucleus.jdo.JDOPersistenceManager.makePersistent
> > > > > > > > > > > > (JDOPersistenceManager.java:694)
> > > > > > > > > > > >         at
>
> > > com.serviziroma.server.PubServiceImpl.addPub(PubServiceImpl.java:
> > > > > > > > > > > > 64)
> > > > > > > > > > > >         at
> > > > > > com.serviziroma.test.dao.PubDaoTest.testInserimentoPub
> > > > > > > > > > > > (PubDaoTest.java:31)
> > > > > > > > > > > >         at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > > > > > Method)
> > > > > > > > > > > >         at sun.reflect.NativeMethodAccessorImpl.invoke
> > > > > > > > > > > > (NativeMethodAccessorImpl.java:39)
> > > > > > > > > > > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to