java - Can ModelAttribute be primitive? -



java - Can ModelAttribute be primitive? -

i having unusual problem modelattribute in spring mvc 3.0. when deploy app @ localhost, works fine. when deploy app on remote server, fails everytime user access specific action, errors:

error: my.package.application.web.filter.exceptionfilter - long.<init>() java.lang.nosuchmethodexception: long.<init>() @ java.lang.class.getconstructor0(class.java:2706) @ java.lang.class.getdeclaredconstructor(class.java:1985) @ org.springframework.beans.beanutils.instantiateclass(beanutils.java:104) @ org.springframework.web.bind.annotation.support.handlermethodinvoker.resolvemodelattribute(handlermethodinvoker.java:762) @ org.springframework.web.bind.annotation.support.handlermethodinvoker.resolvehandlerarguments(handlermethodinvoker.java:356) @ org.springframework.web.bind.annotation.support.handlermethodinvoker.invokehandlermethod(handlermethodinvoker.java:153) @ org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter.invokehandlermethod(annotationmethodhandleradapter.java:426) @ org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter.handle(annotationmethodhandleradapter.java:414) @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:790) @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:719) @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:644) @ org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:549) @ javax.servlet.http.httpservlet.service(httpservlet.java:617) @ javax.servlet.http.httpservlet.service(httpservlet.java:717)

the code user init modelattribute in controller is:

@modelattribute("id") public long getuserid(httpsession session) { userinfoholder userholder = (userinfoholder) session .getattribute("userholder"); long userid = userholder.getuserid(); homecoming userid; }

as far can tell, bug can't reproduced @ local workstation. , happens before action called.

looking in handlermethodinvoker.java (line 762), see line:

bindobject = beanutils.instantiateclass(paramtype);

an experienced peer of mine believes line causes problem, because primitive-type modelattribute(long) doesn't have constructor. think reason maybe right, how can explain web application works fine on local server?

i tried search know if modelattribute back upwards primitive info type, no results. have experience issue?

i'm throwing in thoughts, hoping might help bit.

the stack trace shows indeed trying phone call constructor method long:

java.lang.nosuchmethodexception: long.<init>()

does work if alter used type long long?

as things working locally not on client. java version same?

java spring-mvc primitive primitive-types modelattribute

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -