On Wed, May 17, 2017 at 7:30 PM, Mohammed Manna <[email protected]> wrote:
> Your ant Build File seems to be incorrect. Could you provide the snippet of
> the Jspc Task and Javac task for this?
>
Following is the tomcat.xml which I am using for precompilation:
<project name="Webapp Precompilation" default="all" basedir=".">
<import file="${tomcat.home}/bin/catalina-tasks.xml"/>
<target name="jspc">
<jasper
validateXml="false"
uriroot="${webapp.path}"
webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
outputDir="${webapp.path}/WEB-INF/src" />
</target>
<target name="compile">
<mkdir dir="${webapp.path}/WEB-INF/classes"/>
<mkdir dir="${webapp.path}/WEB-INF/lib"/>
<javac destdir="${webapp.path}/WEB-INF/classes"
optimize="off"
debug="on" failonerror="false"
srcdir="${webapp.path}/WEB-INF/src"
excludes="**/*.smap">
<classpath>
<pathelement location="${webapp.path}/WEB-INF/classes"/>
<fileset dir="${webapp.path}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<pathelement location="${tomcat.home}/lib"/>
<fileset dir="${tomcat.home}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/bin">
<include name="*.jar"/>
</fileset>
</classpath>
<include name="**" />
<exclude name="tags/**" />
</javac>
</target>
<target name="all" depends="jspc,compile">
</target>
<target name="cleanup">
<delete>
<fileset dir="${webapp.path}/WEB-INF/src"/>
<fileset dir="${webapp.path}/WEB-INF/classes/org/apache/jsp"/>
</delete>
</target>
</project>
>
> On 17 May 2017 at 14:58, Vidyadhar <[email protected]> wrote:
>
> > Hello KR,
> >
> > On Tue, May 16, 2017 at 8:43 PM, Mohammed Manna <[email protected]>
> > wrote:
> >
> > > Hi Vidyadhar,
> > >
> > > Some points to note here:
> > >
> > > 1) Setting those parameters in Web.xml file (CATALINA_HOME/conf)
> doesn't
> > > guarantee that it won't happen. Tomcat 8.0.43 onwards have got this
> > relaxed
> > > out by using a more efficient error handling code. But you will have
> this
> > > error if the code is truly hitting near the limit.
> > > 2) The issue occurs with Tomcat 8.0.39 onwards. Try to see if the issue
> > > happens for tomcat 8.0.29. I can vouch for 8.0.29 where it didn't
> happen.
> > > 3) Did you try and follow my suggestion on point 3 (last email) about
> > > checking the method sizes of the precompiled JSPs using apache commons
> > BCEL
> > > (bcel-5.4.1.jar) library? If yes, what did you find?
> > >
> >
> > I already tried to precompile the JSPs using ANT but it is giving
> following
> > error:
> > C:\apache-ant-1.9.4\tomcat.xml:11: org.apache.jasper.JasperException:
> > java.lang.IllegalArgumentException: Page directive: invalid value for
> > import
> > at org.apache.jasper.JspC.processFile(JspC.java:1296)
> > at org.apache.jasper.JspC.execute(JspC.java:1415)
> > at
> > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > I guess I am hitting the bug # 57099 and there are multiple JSPs wherein
> we
> > need to do these changes.
> >
> > >
> > >
> > > You also haven't mentioned what sort of JSPs you have that yields into
> > such
> > > error. Are you having legacy scriptlets which are quite heavy and uses
> > lots
> > > of custom tags? Try to use the following too:
> > >
> > > <init-param>
> > > <param-name>trimSpaces</param-name>
> > > <param-value>true</param-value>
> > > </init-param>
> > >
> > > The above is having some inconsistency reported in a different email
> > > thread, but I assume it should be fine in most of the cases. Try to see
> > if
> > > you can provide some results on the above points.
> > >
> > >
> > > KR,
> > >
> > > On 16 May 2017 at 15:29, Vidyadhar <[email protected]> wrote:
> > >
> > > > Hello KR,
> > > >
> > > > On Fri, May 12, 2017 at 12:37 PM, Mohammed Manna <[email protected]
> >
> > > > wrote:
> > > >
> > > > > I have two things which you might want to try out:
> > > > >
> > > > > 1) You will lose your JSP debugging capability - but if that's not
> > your
> > > > > concern, then in your CATALINA_HOME\conf folder append this for
> > > > > "JspServlet"
> > > > >
> > > > > <init-param>
> > > > > <param-name>mappedfile</param-name>
> > > > > <param-value>false</param-value>
> > > > > </init-param>
> > > > > <init-param>
> > > > > <param-name>suppressSmap</param-name>
> > > > > <param-value>true</param-value>
> > > > > </init-param>
> > > > >
> > > > We already tried this option. We included these lines in tomcat's
> > web.xml
> > > > file and restarted the services, but still it is giving the same
> error.
> > > >
> > > > >
> > > > > This will stop generating JSR45 debug info and Symbol Maps for
> > JSP
> > > > > pages ( I think I have said technical things right here, otherwise
> > > please
> > > > > correct me!).
> > > > >
> > > > > 2) I sincerely recommend moving scriptlet code out of your JSP and
> > > remove
> > > > > all unwanted/commented code, newline/carriages from your JSP. Even
> > with
> > > > the
> > > > > config above, this might fail since the code is genuinely too large
> > for
> > > > > __jspService().
> > > > >
> > > > > 3) If possible, try to use Ant and precompile your JSP and iterate
> > > > through
> > > > > the .class files to check which method size is larger or close to
> 90%
> > > or
> > > > > the 64k footprint. You can write a short program by leveraging
> > java.io
> > > > and
> > > > > Apache commons BCEL library. Ant has a strange behaviour which
> > doesn't
> > > > > throw any exceptions if the Jsp method size exceeds the limit. But
> > the
> > > > > compilation occurs anyway. So you can go through those compiled
> files
> > > > using
> > > > > your custom tool and print the size of the methods.
> > > > >
> > > > >
> > > > > I hope this helps you.
> > > > >
> > > > > Further to above we tried various tomcat version and as per our
> > > > observation we are not seeing this error on 8.0.29 version. Note that
> > the
> > > > same error is still there in latest version i.e. 8.5.15.
> > > >
> > > > > KR,
> > > > >
> > > > > On 12 May 2017 at 07:58, Vidyadhar <[email protected]>
> wrote:
> > > > >
> > > > > > Hello Sagar,
> > > > > >
> > > > > > On Fri, 12 May 2017 at 12:26 PM, sagar kohli <
> > [email protected]
> > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Try adding following init parameter in
> <tomcat_home>/conf/web.xml
> > > > > > >
> > > > > > > <init-param>
> > > > > > > <param-name>mappedfile</param-name>
> > > > > > > <param-value>false</param-value>
> > > > > > > </init-param>
> > > > > >
> > > > > >
> > > > > > We already tried it but no success.
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Fri, May 12, 2017 at 10:28 AM, Vidyadhar <
> > > > [email protected]>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hello Team,
> > > > > > > >
> > > > > > > > Recently we did a upgrade existing tomcat from 7.0.42 to
> 7.0.76
> > > on
> > > > > > > windows
> > > > > > > > box. Post the up gradation we are seeing following error in
> > > couple
> > > > of
> > > > > > > JSPs
> > > > > > > >
> > > > > > > > org.apache.jasper.JasperException: Unable to compile class
> for
> > > > JSP:
> > > > > > > >
> > > > > > > > An error occurred at line: [231] in the generated java file:
> > > > > > [C:\Program
> > > > > > > > Files\Apache\Tomcat\work\Catalina\localhost\app\org\
> > > > apache\jsp\jsp\
> > > > > > > > applicationChange\applicationChangeMain_jsp.java]
> > > > > > > > The code of method _jspService(HttpServletRequest,
> > > > > > HttpServletResponse)
> > > > > > > is
> > > > > > > > exceeding the 65535 bytes limit
> > > > > > > >
> > > > > > > > Stacktrace:
> > > > > > > > org.apache.jasper.compiler.DefaultErrorHandler.javacError(
> > > > > > > > DefaultErrorHandler.java:103)
> > > > > > > > org.apache.jasper.compiler.ErrorDispatcher.javacError(
> > > > > > > > ErrorDispatcher.java:366)
> > > > > > > >
> > > > > > > org.apache.jasper.compiler.JDTCompiler.generateClass(
> > > > > > JDTCompiler.java:490)
> > > > > > > > org.apache.jasper.compiler.Compiler.compile(Compiler.
> java:379)
> > > > > > > > org.apache.jasper.compiler.Compiler.compile(Compiler.
> java:354)
> > > > > > > > org.apache.jasper.compiler.Compiler.compile(Compiler.
> java:341)
> > > > > > > > I have checked the various threads on tomcat support archive
> > and
> > > > did
> > > > > > try
> > > > > > > > following solution which did not work on 7.0.76 as well as on
> > > > 7.0.77.
> > > > > > > >
> > > > > > > > 1. Following changes in conf/web.xml
> > > > > > > > <init-param>
> > > > > > > > <param-name>mappedfile</param-name>
> > > > > > > > <param-value>false</param-value>
> > > > > > > > </init-param>
> > > > > > > > <init-param>
> > > > > > > > <param-name>compiler</param-name>
> > > > > > > > <param-value>modern</param-value>
> > > > > > > > </init-param>
> > > > > > > > 2. Increased the buffer size.
> > > > > > > >
> > > > > > > > Can some one suggest some ways to resolve this error, without
> > > > > > downgrading
> > > > > > > > to 7.0.42
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Regards,
> > > > > > > > Vidyadhar
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Regards,
> > > > > > > sagar kohli
> > > > > > >
> > > > > > --
> > > > > > Regards,
> > > > > > Vidyadhar
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Regards,
> > > > Vidyadhar
> > > >
> > >
> >
> >
> >
> > --
> > Regards,
> > Vidyadhar
> >
>
--
Regards,
Vidyadhar