?
Solved

reducing service method

Posted on 2003-02-24
13
Medium Priority
?
1,196 Views
Last Modified: 2013-11-24
Hi All,

I am getting this error "Error instantiating servlet" (stack trace below)  

I figured that maybe I've exceeded my 32K limit in my JSP service method.

I'm trying to figure out how to reduce the size of my service method without removing anything the JSP. One of the things that I considered was modifying my custom tags.  

My questions are:
Do custom tags contribute to the size of the JSP service method?  
If so, what can I do in the custom tags to reduce it's contribution to the JSP service method?

If not, then does anyone have any tips on handling a initilializing problem with JSP?

I've tried removing the *.class files for the JSP page and restarting the app server. That doesn't work.


thanks,
- tekel

----- start of weblogic stack trace ---------
) Illegal target of jump or branch
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance0(Compiled Code)
        at java.lang.Class.newInstance(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.createServlet(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.createInstances(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Compiled Code)
        at weblogic.servlet.jsp.JspStub.prepareServlet(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.getServlet(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:168)
        at org.apache.struts.action.ActionServlet.processActionForward(Unknown Source)
        at org.apache.struts.action.ActionServlet.process(Compiled Code)
        at org.apache.struts.action.ActionServlet.doGet(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextManager.invokeServlet(Compiled Code)
        at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
        at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
        at weblogic.kernel.ExecuteThread.run(Compiled Code)

----- end of weblogic stack trace ---------
0
Comment
Question by:tekel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 8011487
>> I figured that maybe I've exceeded my 32K limit in my JSP service method.
I didn't aware there is such limit exist. correct me if I'm wrong.

the stack trace is not complete, we cannot see the exception, there must be something before the close parenthases.
0
 

Author Comment

by:tekel
ID: 8025721
Thanks for the response kennethxu,

I guess I was misinformed about the size limit. I didn't read it from a book.  I came across a similar problem on another page and reducing it's size seems to fix fit. but this file is considerably smaller, so the issue of size limits doesn't make sense.  

The complete stack trace is below.  

If this is any help:
I'm using STRUTS 1.0, weblogic 5.x, on a solaris box.


- tekel

---  begin of stack trace -------
Wed Feb 26 14:42:49 GMT+00:00 2003:<E> <WebAppServletContext-ITVAuctionWebApp> Error instantiating servlet: jsp_servlet._map.__test
java.lang.VerifyError: (class: jsp_servlet/_map/__test, method: _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V) Illegal target of jump or branch
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance0(Compiled Code)
        at java.lang.Class.newInstance(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.createServlet(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.createInstances(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Compiled Code)
        at weblogic.servlet.jsp.JspStub.prepareServlet(Compiled Code)
        at weblogic.servlet.jsp.JspStub.checkForReload(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.getServlet(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.RequestDispatcherImpl.forward(Compiled Code)
        at org.apache.struts.action.ActionServlet.processActionForward(Compiled Code)
        at org.apache.struts.action.ActionServlet.process(Compiled Code)
        at org.apache.struts.action.ActionServlet.doGet(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextManager.invokeServlet(Compiled Code)
        at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
        at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
        at weblogic.kernel.ExecuteThread.run(Compiled Code)

Wed Feb 26 14:42:49 GMT+00:00 2003:<E> <WebAppServletContext-ITVAuctionWebApp> Servlet failed with ServletException
javax.servlet.ServletException: Servlet class: jsp_servlet._map.__test couldn't be instantiated
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Compiled Code)
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Compiled Code)
        at javax.servlet.ServletException.<init>(ServletException.java:107)
        at weblogic.servlet.internal.ServletStubImpl.createServlet(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.createInstances(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Compiled Code)
        at weblogic.servlet.jsp.JspStub.prepareServlet(Compiled Code)
        at weblogic.servlet.jsp.JspStub.checkForReload(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.getServlet(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.RequestDispatcherImpl.forward(Compiled Code)
        at org.apache.struts.action.ActionServlet.processActionForward(Compiled Code)
        at org.apache.struts.action.ActionServlet.process(Compiled Code)
        at org.apache.struts.action.ActionServlet.doGet(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
        at weblogic.servlet.internal.ServletContextManager.invokeServlet(Compiled Code)
        at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
        at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
        at weblogic.kernel.ExecuteThread.run(Compiled Code)
0
 
LVL 4

Expert Comment

by:boxy73
ID: 8025845
You can use as much tags as you want, I don't know about any restriction.

Anyway, as you're using Struts, are you using any form in the JSP page? If so, is the "action" property pointing to an accurate "action" entry in your struts-config.xml file?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tekel
ID: 8025949
Thanks, It's good to know that there is no restriction.

I'm not using any forms on the page. And the action entry on struts-config.xml is right.  
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8026233
looks like you get a corrupted class file. some possible causes are:
1. are you using pre-compiled jsp?
2. are you using any jdk other then those come with weblogic?
3. are you transferring your files over ftp?
4. have you patched weblogic 5.1 to latest patch?

I would also try to delete temp files under WEB-INF\_tmp_war_xxxx, especially under jsp_servlet.
0
 

Author Comment

by:tekel
ID: 8028658
Hi kennethxu,

in reponse to your items

1) I've delete the jsp class files unders WEB-INF\_tmp_war_xxxx.  that didn't work
2) yes
3) yes, you think it might be corrupted that way?
4) Not sure, my admin said that we're jdk 1.2.2_07 on weblogic and the weblogic is WL5.1 SP10.

here's a nother thing which led me to believe that there wasw a file size limit.  I have several static includes in the page.  when I remove one of the includes, and it doesn't matter which one, the page loads okay.  it's when I put one of the includes back that it breaks. for example, if I'm including 6 files and I remove one it works, but when I put that include back in it throws the instantiation problem.

Is there a limit on static includes?

thanks for the replies thus far,  

- tekel
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8029383
>> Illegal target of jump or branch
this mean the byte code of class file is illegal.

Did some investigation, you right, me wrong. the limitation is in class file. one single method cannot have more then 64K compiled byte code.

In case of JSP, JSP code + all static included jsp code, are translated into a java source code. most of the code will be in one single method, this java source code in turn been compiled into class file.

So, yes, please reduce you page size. try
1. you can extract your code into methods and declare them in <%! %>.
2. use dynamic include instead of static include if you can. i.e., use <jsp:include>
3. move your code logic into bean or taglib.
0
 

Author Comment

by:tekel
ID: 8033474
Thanks for doing some diligence, Kennethxu.

On suggestion #3: I have custom tags that expose objects to the page.  By exposing these objects, am I adding to the size of the compiled page?  Or am I right in saying that beans and taglibs never add to the size of the method?

You mentioned that you did some investigation.  I was wondering if you can point me to a resource where I can see this in writing?  A URL perhaps?

This seems like a big issue that has not been well documented. Any resource discussing this topic would be valuable.

Thanks for the advice on how to reduce my method size. I'll let you know how things turn out.

- tekel
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8034654
you are adding sime to the compiled code by using tag and/or exposing objects. imagine those code will eventually become a line in .java file like "YourClasss yourObject = ..."

but if you can move a whole block of code into taglib, the code sized added by taglib can be smaller then the whole block of java code in your jsp page.

this limitation is defined in java virtual machine specification.
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88659

also, some other related links:
http://developer.java.sun.com/developer/bugParade/bugs/4262078.html
http://forum.java.sun.com/thread.jsp?forum=45&thread=256597
http://forum.java.sun.com/thread.jsp?forum=17&thread=28140
0
 

Author Comment

by:tekel
ID: 8034998
Thanks for the URLs. They were very helpful.

going back to your comment "you are adding sime to the compiled code by using tag and/or exposing objects"

Just to clarification - Does this mean that if I instantiate 10 objects inside my tag and expose 1 of them, then do all 10 objects contribute to the size of the JSP service method or just the 1 that was exposed?

If all 10 objects contributes to the size of the JSP file, then would setting them to nulls help any?

The reason why I ask is because the objects that are in my tags are huge.  The JSP pages, and the included JSP pages have some JSP code in it, but it's not enough that it would exceed a 32k limit. In other words, there is a moderate amount of JSP code.


thanks for the responses thus far,
- tekel
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 400 total points
ID: 8035978
>> Just to clarification - Does this mean that if I instantiate 10 objects inside my tag and expose 1 of them, then do all 10 objects contribute to the size of the JSP service method or just the 1 that was exposed?

the direct answer is 1. but it doesn't count that way.

the size of any object doesn't count into the size of method, the declaration of var and assignment count to the method size.

compiler will translate you CODE into byte stream, that counts to the method size.

for example, if myList have 30 strings.

this result in bigger method size:

String a = myList.get(1);
String b = myList.get(2);
String c = myList.get(3);

compare to

String[] s = (String[]) myList.toArray();

although earlier code only exposes 3 objects, later exposes 30 objects.

because earlier code have 3 instructions need to be translated into type code. but later one has only one instruction.

HTH
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 8035984
>> translated into type code
typo: translated into Bype code
0
 

Author Comment

by:tekel
ID: 8041208
Thanks, you were a great help.

Tekel
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question