commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dmi...@apache.org>
Subject Re: [jxpath] org.apache.commons.jxpath.JXPathException: no read method
Date Fri, 04 Mar 2005 14:40:55 GMT
Vasiliy,
 
You need to change the visibility of class B from default to public.  JXPath only supports
access to public classes.
 
Let me know if this helps.
 
- Dmitri


Vasiliy Stashuk <vasiliy_stashuk@priocom.com> wrote:
Hi!

I have problem while accessing java bean properties via JXPath. Consider 
following
example.

puvlic class BlaBla {
public static interface Provider {
public String getName();
}

public static abstract class A implements Provider {
}

static class B extends A {
public String getName() {
return "theName";
}
}

public static void main(String[] args) throws Exception {
B b = new B();

JXPathContext ctx = JXPathContext.newContext(b);

System.out.println(ctx.getValue("name"));
}
}

JXPath fails with:
"org.apache.commons.jxpath.JXPathException: Cannot access property: 
BlaBla$B.name; No read method"

This is may be a bug in the 
ValueUtils.getAccessibleMethodFromInterfaceNest method.
It doesn't get down thru class hierarchy when looking for public accessor 
method.

-- 
All the best,
Vasyl Stashuk

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message