You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by viola lu <vi...@gmail.com> on 2010/09/14 07:00:43 UTC
One question about EL 2.2 :"java.lang.NoSuchMethodException" error
when call a managedbean int method
1. Create a managed bean ,define an int field
package coreservlets;
import javax.faces.bean.*;
@ManagedBean
public class SpanishColorMapper extends ColorMapper {
private int age;
public SpanishColorMapper() {
super("Spanish", "rojo", "anaranjado", "amarillo",
"verde", "negro", "blanco");
}
public int calYear(int x) {
return age + x;
}
public int getAge() {
return age;
}
public void setAge(int x) {
age = x;
}
}
2.Direclty call calYear method in xhtml like:
<td>#{spanishColorMapper.calYear(5)}</td>
but it's reported that :
java.lang.NoSuchMethodException:
coreservlets.SpanishColorMapper.calYear(java.lang.Long)
Caused by:
java.lang.NoSuchMethodException -
coreservlets.SpanishColorMapper.calYear(java.lang.Long)
javax.faces.FacesException: java.lang.NoSuchMethodException:
coreservlets.SpanishColorMapper.calYear(java.lang.Long)
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:258)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:163)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:556)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:401)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:281)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1568)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoSuchMethodException:
coreservlets.SpanishColorMapper.calYear(java.lang.Long)
at java.lang.Class.getMethod(Class.java:1605)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:377)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:137)
at org.apache.el.parser.AstValue.getValue(AstValue.java:159)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
at org.apache.myfaces.view.facelets.el.ELText$ELTextVariable.writeText(ELText.java:213)
at org.apache.myfaces.view.facelets.compiler.TextInstruction.write(TextInstruction.java:48)
at org.apache.myfaces.view.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:46)
at org.apache.myfaces.view.facelets.compiler.UILeaf.encodeAll(UILeaf.java:214)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:614)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:614)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1155)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:263)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
... 16 more
Seems by default it's set as Long.
Is this a bug of EL implementation? Parse number as Long, not type of
ManagedBean defined?
--
viola
Re: One question about EL 2.2 :"java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by Mark Thomas <ma...@apache.org>.
On 15/09/2010 08:02, viola lu wrote:
> did you have any idea?
I know exactly where this code is going wrong. As I said before, it is
in the code the works out which method to call. [1] It uses an exact
match on parameter types (with some scope for ambiguity). It looks like
the code needs to be a little smarter.
I do worry about the complexity of the code but I haven't actually
looked at what the patch will require yet. You may want to look at the
patch for last bug that got fixed in this area. [2]
Mark
[1]
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java?diff_format=h&view=annotate
[2] http://svn.apache.org/viewvc?diff_format=h&view=revision&revision=959568
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: One question about EL 2.2 :"java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by viola lu <vi...@gmail.com>.
This test application can work well on glassfish, but glassfish el
implementation is different from tomcat el implementation: jasper-el.jar,
which is under tomcat lib folder? First, i though it's myfaces problem, but
myfaces community response it's el implementation problem:
https://issues.apache.org/jira/browse/MYFACES-2916,
and from EL spec, i found out that:
The value of an IntegerLiteral ranges from Long.MIN_VALUE to
Long.MAX_VALUE, this means that EL treats all integerliteral as long?
I also read tomcat code:
protected Number getInteger() {
if (this.number == null) {
try {
this.number = new Long(this.image);
} catch (ArithmeticException e1) {
this.number = new BigInteger(this.image);
}
}
return number;
}
But glassfish can work, did you have any idea?
On Wed, Sep 15, 2010 at 1:49 PM, Pid <pi...@pidster.com> wrote:
> On 15/09/2010 04:18, viola lu wrote:
> > Hi, Mark:
> > thanks, i already opened a bug :
> > https://issues.apache.org/bugzilla/show_bug.cgi?id=49925.
>
> Are you sure this is a Tomcat bug?
>
>
> p
>
> > On Tue, Sep 14, 2010 at 2:49 PM, Mark Thomas <ma...@apache.org> wrote:
> >
> >> On 14/09/2010 06:00, viola lu wrote:
> >>> Is this a bug of EL implementation? Parse number as Long, not type of
> >>> ManagedBean defined?
> >>
> >> Yep, looks like a possible bug in the code that identifies the method
> >> you are trying to call.
> >>
> >> Mark
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
>
>
--
viola
Re: One question about EL 2.2 :"java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by Pid <pi...@pidster.com>.
On 15/09/2010 04:18, viola lu wrote:
> Hi, Mark:
> thanks, i already opened a bug :
> https://issues.apache.org/bugzilla/show_bug.cgi?id=49925.
Are you sure this is a Tomcat bug?
p
> On Tue, Sep 14, 2010 at 2:49 PM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 14/09/2010 06:00, viola lu wrote:
>>> Is this a bug of EL implementation? Parse number as Long, not type of
>>> ManagedBean defined?
>>
>> Yep, looks like a possible bug in the code that identifies the method
>> you are trying to call.
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
Re: One question about EL 2.2 :"java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by viola lu <vi...@gmail.com>.
Hi, Mark:
thanks, i already opened a bug :
https://issues.apache.org/bugzilla/show_bug.cgi?id=49925.
On Tue, Sep 14, 2010 at 2:49 PM, Mark Thomas <ma...@apache.org> wrote:
> On 14/09/2010 06:00, viola lu wrote:
> > Is this a bug of EL implementation? Parse number as Long, not type of
> > ManagedBean defined?
>
> Yep, looks like a possible bug in the code that identifies the method
> you are trying to call.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
viola
Re: One question about EL 2.2 :"java.lang.NoSuchMethodException"
error when call a managedbean int method
Posted by Mark Thomas <ma...@apache.org>.
On 14/09/2010 06:00, viola lu wrote:
> Is this a bug of EL implementation? Parse number as Long, not type of
> ManagedBean defined?
Yep, looks like a possible bug in the code that identifies the method
you are trying to call.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org