You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Javier <xl...@yahoo.com> on 2003/11/08 20:20:57 UTC

Re[2]: Newbie problem

On 08/11/2003 at 15:22 Claude Brisson wrote:

>Hard to say if sthing is missing, since you don't specify HOW it doesn't
>work... (surrealistic to say... ;-) )

Yep, I'guilty...sorry... :)

Just you know... it's saturday..


>
>nevertheless :
>
>You need a velocity.properties file in your WEB-INF dir
>(you can start with the file
>src/java/org/apache/velocity/runtime/defaults/velocity.properties)
>
>it's precisely in this file that you specify where the templates are
>located
>

Ok, I've placed the properties file and now my Tomcat doesn't start. 

I get the error:

08-nov-2003 20:17:55 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
08-nov-2003 20:17:56 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8443
08-nov-2003 20:17:56 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3946 ms
08-nov-2003 20:17:57 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
08-nov-2003 20:17:57 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.14
08-nov-2003 20:17:57 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
java.lang.reflect.InvocationTargetException
	a


>next, check your servlet-mapping clause in web.xml

Mapping it's ok..it work with the other servlets.


>
>finally, for your information, the VelocityServlet is know deprecated, and
>should be replaced by the VelocityViewServlet (part of
>the velocity-tools subproject). It may automatically solve some
>ResourceNotFound problems.

Ok. I've download velocity tools but it comes with instructions to make
from source code, not instructions to install binaries. Where should I
place velocity-tools jar files ?



Thanks in advance

<jl>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Re[4]: Newbie problem

Posted by Nathan Bubna <na...@esha.com>.
Javier said:
> On 09/11/2003 at 11:47 Claude Brisson wrote:
> Well, I'm starting to gettin crazy with Velocity and Velocity Tools... :(
>
> I've made a simple, so simple example.

simpler than the "simple" example that comes with VelocityTools?  i would get
that working first if i were you.  then you have a roadmap for creating your
own simple app.

> I'va made a simple template called index.vm that looks like:
>
> #include("head.vm")
...

remember that #include only includes the other file, it doesn't parse it.  use
#parse to parse and include another template.  also, once you have things
figured out a bit more, you may want to use the VelocityLayoutServlet to
handle the layout of your templates.  it's cleaner and easier than just using
#parse() and #include() (which you can still do).  but that's for later.  one
thing at a time right now :)

...
> Then, I defined a web.xml like velocity tools documentation does:
...
>         <init-param>
>             <param-name>org.apache.velocity.toolbox</param-name>
>             <param-value>/WEB-INF/toolbox.xml</param-value>
>         </init-param>
...
> As far as I understand, at this stage if I call index.vm from IE,
> velocitytools will show me the template (without need to have a class
> related to the template because my template do nothing) and then I don't
> need a toolbox.xml file.

the web.xml looks fine, except that you shouldn't specify a toolbox file in it
if you are not going to use that feature.  just leave the toolbox part out for
now.

> Well, when I tried to call index.vm from my browser give me the following
> error:
...
> java.lang.NoClassDefFoundError
> org.apache.velocity.app.Velocity.setApplicationAttribute(Velocity.java:619)
>
> org.apache.velocity.tools.view.servlet.VelocityViewServlet.initVelocity(Vel
> ocityViewServlet.java:276)
> org.apache.velocity.tools.view.servlet.VelocityViewServlet.init(VelocityVie
> wServlet.java:216)
...

some library is missing.  look at the libraries included in the WEB-INF/lib
folder of the "simple" example that comes with VelocityTools.  you'll need all
of those.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Re[4]: Newbie problem

Posted by Claude Brisson <cl...@savoirweb.com>.
your config files are ok

> java.lang.NoClassDefFoundError

this is most of the time due to a missing library

please try again after putting in you /WEB-INF/lib all the libs that come with the tools subproject and tell us how it goes

CloD



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re[4]: Newbie problem

Posted by Javier <xl...@yahoo.com>.
On 09/11/2003 at 11:47 Claude Brisson wrote:



Well, I'm starting to gettin crazy with Velocity and Velocity Tools... :(

I've made a simple, so simple example.

I'va made a simple template called index.vm that looks like:

	#include("head.vm")
	
	<table>
		<tr>
			<td>Hola</td>
			<td></td>
		</tr>	
	</table>
	
	#include("foot.vm")

head and foot are other templates that have the rest of html (layout, etc).

Then, I defined a web.xml like velocity tools documentation does:

==========================
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <!-- Define Velocity template compiler -->
    <servlet>
        <servlet-name>velocity</servlet-name>
        <servlet-class>
            org.apache.velocity.tools.view.servlet.VelocityViewServlet
        </servlet-class>

        <init-param>
            <param-name>org.apache.velocity.toolbox</param-name>
            <param-value>/WEB-INF/toolbox.xml</param-value>
        </init-param>

        <init-param>
            <param-name>org.apache.velocity.properties</param-name>
            <param-value>/WEB-INF/velocity.properties</param-value>
        </init-param>

        <load-on-startup>10</load-on-startup>
    </servlet>

    <!-- Map *.vm files to Velocity -->
    <servlet-mapping>
        <servlet-name>velocity</servlet-name>
        <url-pattern>*.vm</url-pattern>
    </servlet-mapping>
           
</web-app>
=============================

As far as I understand, at this stage if I call index.vm from IE,
velocitytools will show me the template (without need to have a class
related to the template because my template do nothing) and then I don't
need a toolbox.xml file.

Well, when I tried to call index.vm from my browser give me the following
error:

============================
exception 

javax.servlet.ServletException: Servlet.init() for servlet velocity threw
exception
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:16
4)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
	org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:209)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConn
ection(Http11Protocol.java:549)
	org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
	org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.ja
va:666)
	java.lang.Thread.run(Unknown Source)


root cause 

java.lang.NoClassDefFoundError
	org.apache.velocity.app.Velocity.setApplicationAttribute(Velocity.java:619)

	org.apache.velocity.tools.view.servlet.VelocityViewServlet.initVelocity(Vel
ocityViewServlet.java:276)
	org.apache.velocity.tools.view.servlet.VelocityViewServlet.init(VelocityVie
wServlet.java:216)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:16
4)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
	org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:209)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConn
ection(Http11Protocol.java:549)
	org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
	org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.ja
va:666)
	java.lang.Thread.run(Unknown Source)

=======================

Obviously, I did something wrong but I don't now why...

Andy help appreciated, I want to understand how velocity tools work...

Thanks in advance.

<jl>


PD: in my lib dir I placed:

velocity-tools-view-1.0.jar
velocity-dep-1.3.1.jar
dom4j.jar

as I see in velocity tools sample code.






---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Re[2]: Newbie problem

Posted by Claude Brisson <cl...@savoirweb.com>.
> I get the error:
> 
> 08-nov-2003 20:17:55 org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on port 8080
> 08-nov-2003 20:17:56 org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on port 8443
> 08-nov-2003 20:17:56 org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 3946 ms
> 08-nov-2003 20:17:57 org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 08-nov-2003 20:17:57 org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/5.0.14
> 08-nov-2003 20:17:57 org.apache.catalina.core.StandardHost start
> INFO: XML validation disabled
> java.lang.reflect.InvocationTargetException
> a

no stack trace with this exception ?

> 
> Ok. I've download velocity tools but it comes with instructions to make
> from source code, not instructions to install binaries. Where should I
> place velocity-tools jar files ?
> 

with other libs, in your /WEB-INF/lib directory

CloD



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Re[4]: Newbie problem

Posted by Nathan Bubna <na...@esha.com>.
Javier said:
...
> You said that have no time to read mails but
...

no.  you didn't read carefully.  i said i get a lot of email and can't be
expected to carefully read, keep, and remember every single one.  i didn't say
anything about time.  though, yes, time is often a restraint on my ability to
help people.  still, i try.

> Well, yes, my first OLDER post was a sh*t message without any info...
>
> But I've sent a new one TODAY with a clear explanation...

more on that below...

> I dont understand why a man that said to be very busy insist to reply me
> just to say nothing usefull...

once again, you weren't listening.  i didn't say anything about being very
busy.  i clearly have time on my hands today or i wouldn't be trying to help
you.  also, i specifically said that i do find it quite useful to take time to
point out netiquette and encourage people to ask good questions.  just because
you can't see the use in that does not mean it is not useful.

get this through your head.  i *am* trying to help you.  do you think i enjoy
listening to your sarcasm?

> >it's true.  we don't yet have step-by-step instructions on creating your
> >own
> >web application with VelocityTools.
> >
> >however, we do have examples that work out of the box when you follow the
> >instructions for them:
> >http://jakarta.apache.org/velocity/tools/view/index.html#Examples
> >
> >once you have that working, you can copy and modify them to fit your needs
> >or
> >mimic and use them as guidelines.  really, you're making things more
> >difficult
> >than they should be.
...
> How am I making things difficult ??

i think you CLEARLY explained that in your one [over-]informative post today.
it showed quite clearly that you are NOT following the instructions for
running the VelocityTools examples.

> I just tried to run examples without modifications and I couldn't....what
> are you talking about ???

i'm talking about following instructions:
http://jakarta.apache.org/velocity/tools/view/index.html#Examples

now, for the sake of those too lazy to click the links i send and those
searching the mailing list archives later...

To Run the VelocityTools simple example:
1. Install Tomcat 4 or some equivalent servlet engine (Tomcat 5 should work,
but i have not tried it myself).
2. Download a binary release of VelocityTools
3. Extract the simple.war file.
4. Place the simple.war file into Tomcat's "webapps" directory (or the
equivalent for your servlet engine.
5. Start Tomcat
6. Point your web browser to http://localhost:8080/simple/ (or the equivalent
for your servlet engine)

The same process should work for the 'layout' and 'velstruts' example apps.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Re[6]: Pleeease, help me to start

Posted by John Doe <jo...@hotmail.com>.
I'm even more a newbie than Javier but some months ago a member posted this
link, as of today the link still works and helped me a lot to deal with
similar problems to those Javier seems to be having.

Hope it will help

http://www.cymulacrum.net/tomcat/tomcat_toc.html

----- Original Message ----- 
From: "Will Glass-Husain" <wg...@forio.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Saturday, November 22, 2003 11:41 PM
Subject: Re[6]: Pleeease, help me to start


> I agree with Dave.  Nathan... please.  enough's enough.
>
> Back on topic -- Javier's here's a question.  (having actually read your
> emails).  Looks like the problem you are having is related to setting up
the
> servlet in the web app.  In particular, Tomcat can't seem to find the
> servlet (java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet).
>
> Where did you put the compiled servlet Java class?  You mention putting
the
> source in WEB-INF/src.  (this isn't actually needed).   Did you put the
> compiled class file in WEB-INF/classes?  Maybe you could email the Java
code
> for the specific servlet you tried.
>
> Sounds like you're new to Tomcat and Java web apps.  Although I'm a few
> years past this point, I remember there's a huge learning curve here so
I'm
> sympathetic.  (and the docs for Tomcat are terrible).  Best bet is to
Google
> for "how-to"'s on getting started with servlets, or pick up one of the
> O'Reilly books.
>
> Best, WILL
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re[6]: Pleeease, help me to start

Posted by Will Glass-Husain <wg...@forio.com>.
I agree with Dave.  Nathan... please.  enough's enough.

Back on topic -- Javier's here's a question.  (having actually read your
emails).  Looks like the problem you are having is related to setting up the
servlet in the web app.  In particular, Tomcat can't seem to find the
servlet (java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet).

Where did you put the compiled servlet Java class?  You mention putting the
source in WEB-INF/src.  (this isn't actually needed).   Did you put the
compiled class file in WEB-INF/classes?  Maybe you could email the Java code
for the specific servlet you tried.

Sounds like you're new to Tomcat and Java web apps.  Although I'm a few
years past this point, I remember there's a huge learning curve here so I'm
sympathetic.  (and the docs for Tomcat are terrible).  Best bet is to Google
for "how-to"'s on getting started with servlets, or pick up one of the
O'Reilly books.

Best, WILL



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Re[4]: Newbie problem

Posted by Dave Newton <da...@solaraccess.com>.
On Sat, 2003-11-22 at 16:36, Javier wrote:
> On 22/11/2003 at 12:49 Nathan Bubna wrote:
 [snip]

Guys, take the stupid shit off-list and keep the useful stuff on it.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re[4]: Newbie problem

Posted by Javier <xl...@yahoo.com>.
On 22/11/2003 at 12:49 Nathan Bubna wrote:

>> On 08/11/2003 at 15:22 Claude Brisson wrote:
>> >Hard to say if sthing is missing, since you don't specify HOW it
doesn't
>> >work... (surrealistic to say... ;-) )
>
>apparently, i was not the only one who felt you asked questions poorly.
>

Cool, you are really cool

You said that have no time to read mails but, oops, just have the time to
read only those mails that can make you feel important...

Well, yes, my first OLDER post was a sh*t message without any info...

But I've sent a new one TODAY with a clear explanation....

I dont understand why a man that said to be very busy insist to reply me
just to say nothing usefull...


>
>it's true.  we don't yet have step-by-step instructions on creating your
>own
>web application with VelocityTools.
>
>however, we do have examples that work out of the box when you follow the
>instructions for them:
>http://jakarta.apache.org/velocity/tools/view/index.html#Examples
>
>once you have that working, you can copy and modify them to fit your needs
>or
>mimic and use them as guidelines.  really, you're making things more
>difficult
>than they should be.

What ??

How am I making things difficult ??

I just tried to run examples without modifications and I couldn't....what
are you talking about ???



<jl>





---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Re[2]: Newbie problem

Posted by Nathan Bubna <na...@esha.com>.
and another old one still in the trash folder...

Javier said:
> On 08/11/2003 at 15:22 Claude Brisson wrote:
> >Hard to say if sthing is missing, since you don't specify HOW it doesn't
> >work... (surrealistic to say... ;-) )

apparently, i was not the only one who felt you asked questions poorly.

...
> >finally, for your information, the VelocityServlet is know deprecated, and
> >should be replaced by the VelocityViewServlet (part of
> >the velocity-tools subproject). It may automatically solve some
> >ResourceNotFound problems.
>
> Ok. I've download velocity tools but it comes with instructions to make
> from source code, not instructions to install binaries. Where should I
> place velocity-tools jar files ?

it's true.  we don't yet have step-by-step instructions on creating your own
web application with VelocityTools.

however, we do have examples that work out of the box when you follow the
instructions for them:
http://jakarta.apache.org/velocity/tools/view/index.html#Examples

once you have that working, you can copy and modify them to fit your needs or
mimic and use them as guidelines.  really, you're making things more difficult
than they should be.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org