当前位置: 动力学知识库 > 问答 > 编程问答 >

java - 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: