Tuesday, June 29, 2010

Re: Testing client code fails with "JDOFatalUserException: Duplicate PMF name"

hello acerezo,

i do not think that i really solved the issue. nevertheless i coded
around it a bit and now i can run server side AND client side code
test cases without any problems. feel free to browse through the
honeycrm sourcecode to see how i did it:
http://code.google.com/p/honeycrm/source/browse/#svn/trunk/src/honeycrm/client/test

important to note is the following: since the service (communication
from client to server side) could not be constructed using
gwt.create() when the client side tests are running, i decided to
replace the service before running the tests: see
http://code.google.com/p/honeycrm/source/browse/trunk/src/honeycrm/client/test/AbstractClientTest.java
and http://code.google.com/p/honeycrm/source/browse/trunk/src/honeycrm/client/ServiceRegistry.java

the result is not really satisfying since i cannot run the ui code
test cases and use the correct service (that will be used in
production mode). however, i can at least test all the other stuff and
i can test the ui code with a dummy service if i want to. of course, i
still want to have a real solution (instead of this dirty workaround)
allowing me to test the client code properly. but since i found no
solution yet and the google guys did not help me out either i had to
go on with this workaround until some gwt guru comes and fixes my
issue.

by the way: i am looking for developers who are interested in
participating in the honeycrm project. we welcome everyone who wants
to contribute and give feedback to the project!

kind regards,
ingo

2010/6/28 Acerezo <acerezoguillen@gmail.com>:
> Hello I've the same problem Did you find the solution?
>
> Thanks.
>
> On Jun 7, 10:13 am, ingo <ingo.jaec...@googlemail.com> wrote:
>> hello google,
>>
>> believe it or not but this seems to be a problem as huherto wrote on
>> the mailing list in earlier this year. unfortunately, he did not
>> receive an answer either:
>>
>> http://groups.google.com/group/google-web-toolkit/browse_thread/threa...
>>
>> would appreciate a quick response to this issue.
>>
>> kind regards,
>> ingo
>>
>> On 3 Jun., 11:42, ingo <ingo.jaec...@googlemail.com> wrote:
>>
>> > as a workaround i removed the jdoconfig.xml file from the src/WEB-INF
>> > directory and from the war/WEB-INF/classes/META-INF directory. then i
>> > instantiated the persistence manager factory by using a map like the
>> > following:
>>
>> >                 final Map<String, String> map = new HashMap<String, String>();
>> >                 map.put("javax.jdo.PersistenceManagerFactoryClass",
>> > "org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory");
>> >                 map.put("javax.jdo.option.ConnectionURL", "appengine");
>> >                 map.put("javax.jdo.option.NontransactionalRead", "true");
>> >                 map.put("javax.jdo.option.NontransactionalWrite", "true");
>> >                 map.put("javax.jdo.option.RetainValues", "true");
>> >                 map.put("datanucleus.appengine.autoCreateDatastoreTxns", "true");
>>
>> >                pmf= JDOHelper.getPersistenceManagerFactory(map);
>>
>> > this somehow lets the test run successfully but throws the following
>> > exception nevertheless:
>>
>> > [WARN] StandardContext[]Exception while dispatching incoming RPC call
>> > com.google.gwt.user.server.rpc.UnexpectedException: Service method
>> > 'public abstract crm.client.dto.AbstractDto
>> > crm.client.CommonService.get(int,long)' threw an unexpected exception:
>> > java.lang.NullPointerException:NoAPIenvironmentisregisteredfor
>> > thisthread.
>> >         at
>> > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
>> > 378)
>> >         at
>> > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
>> > 581)
>> >         at
>> > com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
>> > 188)
>> >         at
>> > com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:
>> > 224)
>> >         at
>> > com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:
>> > 62)
>> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>> >         at
>> > com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:
>> > 288)
>> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>> >         at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
>> > 237)
>> >         at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
>> > 157)
>> >         at
>> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
>> > 214)
>> >         at
>> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
>> > 104)
>> >         at
>> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
>> > 520)
>> >         at
>> > org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:
>> > 198)
>> >         at
>> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
>> > 152)
>> >         at
>> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
>> > 104)
>> >         at
>> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
>> > 520)
>> >         at
>> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
>> > 137)
>> >         at
>> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
>> > 104)
>> >         at
>> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
>> > 118)
>> >         at
>> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
>> > 102)
>> >         at
>> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
>> > 520)
>> >         at
>> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
>> > 109)
>> >         at
>> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
>> > 104)
>> >         at
>> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
>> > 520)
>> >         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:
>> > 929)
>> >         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
>> > 160)
>> >         at
>> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
>> > 799)
>> >         at org.apache.coyote.http11.Http11Protocol
>> > $Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
>> >         at
>> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
>> > 577)
>> >         at org.apache.tomcat.util.threads.ThreadPool
>> > $ControlRunnable.run(ThreadPool.java:683)
>> >         at java.lang.Thread.run(Thread.java:637)
>> > Caused by: java.lang.NullPointerException:NoAPIenvironmentis
>> >registeredfor thisthread.
>> >         at
>> > com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:
>> > 74)
>> >         at
>> > com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppIdNamespace(DatastoreApiHelper.java:
>> > 84)
>> >         at com.google.appengine.api.datastore.Query.<init>(Query.java:84)
>> >         at
>> > org.datanucleus.store.appengine.query.DatastoreQuery.validate(DatastoreQuery.java:
>> > 649)
>> >         at
>> > org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:
>> > 215)
>> >         at
>> > org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:
>> > 89)
>> >         at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
>> >         at org.datanucleus.store.query.Query.executeWithArray(Query.java:
>> > 1371)
>> >         at org.datanucleus.store.query.Query.execute(Query.java:1344)
>> >         at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:221)
>> >         at
>> > crm.server.AbstractCommonService.getDomainObject(AbstractCommonService.java:
>> > 75)
>> >         at crm.server.CommonServiceReader.get(CommonServiceReader.java:48)
>> >         at crm.server.CommonServiceImpl.get(CommonServiceImpl.java:54)
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >         at
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>> > 39)
>> >         at
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
>> > 25)
>> >         at java.lang.reflect.Method.invoke(Method.java:597)
>> >         at
>> > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
>> > 562)
>> >         ... 31 more
>> > logging for HtmlUnitthread
>> >    [ERROR] Alert: class
>> > com.google.gwt.user.client.rpc.StatusCodeException
>>
>> > another user describes this problem here:http://www.mail-archive.com/google-guice@googlegroups.com/msg02473.html
>>
>> > anyone?
>>
>> > On 2 Jun., 19:16, ingo <ingo.jaec...@googlemail.com> wrote:
>>
>> > > hello everyone,
>>
>> > > does anyone know the root cause of this problem? i thought the reason
>> > > might beduplicatejdoconfig.xml file. however, it turns out that
>> > > deleting this file from the src/META-INF/ directory is not a good idea
>> > > since it creates even more exceptions:
>>
>> > > [WARN] StandardWrapperValve[shell]: Servlet.service() for servlet
>> > > shell threw exception
>> > > java.lang.ExceptionInInitializerError
>> > >         at
>> > > crm.server.AbstractCommonService.<clinit>(AbstractCommonService.java:
>> > > 37)
>> > >         at java.lang.Class.forName0(Native Method)
>> > >         at java.lang.Class.forName(Class.java:169)
>> > >         at
>> > > com.google.gwt.dev.shell.GWTShellServlet.tryGetOrLoadServlet(GWTShellServle t.java:
>> > > 953)
>> > >         at
>> > > com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:
>> > > 276)
>> > >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>> > >         at
>> > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio nFilterChain.java:
>> > > 237)
>> > >         at
>> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC hain.java:
>> > > 157)
>> > >         at
>> > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j ava:
>> > > 214)
>> > >         at
>> > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte xt.java:
>> > > 104)
>> > >         at
>> > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
>> > > 520)
>> > >         at
>> > > org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContex tValve.java:
>> > > 198)
>> > >         at
>> > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j ava:
>> > > 152)
>> > >         at
>> > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte xt.java:
>> > > 104)
>> > >         at
>> > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
>> > > 520)
>> > >         at
>> > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
>> > > 137)
>> > >         at
>> > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte xt.java:
>> > > 104)
>> > >         at
>> > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
>> > > 118)
>> > >         at
>> > > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte
>>
>> ...
>>
>> read more »
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment