You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Er...@swissinfo.ch on 2004/08/18 17:17:55 UTC

[Validator] Not possible to access static methods?

Hi

I just changed a method within a class to static, and the Validator seems to
have a problem accessing it:

ERROR   - Unknown property 'titleMessageKey' [18 Aug 2004 17:15:21,660] @
org.apache.commons.validator.ValidatorUtil
java.lang.NoSuchMethodException: Unknown property 'titleMessageKey'
	at
org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUti
lsBean.java:1166)
	at
org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUti
lsBean.java:730)
	at
org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean
.java:759)
	at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:33
3)
	at
org.apache.commons.validator.ValidatorUtil.getValueAsString(ValidatorUtil.ja
va:121)
	at
ch.xobix.validation.model.FieldChecks.validateRequired(FieldChecks.java:85)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:3
21)
	at
org.apache.commons.validator.Validator.validateField(Validator.java:409)
	at
org.apache.commons.validator.Validator.validate(Validator.java:478)
	at
ch.xobix.validation.model.ValidateBeanBp.processObject(ValidateBeanBp.java:1
27)
	at
ch.xobix.core.model.BaseWithoutConnectionBp.runBp(BaseWithoutConnectionBp.ja
va:44)
	at
ch.xobix.validation.model.ValidationBpImpl.validate(ValidationBpImpl.java:22
8)
	at
ch.xobixtest.validation.model.ValidateBeanBpTest.testXobixMarketingUrlWithou
tChecking(ValidateBeanBpTest.java:1628)
	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:324)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:421)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:305)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:186)

Best regards,
Eric


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


Re: [Validator] Not possible to access static methods?

Posted by Bill Siggelkow <bi...@bellsouth.net>.
That doesn't surprise me -- JavaBean properties equate getter methods on 
  an object instance ... is there a reason your accessor needs to be 
static? If the value is a constant, you could just make the variable be 
a class member but leave the method as an instance method.

Eric.Lewis@swissinfo.ch wrote:

> Hi
> 
> I just changed a method within a class to static, and the Validator seems to
> have a problem accessing it:
> 
> ERROR   - Unknown property 'titleMessageKey' [18 Aug 2004 17:15:21,660] @
> org.apache.commons.validator.ValidatorUtil
> java.lang.NoSuchMethodException: Unknown property 'titleMessageKey'
> 	at
> org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUti
> lsBean.java:1166)
> 	at
> org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUti
> lsBean.java:730)
> 	at
> org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean
> .java:759)
> 	at
> org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:33
> 3)
> 	at
> org.apache.commons.validator.ValidatorUtil.getValueAsString(ValidatorUtil.ja
> va:121)
> 	at
> ch.xobix.validation.model.FieldChecks.validateRequired(FieldChecks.java:85)
> 	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at
> org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:3
> 21)
> 	at
> org.apache.commons.validator.Validator.validateField(Validator.java:409)
> 	at
> org.apache.commons.validator.Validator.validate(Validator.java:478)
> 	at
> ch.xobix.validation.model.ValidateBeanBp.processObject(ValidateBeanBp.java:1
> 27)
> 	at
> ch.xobix.core.model.BaseWithoutConnectionBp.runBp(BaseWithoutConnectionBp.ja
> va:44)
> 	at
> ch.xobix.validation.model.ValidationBpImpl.validate(ValidationBpImpl.java:22
> 8)
> 	at
> ch.xobixtest.validation.model.ValidateBeanBpTest.testXobixMarketingUrlWithou
> tChecking(ValidateBeanBpTest.java:1628)
> 	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:324)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> nner.java:421)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> java:305)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> .java:186)
> 
> Best regards,
> Eric


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