You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Francesco Bassi <fv...@gmail.com> on 2014/04/07 13:25:58 UTC

Tomcat 8.0.5, .jsp & Java 8 interface static methods

Hello everybody.

Since 8.0.5, it seems that .jsps that include invocations of static
interface methods don't work anymore.

Here's an example:

Test.java;

package com.wfb.test;
public interface Test {
    public static String getText() { return "Gotcha!"; }
}

test.jsp
<%String s = com.wfb.test.Test.getText();%>

Tomcat says:

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the jsp file: /test.jsp
This static method of interface Test can only be accessed as Test.getText
1: <%String s = com.wfb.test.Test.getText();%>


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:342)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	com.wfb.web.container.EnvironmentFilter.doFilter(EnvironmentFilter.java:33)
	com.wfb.web.container.log4j.Log4JEnvironmentFilter.doFilter(Log4JEnvironmentFilter.java:57)
	org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66)

Re: Tomcat 8.0.5, .jsp & Java 8 interface static methods

Posted by Francesco Bassi <fv...@gmail.com>.
Sorry!!!
Please disregard the whole topic.

I forgot to set these parameters.

Now everything is working great.

Thanks again for your usual great support!




On Mon, Apr 7, 2014 at 4:33 PM, Francesco Bassi <fv...@gmail.com> wrote:

> Well...
>
> I'm using 8.0.3 (and before I used to use 8.0 RC something) and the access
> to the static interface methods are working pretty well...
>
>
> On Mon, Apr 7, 2014 at 4:17 PM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 07/04/2014 12:25, Francesco Bassi wrote:
>> > Hello everybody.
>> >
>> > Since 8.0.5, it seems that .jsps that include invocations of static
>> > interface methods don't work anymore.
>>
>> What do you mean any more? The changes necessary to support that out of
>> the box (updated JDT compiler) weren't available until 8.0.5.
>>
>> Also, have you changed the defaults for compilerSourceVM and
>> compilerTargetVMas they will be 1.7 by default (i.e. Java 7, not Java 8).
>>
>> Mark
>>
>>
>>
>> >
>> > Here's an example:
>> >
>> > Test.java;
>> >
>> > package com.wfb.test;
>> > public interface Test {
>> >     public static String getText() { return "Gotcha!"; }
>> > }
>> >
>> > test.jsp
>> > <%String s = com.wfb.test.Test.getText();%>
>> >
>> > Tomcat says:
>> >
>> > org.apache.jasper.JasperException: Unable to compile class for JSP:
>> >
>> > An error occurred at line: 1 in the jsp file: /test.jsp
>> > This static method of interface Test can only be accessed as
>> Test.getText
>> > 1: <%String s = com.wfb.test.Test.getText();%>
>> >
>> >
>> > Stacktrace:
>> >
>> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
>> >
>> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
>> >
>> org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
>> >       org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
>> >       org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
>> >       org.apache.jasper.compiler.Compiler.compile(Compiler.java:342)
>> >
>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
>> >
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
>> >
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
>> >       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
>> >       javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>> >
>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>> >
>> com.wfb.web.container.EnvironmentFilter.doFilter(EnvironmentFilter.java:33)
>> >
>> com.wfb.web.container.log4j.Log4JEnvironmentFilter.doFilter(Log4JEnvironmentFilter.java:57)
>> >
>> org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66)
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: Tomcat 8.0.5, .jsp & Java 8 interface static methods

Posted by Francesco Bassi <fv...@gmail.com>.
Well...

I'm using 8.0.3 (and before I used to use 8.0 RC something) and the access
to the static interface methods are working pretty well...


On Mon, Apr 7, 2014 at 4:17 PM, Mark Thomas <ma...@apache.org> wrote:

> On 07/04/2014 12:25, Francesco Bassi wrote:
> > Hello everybody.
> >
> > Since 8.0.5, it seems that .jsps that include invocations of static
> > interface methods don't work anymore.
>
> What do you mean any more? The changes necessary to support that out of
> the box (updated JDT compiler) weren't available until 8.0.5.
>
> Also, have you changed the defaults for compilerSourceVM and
> compilerTargetVMas they will be 1.7 by default (i.e. Java 7, not Java 8).
>
> Mark
>
>
>
> >
> > Here's an example:
> >
> > Test.java;
> >
> > package com.wfb.test;
> > public interface Test {
> >     public static String getText() { return "Gotcha!"; }
> > }
> >
> > test.jsp
> > <%String s = com.wfb.test.Test.getText();%>
> >
> > Tomcat says:
> >
> > org.apache.jasper.JasperException: Unable to compile class for JSP:
> >
> > An error occurred at line: 1 in the jsp file: /test.jsp
> > This static method of interface Test can only be accessed as Test.getText
> > 1: <%String s = com.wfb.test.Test.getText();%>
> >
> >
> > Stacktrace:
> >
> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
> >
> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
> >
> org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
> >       org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
> >       org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
> >       org.apache.jasper.compiler.Compiler.compile(Compiler.java:342)
> >
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
> >
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
> >
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
> >       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
> >       javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> >
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >
> com.wfb.web.container.EnvironmentFilter.doFilter(EnvironmentFilter.java:33)
> >
> com.wfb.web.container.log4j.Log4JEnvironmentFilter.doFilter(Log4JEnvironmentFilter.java:57)
> >
> org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66)
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat 8.0.5, .jsp & Java 8 interface static methods

Posted by Mark Thomas <ma...@apache.org>.
On 07/04/2014 12:25, Francesco Bassi wrote:
> Hello everybody.
> 
> Since 8.0.5, it seems that .jsps that include invocations of static
> interface methods don't work anymore.

What do you mean any more? The changes necessary to support that out of
the box (updated JDT compiler) weren't available until 8.0.5.

Also, have you changed the defaults for compilerSourceVM and
compilerTargetVMas they will be 1.7 by default (i.e. Java 7, not Java 8).

Mark



> 
> Here's an example:
> 
> Test.java;
> 
> package com.wfb.test;
> public interface Test {
>     public static String getText() { return "Gotcha!"; }
> }
> 
> test.jsp
> <%String s = com.wfb.test.Test.getText();%>
> 
> Tomcat says:
> 
> org.apache.jasper.JasperException: Unable to compile class for JSP:
> 
> An error occurred at line: 1 in the jsp file: /test.jsp
> This static method of interface Test can only be accessed as Test.getText
> 1: <%String s = com.wfb.test.Test.getText();%>
> 
> 
> Stacktrace:
> 	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
> 	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
> 	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
> 	org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
> 	org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
> 	org.apache.jasper.compiler.Compiler.compile(Compiler.java:342)
> 	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
> 	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> 	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> 	com.wfb.web.container.EnvironmentFilter.doFilter(EnvironmentFilter.java:33)
> 	com.wfb.web.container.log4j.Log4JEnvironmentFilter.doFilter(Log4JEnvironmentFilter.java:57)
> 	org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66)
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org