tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: problem with large servlets( classes )?
Date Wed, 03 Apr 2002 18:22:26 GMT
Java has a maximum size of 64kb on any particular method.  There might
also be other limits on the overall size of the class, but I've had no
problems with some pretty large classes.

However, I would consider a class this large to be a warning sign that you
really need to look at your architecture, and divide things up.
Monolithic large classes are very hard to maintain and enhance.

Just as a comparison, I did a quick scan of all the classes in Tomcat 4 --
the largest single class in the entire server is around 28k (it's the
class that dynamically deploys a new webapp, called by the Manager
servlet).  The vast majority of the classes are under 6k.  The same
thing will happen for you if you use an application framework like Struts
(http://jakarta.apache.org/struts), which encourages you to divide your
processing logic up into lots of little single-purpose pieces.  They are
also *much* easier to maintain, test, and enhance.

Craig


On Wed, 3 Apr 2002, Mikkel Lindhard wrote:

> Date: Wed, 3 Apr 2002 10:30:47 +0200
> From: Mikkel Lindhard <ml@back-bone.dk>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: "'Tomcat Users List' (E-mail)" <tomcat-user@jakarta.apache.org>
> Subject: problem with large servlets( classes )?
>
> We are having a "not so fun" problem with the size of our controller servlet
> class loaded( could be file size, could be other size problems )
> basically were getting this error when adding one more line of code( of any
> kind ) in our controller servlet:
>
> java.lang.VerifyError: (class: "ServletName", method: "function" signature:
> (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletRespo
> nse;)V) Illegal instruction found at offset "XX"
> 	at java.lang.Class.newInstance0(Native Method)
> 	at java.lang.Class.newInstance(Class.java:237)
> 	at
> org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:268)
>
>
> We stumpled across this error, but that isnt the case in our situation so i
> guess something else can trigger this error.
> http://developer.java.sun.com/developer/bugParade/bugs/4223705.html
>
> the servlet is around 93 kb compiled now and works.....
>
> setup:
> Tomcat 3.2.1
> JDK build 1.3.1_02-b02
> Win2k Server
>
> thanks in advance
> Mikkel
>
>
> -------
> [Denne E-mail blev scannet for virus af Declude Virus]
> [This E-mail was scanned for viruses by Declude Virus]
>
>
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>
>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message