[SunONE-JATO] Illegal target of jump or branch

Greetings All,

According to the JLS, no single method on a class can be greater than

32K bytes of byte-code. As you know, the bulk of what's in a JSP goes

into it's _jspService method of the resulting translated Servlet. I've

seen several JSP engines that can generate and compile JSP (Servlet)

classes in which the _jspService method is larger than the legal limit.

The result is that you get the exceptions you've described.

If you're using translation-time includes (using the <%@ include ... %>

directive) instead of run-time includes (using the <jsp:include ...>

action tag) then that is contributing to your problem. You should

consider switching to run-time includes. While run-time includes make

the building of the JSP result a little slower, it does help reduce the

size of your generated Servlet code.

If you have JavaScript function definitions in your JSP content,

consider moving that to a separate JavaScript file and referencing the

file with a <script language="JavaScript"...> tag. This can help cut

down the size of the JSP (and the resulting Servlet code) as well as

give the browser a chance to cache the file to avoid downloading it

repetitively on subsequent views of the JSP result (thus saving

bandwidth).

Usually, I find value in reviewing the translated Servlet code to see

where the bulk of the generated code is coming from.

Unfortunately, this is one issue where the same JSP can work on one web

container and break on another. It's all an issue of how your JSP

translator generates the Servlet code - does it generate code that is

very small and concise or not. iPlanet's old JSP engine used to

generate code in such a way that it did a nice job of keeping the

Servlet code small - the translated Servlet would open the original JSP

source file, read it's source into a buffer, and then write out

fragments from that buffer as needed. This was great for keeping down

the size of the _jspService method - several lines of static JSP text

were translated into a single, simple statement that wrote a range of

bytes from a buffer. However, the last time I checked on this, the

newer JSP engine ends up generating a separate out.write(...) statement

for each line of static content in the JSP source. Obviously, this

makes the resulting Servlet code much larger.

Louis W. Lembcke, Principal

Chicago Systems Group

180 N. Stetson, Suite 3200

Chicago, IL 60601 USA

Main Tele: +1 312.444.2760

Facsimile: +1 425.969.6391

<a href="/group/SunONE-JATO/post?protectID=226151192213093194213038203156244089098 144038051217098250238073067158159228020180222009204035181">LLembcke@C...</ a>

<a href="http://www.ChicagoSystemsGroup.com/">http://www.ChicagoSystemsGroup.co m/</a>

--Original Message--

From: Billy Lam [mailto:<a href="/group/SunONE-JATO/post?protectID=014128113213146202169232186219161248102 048234051197">blam@b...</a>]

Sent: Thursday, August 22, 2002 8:28 AM

Subject: RE: [SunONE-JATO] Illegal target of jump or branch

It is working with Resin 2.1.4. However, our targeting container will

be

SunOne. My question is "does SunOne has the same limitation ?"

Thanks

Billy

--Original Message--

From: Todd Fast [mailto:<a href="/group/SunONE-JATO/post?protectID=101233080150035167169232031248066077000 048234051197">Todd.Fast@S...</a>]

Sent: Wednesday, August 21, 2002 7:53 PM

Subject: Re: [SunONE-JATO] Illegal target of jump or branch

This is basically a container bug caused by poor JSP code generation.

The

size of the JSP is definitely the issue. You will need to reduce the

size--possibly substantially--to avoid the issue. One way of doing this

would be to use JATO pagelets to dynamically include portions of the

page

during rendering. (You cannot use translation-time includes because

that

will not avoid the problem.)

Todd

-- Original Message --

From: "billyjolam" <<a href="/group/SunONE-JATO/post?protectID=014128113213146202169232186219161248102 048234051197">blam@b...</a>>

Sent: Wednesday, August 21, 2002 11:59 AM

Subject: [SunONE-JATO] Illegal target of jump or branch

> I got the "Illegal target of jump or branch" one of the page in my

> project. The JSP of this page is large, about 128K. Is this the

> cause? I'm running under Resin 2.0.5.

>

> Here is the Stack dump:

>

> com.iplanet.jato.command.CommandException: Handler

> method "handleBtProceedRequest" threw an exception

> Root cause = [java.lang.VerifyError: (class:

> _mosapp/_mossystem/_pgdealsummary__jsp, method: _jspService

> signature:

> (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServle

> tResponse;)V) Illegal target of jump or branch]

> at

> com.iplanet.jato.view.command.DefaultRequestHandlingCommand.execute

> (DefaultRequestHandlingCommand.java:220)

> at com.iplanet.jato.view.RequestHandlingViewBase.handleRequest

> (RequestHandlingViewBase.java:335)

> at com.iplanet.jato.view.ViewBeanBase.dispatchInvocation

> (ViewBeanBase.java:806)

> at

> com.iplanet.jato.view.ViewBeanBase.invokeRequestHandlerInternal

> (ViewBeanBase.java:637)

> at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandler

> (ViewBeanBase.java:595)

> at com.iplanet.jato.ApplicationServletBase.dispatchRequest

> (ApplicationServletBase.java:760)

> at com.iplanet.jato.ApplicationServletBase.processRequest

> (ApplicationServletBase.java:434)

> at com.iplanet.jato.ApplicationServletBase.doPost

> (ApplicationServletBase.java:312)

> at javax.servlet.http.HttpServlet.service

> (HttpServlet.java:165)

> at javax.servlet.http.HttpServlet.service

> (HttpServlet.java:103)

> at com.caucho.server.http.FilterChainServlet.doFilter

> (FilterChainServlet.java:82)

> at com.caucho.server.http.Invocation.service

> (Invocation.java:288)

> at com.caucho.server.http.CacheInvocation.service

> (CacheInvocation.java:132)

> at com.caucho.server.http.ServletServer.serviceTop

> (ServletServer.java:937)

> at com.caucho.server.http.HttpRequest.handleRequest

> (HttpRequest.java:213)

> at com.caucho.server.http.HttpRequest.handleConnection

> (HttpRequest.java:158)

> at com.caucho.server.TcpConnection.run(TcpConnection.java:140)

> at java.lang.Thread.run(Thread.java:479)

>

> Root cause:

> java.lang.VerifyError: (class:

> _mosapp/_mossystem/_pgdealsummary__jsp, method: _jspService

> signature:

> (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServle

> tResponse;)V) Illegal target of jump or branch

> at java.lang.Class.newInstance0(Native Method)

> at java.lang.Class.newInstance(Class.java:232)

> at com.caucho.jsp.JspManager.loadClass(JspManager.java:275)

> at com.caucho.jsp.JavaGenerator.compile

> (JavaGenerator.java:2430)

> at com.caucho.jsp.JspGenerator.generate(JspGenerator.java:273)

> at com.caucho.jsp.JspParser.parse(JspParser.java:236)

> at com.caucho.jsp.JspParser.parse(JspParser.java:142)

> at com.caucho.jsp.JspManager.createPage(JspManager.java:155)

> at com.caucho.jsp.PageManager.getPage(PageManager.java:340)

> at com.caucho.jsp.PageManager.getPage(PageManager.java:195)

> at com.caucho.jsp.QServlet.getPage(QServlet.java:220)

> at com.caucho.server.http.FilterChainPage.doFilter

> (FilterChainPage.java:128)

> at com.caucho.server.http.Invocation.service

> (Invocation.java:288)

> at com.caucho.server.http.CacheInvocation.service

> (CacheInvocation.java:132)

> at com.caucho.server.http.QRequestDispatcher.forward

> (QRequestDispatcher.java:214)

> at com.caucho.server.http.QRequestDispatcher.forward

> (QRequestDispatcher.java:99)

> at com.caucho.server.http.QRequestDispatcher.forward

> (QRequestDispatcher.java:76)

> at com.iplanet.jato.view.ViewBeanBase.forward

> (ViewBeanBase.java:346)

> at com.iplanet.jato.view.ViewBeanBase.forwardTo

> (ViewBeanBase.java:267)

> at mosApp.MosSystem.PageHandlerCommon.postHandlerProtocol

> (PageHandlerCommon.java:1617)

> at

> mosApp.MosSystem.pgIWorkQueueViewBean.handleBtProceedRequest

> (pgIWorkQueueViewBean.java:1484)

> at java.lang.reflect.Method.invoke(Native Method)

> at

> com.iplanet.jato.view.command.DefaultRequestHandlingCommand.execute

> (DefaultRequestHandlingCommand.java:183)

> at com.iplanet.jato.view.RequestHandlingViewBase.handleRequest

> (RequestHandlingViewBase.java:335)

> at com.iplanet.jato.view.ViewBeanBase.dispatchInvocation

> (ViewBeanBase.java:806)

> at

> com.iplanet.jato.view.ViewBeanBase.invokeRequestHandlerInternal

> (ViewBeanBase.java:637)

> at com.iplanet.jato.view.ViewBeanBase.invokeRequestHandler

> (ViewBeanBase.java:595)

> at com.iplanet.jato.ApplicationServletBase.dispatchRequest

> (ApplicationServletBase.java:760)

> at com.iplanet.jato.ApplicationServletBase.processRequest

> (ApplicationServletBase.java:434)

> at com.iplanet.jato.ApplicationServletBase.doPost

> (ApplicationServletBase.java:312)

> at javax.servlet.http.HttpServlet.service

> (HttpServlet.java:165)

> at javax.servlet.http.HttpServlet.service

> (HttpServlet.java:103)

> at com.caucho.server.http.FilterChainServlet.doFilter

> (FilterChainServlet.java:82)

> at com.caucho.server.http.Invocation.service

> (Invocation.java:288)

> at com.caucho.server.http.CacheInvocation.service

> (CacheInvocation.java:132)

> at com.caucho.server.http.ServletServer.serviceTop

> (ServletServer.java:937)

> at com.caucho.server.http.HttpRequest.handleRequest

> (HttpRequest.java:213)

> at com.caucho.server.http.HttpRequest.handleConnection

> (HttpRequest.java:158)

> at com.caucho.server.TcpConnection.run(TcpConnection.java:140)

> at java.lang.Thread.run(Thread.java:479)

>

>

>

> To download the latest version of JATO, please visit:

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

<<a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>>

>

> For more information about JATO, please visit:

> <a href="http://developer.iplanet.com/tech/appserver/framework/index.jsp">http: //developer.iplanet.com/tech/appserver/framework/index.jsp</a>

<<a href="http://developer.iplanet.com/tech/appserver/framework/index.jsp">http: //developer.iplanet.com/tech/appserver/framework/index.jsp</a>>

>

>

>

>

>

To download the latest version of JATO, please visit:

<a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

<<a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>>

For more information about JATO, please visit:

<a href="http://developer.iplanet.com/tech/appserver/framework/index.jsp">http: //developer.iplanet.com/tech/appserver/framework/index.jsp</a>

<<a href="http://developer.iplanet.com/tech/appserver/framework/index.jsp">http: //developer.iplanet.com/tech/appserver/framework/index.jsp</a>>

This communication is intended only for the use of the individual or

entity

to whom/which it is addressed, and information contained in this

communication is privileged and confidential. If the receiver of this

message is not the intended recipient, you are hereby notified that any

dissemination, distribution or copying of this communication is strictly

prohibited. If you have received this communication in error, please

notify

the sender of this email (so that we may correct our internal records)

and

delete this communication without making a copy of it.

Thank you.

[Non-text portions of this message have been removed]

To download the latest version of JATO, please visit:

<a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

For more information about JATO, please visit:

<a href="http://developer.iplanet.com/tech/appserver/framework/index.jsp">http: //developer.iplanet.com/tech/appserver/framework/index.jsp</a>

[Non-text portions of this message have been removed]

[13910 byte] By [Guest] at [2007-11-25 9:36:02]
# 1

Hi, I found this old topic about "Illegal target of jump or branch" error occurred while the compiled jsp size exceeds 32K bytes.

I would like to ask whether the same case happen to Servlet with large size.

I am doing changes for an old project of my company and the support team encounters this error as shown below. I wonder it is caused by misconfiguration (Unable to locate class error) or large method in the servlet (Illegal target of jump or branch error).

Unfortunately, I am unable to simulate the error for we do not have the environment and db at my side. Please advice. thanks

[03/May/2006:20:41:19] info ( 5173): Internal Info: loading servlet /jsp/slcm.jsp

[03/May/2006:20:41:23] info ( 5173): Internal Info: loading servlet /servlet/com.ol.admin.LoyaltyClubManagementServlet

[03/May/2006:20:41:23] warning ( 5173): Unable to locate class: com.ol.admin.LoyaltyClubManagementServlet (java.lang.VerifyError: (class: com/ol/admin/LoyaltyClubManagementServlet, method: doPost2 signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse ;)V) Illegal target of jump or branch)

[03/May/2006:20:41:23] warning ( 5173): Internal error: Failed to get GenericServlet. (uri=/servlet/com.ol.admin.LoyaltyClubManagementServlet,SCRIPT_NAME=/servlet/co m.ol.admin.LoyaltyClubManagementServlet)

wls at 2007-7-1 18:38:02 > top of Java-index,Development Tools,Java Tools...
# 2
Well. Can't say for sure, but the compiled JSP is actually a Servlet, thus such behaviour may be very likely.
KSorokin at 2007-7-1 18:38:02 > top of Java-index,Development Tools,Java Tools...