You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Barbara Baughman <ba...@utdallas.edu> on 2001/06/19 19:12:09 UTC

How do I get started?

I give up.  I have loaded tomcat and have written servlets that work
fine.  I'm trying to just get a Velocity servlet - any servlet to work,
and I keep getting:

Error: 500

Location: /barbara/servlet/vel.SampleServlet2

Internal Servlet Error:

java.lang.NullPointerException
        at
org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.java:471)
        at
org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoader.java:174)
        at
org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:265)
        at
org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
        at org.apache.tomcat.core.Handler.service(Handler.java:254)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)

Both servlet_example1 and servlet_example2 have the deprecated
handleRequest in it, so I have to override Java's objections.

I tried rewriting it a little to the uptodate handleRequest, adding import
statements for HttpServletRequest & HttpServletResponse.  Same result.

I put sample.vm in tomcat/bin, webapps/barbara, webapps/barbara/template,
webapps/barbara/WEB-INF, the same subdirectory as the servlet, and
tomcat's home directory.  Same result.

I tried using the web.xml file to point a properties file that would give
the full path of a properties file under webapps/barbara and put a file
there will runtime.log and file.resource.loader.path specified.  Same
result.

Don't ask for a dump of velocity.log.  When I do a search through the
tomcat directory/subdirectories I get nothing.

I've been trying stuff for days.  Help!  I can't even get the examples to
work.

Tomcat 3.2.1, Velocity 1.1 rc2

Barbara Baughman
X2157


Re: How do I get started?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Barbara Baughman wrote:
> 
> I give up.  I have loaded tomcat and have written servlets that work
> fine.  I'm trying to just get a Velocity servlet - any servlet to work,
> and I keep getting:
> 
> Error: 500
> 
> Location: /barbara/servlet/vel.SampleServlet2
> 
> Internal Servlet Error:
> 
> java.lang.NullPointerException
>         at
> org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.java:471)
>         at
> org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoader.java:174)
>         at
> org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:265)
>         at
> org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
>         at org.apache.tomcat.core.Handler.service(Handler.java:254)
>         at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>         at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)

Whew.  Nothing from us :)
 
> Both servlet_example1 and servlet_example2 have the deprecated
> handleRequest in it, so I have to override Java's objections.

Just ignore for now.. I will update them.

> I tried rewriting it a little to the uptodate handleRequest, adding import
> statements for HttpServletRequest & HttpServletResponse.  Same result.
> 
> I put sample.vm in tomcat/bin, webapps/barbara, webapps/barbara/template,
> webapps/barbara/WEB-INF, the same subdirectory as the servlet, and
> tomcat's home directory.  Same result.
> 
> I tried using the web.xml file to point a properties file that would give
> the full path of a properties file under webapps/barbara and put a file
> there will runtime.log and file.resource.loader.path specified.  Same
> result.
> 
> Don't ask for a dump of velocity.log.  When I do a search through the
> tomcat directory/subdirectories I get nothing.

No, I expect you wouldn't, as the problem appears that your servlet
isn't getting invoked.

For starters, lets not worry about the template.  We can worry about
that when we manage to get the servlet running.

I assume you have a directory structure similar to, with files like:

webapps/
webapps/barbara/
webapps/barbara/velocity.properties
webapps/barbara/sample.vm
webapps/barbara/WEB-INF
webapps/barbara/WEB-INF/web.xml
webapps/barbara/WEB-INF/classes/vel.SampleServle2.class
webapps/barbara/WEB-INF/lib/velocity-1.1-rc2.jar

 
> I've been trying stuff for days.  Help!  I can't even get the examples to
> work.
> 
> Tomcat 3.2.1, Velocity 1.1 rc2

Both of these are good.  No worries there. 

> Barbara Baughman
> X2157

If you give us the rest of the number, we can call you :)

IF you can verify the above, we can move to the next step

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!