google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

"interface com.googlecode.objectify.Objectify is not visible from class loader" in some cases #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
When using FetchOptions I've got exception 
{{{
Caused by: java.lang.IllegalArgumentException: interface 
com.googlecode.objectify.Objectify is not visible from class 
loader
    at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
    at com.googlecode.objectify.DatastoreTimeoutRetryProxy.wrap(DatastoreTimeoutRetryProxy.java:30)
    at com.googlecode.objectify.ObjectifyFactory.maybeWrap(ObjectifyFactory.java:137)
    at com.googlecode.objectify.OPreparedQueryImpl$ToObjectIterable.<init>(OPreparedQueryImpl.java:122)
    at com.googlecode.objectify.OPreparedQueryImpl.asList(OPreparedQueryImpl.java:79)
    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.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
    at com.googlecode.objectify.DatastoreTimeoutRetryProxy.invoke(DatastoreTimeoutRetryProxy.java:54)
    at $Proxy24.asList(Unknown Source)
}}}

Code sample
{{{
        Objectify ofy = ObjectifyService.begin();
        OQuery<MyClass> q = ObjectifyService.createQuery(MyClass.class);
        List<OKey<MyClass>> keys = ofy.prepareKeysOnly(q).asList(FetchOptions.Builder.withLimit(10));//ecxeption here 
!!!
}}}
but next code (without FetchOptions) works.
{{{
        Objectify ofy = ObjectifyService.begin();
        OQuery<MyClass> q = ObjectifyService.createQuery(MyClass.class);
        List<OKey<MyClass>> keys = ofy.prepareKeysOnly(q).asList();
}}}

What is the expected output? What do you see instead?
Must work

What version of the product are you using? On what operating system?
objectify-1.0.jar
Windows XP 32x
Eclipse Java EE IDE for Web Developers.Build id: 20090920-1017
Google Appengine 1.3.0 in Development Mode
Sun JDK 1.6u12

Please provide any additional information below.

Original issue reported on code.google.com by aliku...@gmail.com on 23 Jan 2010 at 5:26

GoogleCodeExporter commented 9 years ago
Only if setDatastoreTimeoutRetryCount > 0, for instance in DAO
{{{
ObjectifyService.factory().setDatastoreTimeoutRetryCount(3);
}}}
if setDatastoreTimeoutRetryCount == 0, then works fine.

Original comment by aliku...@gmail.com on 23 Jan 2010 at 6:06

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r191.

Original comment by lhori...@gmail.com on 25 Jan 2010 at 7:22

GoogleCodeExporter commented 9 years ago
Wow, the proxy was using the wrong classloader.  Fixed in trunk.  Thanks for 
reporting!

Original comment by lhori...@gmail.com on 25 Jan 2010 at 7:24

GoogleCodeExporter commented 9 years ago
I was having the same issue (using Guice) and can confirm that r191 fixes the 
problem
for me.

Original comment by spudbean on 25 Jan 2010 at 9:54