简体   繁体   中英

JSP property lookup error

I'm getting the following error in ours logs:

Error looking up property "foo" in object type "foo.bar". Cause: null java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor363.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)

I cannot for the life of me recreate it, I was wondering if anyone has any experience with this kind of problem with JSP/Java Bean. What I wanted to know was, will this prevent the user from getting the web page to show up?

I know this isn't a whole lot of information, but any advice could help.

Something on some page is trying to "navigate" into a bean instance (a Java object, that is), and it's trying to get to a property that isn't there on the bean in question.

 <span id='name'>${fn:escapeXml(someBean.user.fullName)}</span>

If the bean "someBean" has no "user" property, of if the user object has no "fullName" property, you get an exception like that.

From what you're giving here, the only suggestion I have is to make sure that you have indeed a property called "foo" and to not have a period in "foo.bar". You cannot name your variables/objects using a period in the name. JSP will automatically go and look for a property called "bar" in "foo". Call it instead " fooBar ".

Java is calling the getter method on the bean providing the property which is in turn throwing an exception. If you can see the target exception - that is the target of InvocationTargetException you will know what is causing this to fail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM