-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 All,
I'm trying to get a simple webapp up and running with Velocity. Here are the steps I've taken so far: 1. Obtained the current trunk source from svn (I'm attempting to submit a patch, which is why I'm going through svn instead of grabbing the latest release) 2. $ cd struts2/trunk/apps/blank 3. $ mvn 4. Installed the target/struts2-blank webapp into Tomcat 5.5.26 5. Ran the webapp to make sure it was working by browsing to /index.html which redirects me to examples/HelloWorld.action -> HelloWorld.jsp Everything seems to be in order. Now, I translated the .jsp file into a Velocity template (it may not be correct, but I haven't gotten to any Velocity errors, yet): <html> <head> <title>#stext('name=HelloWorld.message')</title> </head> <body> <h2>#sproperty('value="message"')</h2> <h3>Languages</h3> <ul> <li> #surl('id=url' "action=HelloWorld") #sparam('name=request_locale')en#end #end #sa("href=%{url}")English#end </li> <li> #surl('id=url' 'action=HelloWorld') #sparam('name=request_locale')es#end #end #sa("href=%{url}")Espanol#end </li> </ul> </body> </html> I changed example.xml to use the Velocity template instead of the JSP: <action name="HelloWorld" class="example.HelloWorld"> <result type="velocity">/example/HelloWorld.vm</result> </action> After restarting the webapp, I found that I was missing some libraries (notably velocity.jar and velocity-tools.jar, but also the deps for Velocity: commons-collections, commons-lang). At this point, I'm not sure what else I need. I have a currently-working webapp that has been using Velocity and velocity-tools (both v1.4) for years, and that's where I've been copying my libraries from. Here's what I currently have: ./WEB-INF/lib/struts2-core-2.1.7-SNAPSHOT.jar ./WEB-INF/lib/commons-fileupload-1.2.1.jar ./WEB-INF/lib/freemarker-2.3.13.jar ./WEB-INF/lib/commons-io-1.3.2.jar ./WEB-INF/lib/xwork-2.1.3.jar ./WEB-INF/lib/ognl-2.6.11.jar ./WEB-INF/lib/velocity-1.4.jar * ./WEB-INF/lib/velocity-tools-1.4.jar * ./WEB-INF/lib/commons-collections-3.2.jar * ./WEB-INF/lib/commons-lang-2.2.jar * ./WEB-INF/lib/commons-logging-1.1.1.jar * * - indicates that I installed the JAR myself. So, here's the problem I get. When attempting to access HelloWorld.action, I get the following exception: java.lang.NoClassDefFoundError: org/apache/log/format/Formatter org.apache.velocity.runtime.log.LogManager.createLogSystem(LogManager.java:162) org.apache.velocity.runtime.RuntimeInstance.initializeLogger(RuntimeInstance.java:553) org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:226) org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461) org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:106) Seems pretty obvious, right? Velocity needs the org.apache.log.format.Formatter class. Well, I don't have this class anywhere in my (working) project, so I'm wondering what's going on? The class in question seems to be part of Apache Avalon which is defunct. Is it possible that Struts is configuring Velocity to use a logging system that I wasn't using before? If so, how do I change that? I can see that this was partially logged as a bug in one of the s2 examples (http://issues.apache.org/struts/browse/WW-1538) but I can't understand what the resolution was. I've read http://struts.apache.org/2.0.14/docs/velocity.html but it basically says "make sure you have all the proper dependencies". It really /should/ say "you need velocity.jar and velocity-tools.jar plus all /their/ dependencies". It's not obvious at all that velocity-tools is required. Also, you don't mention any version requirements, which would be nice (are there any such requirements?). Any help would be appreciated. Thanks, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkn5ryIACgkQ9CaO5/Lv0PAedQCgjsAObpzubpHuNjOcKweBeSgV tZIAnji2QOYh0BJ5a7k8Tf0CxnG/nz+f =ttxq -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org