ah. yeah, that would do it. glad you figured it out! On Dec 3, 2007 1:18 AM, Holý Matej <[EMAIL PROTECTED]> wrote: > Thank you for your reply. The problem was that I was missing the > 'load-on-startup' parameter for both Struts and Velocity in my web.xml file. > > -----Original Message----- > From: Nathan Bubna [mailto:[EMAIL PROTECTED] > Sent: Sunday, December 02, 2007 6:00 AM > To: Velocity Users List > Subject: Re: InvocationTargetException when using MessageTool > > On Nov 29, 2007 8:10 AM, Holý Matej <[EMAIL PROTECTED]> wrote: > > Hello, > > after adding the MessageTool to the velocity toolbox, I get the following > > error when displaying the welcome page of my web for the first time. > > The tools itself seems to work without any problems, it's just this error > > that keeps showing in the console. > > > > [#|2007-11-29T16:45:17.547+0100|SEVERE|sun-appserver9.1|org.apache.vel > > ocity.tools.view.ViewToolInfo|_ThreadID=17;_ThreadName=httpSSLWorkerTh > > read-8080-1;_RequestID=39b8d3a4-bff7-4d6b-966c-5305a0f396dc;|Exception > > when calling init(Object) on > > [EMAIL PROTECTED] > > java.lang.reflect.InvocationTargetException > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j > > ava:39) at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess > > orImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) > > at > > org.apache.velocity.tools.view.ViewToolInfo.getInstance(ViewToolInfo.j > > ava:229) at > > org.apache.velocity.tools.view.servlet.ServletToolboxManager.getToolbo > > x(ServletToolboxManager.java:416) at > > org.apache.velocity.tools.view.servlet.VelocityViewServlet.createConte > > xt(VelocityViewServlet.java:614) at > > org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(V > > elocityViewServlet.java:537) at > > org.apache.velocity.tools.view.servlet.VelocityViewServlet.doGet(Veloc > > ityViewServlet.java:509) at > > javax.servlet.http.HttpServlet.service(HttpServlet.java:718) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) > > at > > org.apache.catalina.core.ApplicationFilterChain.servletService(Applica > > tionFilterChain.java:411) at > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa > > lve.java:290) at > > org.apache.catalina.core.StandardContextValve.invokeInternal(StandardC > > ontextValve.java:271) at > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa > > lve.java:202) at > > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.ja > > va:632) at > > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.ja > > va:577) at > > com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) > > at > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja > > va:206) at > > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.ja > > va:632) at > > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.ja > > va:577) at > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java > > :571) at > > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) > > at > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv > > e.java:150) at > > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.ja > > va:632) at > > org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.ja > > va:577) at > > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java > > :571) at > > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) > > at > > org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270 > > ) at > > com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAd > > apter(DefaultProcessorTask.java:637) > > at > > com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProces > > s(DefaultProcessorTask.java:568) at > > com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process( > > DefaultProcessorTask.java:813) at > > com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProces > > sorTask(DefaultReadTask.java:339) at > > com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(Defaul > > tReadTask.java:261) at > > com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(Defaul > > tReadTask.java:212) at > > com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask( > > PortUnificationPipeline.java:361) at > > com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:26 > > 5) at > > com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWo > > rkerThread.java:106) Caused by: java.lang.NullPointerException at > > org.apache.velocity.tools.struts.StrutsUtils.getMessageResources(Strut > > sUtils.java:79) at > > org.apache.velocity.tools.struts.MessageResourcesTool.init(MessageReso > > urcesTool.java:64) > > ... 38 more > > |#] > > > > > > Content of the toolbox.xml: > > > > <?xml version="1.0"?> > > <toolbox> > > <tool> > > <key>link</key> > > <scope>request</scope> > > <class>org.apache.velocity.tools.struts.StrutsLinkTool</class> > > </tool> > > > > <tool> > > <key>text</key> > > <scope>request</scope> > > <class>org.apache.velocity.tools.struts.MessageTool</class> > > </tool> > > > > <tool> > > <key>form</key> > > <scope>request</scope> > > <class>org.apache.velocity.tools.struts.FormTool</class> > > </tool> > > > > <tool> > > <key>render</key> > > <scope>request</scope> > > <class>org.apache.velocity.tools.view.tools.ViewRenderTool</class> > > </tool> > > > > <tool> > > <key>pager</key> > > <scope>request</scope> > > <class>xxxx.PagerTool</class> --this is a custom pager tool extending > > the AbstractPager > > </tool> > > </toolbox> > > > > I also have 2 message-resources files specified in the struts-config.xml: > > <message-resources key="global" parameter="xxxx.GlobalResources" /> > > <message-resources key="local" > > parameter="xxxx.modules.xxxx.RecipientsResources" /> > > > > I'm using Eclipse and Glassfish V2 server for development, velocity tools > > v1.4 and have all the commons-, struts- and velocity- .jar files in my lib > > directory (copied directly from the velocity-tools-1.4.zip file downloaded > > from the velocity site). > > > > Do you know why this happens and what can I do about it? > > well, from looking at the code, it's either a null Struts ModuleConfig or a > null ServletContext. i'm guessing it is unlikely that your ServletContext is > null at that point :), so it would appear to be some problem with your struts > configuration that VelocityStruts isn't handling all that well. > > what version of struts are you using? can you share any of your struts > config? i'm not really a struts expert, but i could take a look. > > you could also try asking on the [EMAIL PROTECTED] list. someone there might > spot the problem quicker than me. > > > Thanks. > > > > Matej > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
