You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Terry Westley <tw...@acm.org> on 2001/08/28 05:40:18 UTC

Call to wrong initialization method

Newbie is attempting to adapt the SampleServlet.java example
to his own code, gets this stack trace, of which, only first
few lines shown.  I've put nothing in the context yet, just
trying to return a template that is nothing but straight HTML
out of handleRequest.  But, I don't think handleRequest is yet
called because of the error below that I can't figure out...

Can anyone give me a hint?

This is running Velocity 1.1 with Tomcat 3.2.1 on WinXP Pro RC2.

--
Terry Westley
twestley@acm.org

--------------------- cut here --------------------------
Error: 500
Location: /sigada2001/myvelocityservlet
Internal Servlet Error:

java.lang.VerifyError: (class: myvelocityservlet$typ, method:  signature:
()V) Call to wrong initialization method
	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)


Re: Call to wrong initialization method

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 8/28/01 9:38 AM, "Terry Westley" <tw...@acm.org> wrote:

> Geir Magnusson Jr. [mailto:geirm@optonline.net] writes:
>> Ok - are you basing your servlet on the VelocityServlet?
>> 
>> Note that you don't have to do what VelocityServlet does.  You can easily
>> make a simple servlet, use the new separate instance runtime stuff, and roll
>> your own.  
>> 
>> Velocity really don't know its being used in the web environment - we just
>> provide VelocityServlet to make it easier for those actually working in Java
> 
> Yes, I'm using the VelocityServlet.  Ada is an object-oriented language
> and I can extend VelocityServlet to create my own.  As I understand it, the
> main advantage for using VelocityServlet is that, through handleRequest,
> I get easy access to the context and the servlet request.

Yes - VelocityServlet handles all that for you, creating the Context (new
VelocityContext()), adding the request and response (context.put(REQUEST,
req) )... You get the idea...

All I was suggesting is that you can start simple by making your own to get
the kinks out, then converting to take advantage of the ongoing maintenance
and features that will happen as it's in the distro.

Geir



RE: Call to wrong initialization method

Posted by Terry Westley <tw...@acm.org>.
Geir Magnusson Jr. [mailto:geirm@optonline.net] writes:
> Ok - are you basing your servlet on the VelocityServlet?
> 
> Note that you don't have to do what VelocityServlet does.  You can easily
> make a simple servlet, use the new separate instance runtime stuff, and roll
> your own.  
> 
> Velocity really don't know its being used in the web environment - we just
> provide VelocityServlet to make it easier for those actually working in Java

Yes, I'm using the VelocityServlet.  Ada is an object-oriented language
and I can extend VelocityServlet to create my own.  As I understand it, the
main advantage for using VelocityServlet is that, through handleRequest,
I get easy access to the context and the servlet request.

--
Terry Westley
twestley@acm.org


Re: Call to wrong initialization method

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 8/28/01 8:42 AM, "Terry Westley" <tw...@acm.org> wrote:

> On 8/27/01 11:40 PM, "Terry Westley" <tw...@acm.org> wrote:
>> Newbie is attempting to adapt the SampleServlet.java example
>> to his own code, gets this stack trace, of which, only first
>> few lines shown.  I've put nothing in the context yet, just
>> trying to return a template that is nothing but straight HTML
>> out of handleRequest.  But, I don't think handleRequest is yet
>> called because of the error below that I can't figure out...
>> 
>> Can anyone give me a hint?
> 
> Geir Magnusson Jr. [mailto:geirm@optonline.net] responds:
>> Yech.  Can you send us a copy of your source code?
> 
> Thanks for offering to look at the source code.  Unfortunately,
> I'm not sure that will help, because it is written in Ada and uses
> the JGNAT <http://www.gnat.com> compiler to compile to Java bytecodes.
> I've been very successful using JSP with this technique and I'm now
> moving on to learning Velocity.

Well, that's a first for Velocity, I think. :)
 
> My usual solution for these kinds of problems is to "revert" to Java,
> simplify what I'm trying to do, make that work and then duplicate the
> code in Ada until I understand what I'm doing wrong.  In this case,
> I'm porting an existing servlet from JSP to Velocity and was using
> the Velocity SampleServlet.java as a guideline.


Ok - are you basing your servlet on the VelocityServlet?

Note that you don't have to do what VelocityServlet does.  You can easily
make a simple servlet, use the new separate instance runtime stuff, and roll
your own.  

Velocity really don't know its being used in the web environment - we just
provide VelocityServlet to make it easier for those actually working in Java
:)

> 
> If anyone is curious and still wants to see the source code, I'll
> be happy to send it along.

I'd love to see it, but I don't know ada.

Geir


RE: Call to wrong initialization method

Posted by Terry Westley <tw...@acm.org>.
On 8/27/01 11:40 PM, "Terry Westley" <tw...@acm.org> wrote:
> Newbie is attempting to adapt the SampleServlet.java example
> to his own code, gets this stack trace, of which, only first
> few lines shown.  I've put nothing in the context yet, just
> trying to return a template that is nothing but straight HTML
> out of handleRequest.  But, I don't think handleRequest is yet
> called because of the error below that I can't figure out...
> 
> Can anyone give me a hint?

Geir Magnusson Jr. [mailto:geirm@optonline.net] responds:
> Yech.  Can you send us a copy of your source code?

Thanks for offering to look at the source code.  Unfortunately,
I'm not sure that will help, because it is written in Ada and uses
the JGNAT <http://www.gnat.com> compiler to compile to Java bytecodes.
I've been very successful using JSP with this technique and I'm now
moving on to learning Velocity.

My usual solution for these kinds of problems is to "revert" to Java,
simplify what I'm trying to do, make that work and then duplicate the
code in Ada until I understand what I'm doing wrong.  In this case,
I'm porting an existing servlet from JSP to Velocity and was using
the Velocity SampleServlet.java as a guideline.

If anyone is curious and still wants to see the source code, I'll
be happy to send it along.

--
Terry Westley
twestley@acm.org


Re: Call to wrong initialization method

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 8/27/01 11:40 PM, "Terry Westley" <tw...@acm.org> wrote:

> Newbie is attempting to adapt the SampleServlet.java example
> to his own code, gets this stack trace, of which, only first
> few lines shown.  I've put nothing in the context yet, just
> trying to return a template that is nothing but straight HTML
> out of handleRequest.  But, I don't think handleRequest is yet
> called because of the error below that I can't figure out...
> 
> Can anyone give me a hint?
> 
> This is running Velocity 1.1 with Tomcat 3.2.1 on WinXP Pro RC2.


Yech.  Can you send us a copy of your source code?

Geir

> --
> Terry Westley
> twestley@acm.org
> 
> --------------------- cut here --------------------------
> Error: 500
> Location: /sigada2001/myvelocityservlet
> Internal Servlet Error:
> 
> java.lang.VerifyError: (class: myvelocityservlet$typ, method:  signature:
> ()V) Call to wrong initialization method
> 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)
>