On 1/31/07, Travis Bear <[EMAIL PROTECTED]> wrote:
I upgraded my version of velocity-tools.  The the problem behavior I was
seeing was similar with the new version.  There was no NPE this time,
but the toolbox still failed to load when that one tool was configured
in.

I traced the problem back to the fact that that one offending tool was
throwing an unhandled IllegalStateException in its constructor.  When I
fixed this, the problem went away.

fixes are good.

Which leads me to this question:  Is this correct behavior by the
toolbox loader?  If I configure several tools into my toolbox, and one
of them fails to load, shouldn't the toolbox soldier on, log an error,
and go ahead and load the other components anyway?

It's debatable, to be sure.  We do validate that the tool info is
present, but we don't catch any exceptions thrown by tool init.  So,
if a tool blows up while we're loading the toolbox, then the toolbox
doesn't load.

I'll think about this.  I'm not sure i like the idea of just logging
and moving on when there's a startup error, but i'll think about it.
There may be some way to easily offer a choice of behaviors there.  If
you were to make any patches to change this, i'd definitely consider
them.


Thanks!


-Travis




On Mon, 2007-01-29 at 13:18 -0800, Nathan Bubna wrote:
> The release downloads have moved since 1.2, so the documentation with
> that release is out of date.  Downloads can now be found here:
>
> http://velocity.apache.org/download.cgi
>
> Please do upgrade first.  The toolbox manager was much improved
> between 1.1 and 1.2 and further so between 1.2 and the
> soon-to-be-released 1.3.
>
> On 1/29/07, Travis Bear <[EMAIL PROTECTED]> wrote:
> > The Digester version I was using is unclear, but I'm sure it's a year or
> > two old.  It's from before the time the version number was in the name
> > of the jar file.  I updated Digester to the current version (1.8) and
> > tried again, with basically the same results:
> >
> > Mon Jan 29 12:50:50 PST 2007  [error] Problem loading toolbox
> > '/conf/QAStoolbox.xml' : java.lang.NullPointerException
> > Mon Jan 29 12:50:50 PST 2007  [error] java.lang.NullPointerException
> >         at
> > org.apache.commons.digester.Digester.createSAXException(Digester.java:3181)
> >         at
> > org.apache.commons.digester.Digester.createSAXException(Digester.java:3207)
> >         at
> > org.apache.commons.digester.Digester.endElement(Digester.java:1225)
> >         at
> > 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
> >         at
> > 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1241)
> >         at
> > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
> > 
$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
> >         at
> > 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> >         at
> > 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> >         at
> > 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> >         at
> > 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> >         at
> > 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> >         at
> > org.apache.commons.digester.Digester.parse(Digester.java:1765)
> >         at
> > 
org.apache.velocity.tools.view.XMLToolboxManager.load(XMLToolboxManager.java:148)
> >         at
> > 
org.apache.velocity.tools.view.servlet.ServletToolboxManager.getInstance(ServletToolboxManager.java:172)
> >         at
> > 
org.apache.velocity.tools.view.servlet.VelocityViewServlet.initToolbox(VelocityViewServlet.java:231)
> >         at
> > 
org.apache.velocity.tools.view.servlet.VelocityViewServlet.init(VelocityViewServlet.java:174)
> >         at
> > 
org.apache.velocity.tools.view.servlet.VelocityLayoutServlet.init(VelocityLayoutServlet.java:147)
> >         at
> > com.myrio.qa.qas.setup.SetupServlet.init(SetupServlet.java:24)
> >         at
> > 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
> >
> >
> > My Velocity tools is on 1.1.  I see there is a link to a released 1.2
> > version of velocity tools on the Velocity website:
> >
> > http://velocity.apache.org/tools/releases/velocity-tools-1.2/index.html
> >
> > I'm willing to upgrade, but the download link is currently broken.
> >
> >
> >
> > -Travis
> >
> >
> >
> >
> > On Mon, 2007-01-29 at 12:32 -0800, Nathan Bubna wrote:
> > > what versions of VelocityTools and Digester are you using?
> > >
> > > On 1/29/07, Travis Bear <[EMAIL PROTECTED]> wrote:
> > > > Hi All!
> > > >
> > > >
> > > > I'm having a problem with the Velocity Layout Servlet failing to load
> > > > the toolbox when a certain tool is configured in.  From the sound of it,
> > > > it would seem like this would be a simple problem to fix, but I have
> > > > been looking at this for a while without finding an obvious solution.
> > > >
> > > >
> > > > Here is the toolbox xml file (conf/QAStoolbox.xml), with the offending
> > > > tool commented out:
> > > >
> > > > <?xml version="1.0"?>
> > > > <!-- toolbox for the servlet that handles the 'QAS look-and-feel'
> > > > templates -->
> > > > <toolbox>
> > > >
> > > >     <tool>
> > > >         <key>setup</key>
> > > >         <scope>request</scope>
> > > >         <class>com.myrio.qa.qas.setup.SetupUI</class>
> > > >     </tool>
> > > > <!--
> > > >     <tool>
> > > >         <key>npvr</key>
> > > >         <scope>request</scope>
> > > >         <class>com.myrio.qa.qas.npvr.NPVRUI</class>
> > > >     </tool>
> > > > -->
> > > >     <tool>
> > > >         <key>callerid</key>
> > > >         <scope>request</scope>
> > > >         <class>com.myrio.qa.qas.callerID.CallerIDUI</class>
> > > >     </tool>
> > > >
> > > >     <tool>
> > > >         <key>conapi</key>
> > > >         <scope>session</scope>
> > > >         <class>com.myrio.qa.qas.conAPI.FeederUI</class>
> > > >     </tool>
> > > >
> > > >     <tool>
> > > >         <key>wallet</key>
> > > >         <scope>request</scope>
> > > >         <class>com.myrio.qa.qas.wallet.WalletUI</class>
> > > >     </tool>
> > > >
> > > >     <tool>
> > > >         <key>params</key>
> > > >         <scope>request</scope>
> > > >
> > > > <class>org.apache.velocity.tools.view.tools.ParameterParser</class>
> > > >     </tool>
> > > >
> > > >     <tool>
> > > >         <key>map</key>
> > > >         <scope>request</scope>
> > > >         <class>java.util.HashMap</class>
> > > >     </tool>
> > > >
> > > > </toolbox>
> > > >
> > > >
> > > > With the above config file, everything is is more or less fine.   Below
> > > > is the velocity log from using the above config:
> > > >
> > > > Mon Jan 29 11:18:03 PST 2007   [info] Velocimacro : initialization
> > > > complete.
> > > > Mon Jan 29 11:18:03 PST 2007   [info] Velocity successfully started.
> > > > Mon Jan 29 11:18:03 PST 2007   [info] ServletToolboxManager: Using
> > > > config file '/conf/QAStoolbox.xml'
> > > > Mon Jan 29 11:18:03 PST 2007  [debug] XMLToolboxManager: Loading
> > > > toolbox...
> > > > Mon Jan 29 11:18:03 PST 2007  [debug] XMLToolboxManager: Toolbox loaded.
> > > > Mon Jan 29 11:18:03 PST 2007   [info] ServletToolboxManager: Toolbox
> > > > setup complete.
> > > > Mon Jan 29 11:18:03 PST 2007   [info] VelocityViewServlet: Default
> > > > content-type is: text/html
> > > > Mon Jan 29 11:18:03 PST 2007   [info] VelocityLayoutServlet: Error
> > > > screen is 'Error.vm'
> > > > Mon Jan 29 11:18:03 PST 2007   [info] VelocityLayoutServlet: Layout
> > > > directory is './'        <scope>request</scope>
> > > > Mon Jan 29 11:18:03 PST 2007   [info] VelocityLayoutServlet: Default
> > > > layout template is 'LayoutMain.vm'
> > > > Mon Jan 29 11:18:03 PST 2007   [info] VelocityViewServlet: Custom
> > > > Properties File: /conf/velocity.properties
> > > > Mon Jan 29 11:18:03 PST 2007   [info] ServletToolboxManager: Using
> > > > config file '/conf/genericToolbox.xml'
> > > > Mon Jan 29 11:18:03 PST 2007  [debug] XMLToolboxManager: Loading
> > > > toolbox...
> > > > Mon Jan 29 11:18:03 PST 2007   [warn] ServletToolboxManager: Unknown
> > > > scope 'null' - wallet will be request scoped.
> > > > Mon Jan 29 11:18:03 PST 2007   [warn] ServletToolboxManager: Unknown
> > > > scope 'null' - map will be request scoped.
> > > > Mon Jan 29 11:18:03 PST 2007  [debug] XMLToolboxManager: Toolbox loaded.
> > > > Mon Jan 29 11:18:03 PST 2007   [info] ServletToolboxManager: Toolbox
> > > > setup complete.
> > > > Mon Jan 29 11:18:03 PST 2007   [info] VelocityViewServlet: Default
> > > > content-type is: text/html
> > > >
> > > >
> > > > When I uncomment the 'npvr' tool, the toolbox fails to load, which
> > > > breaks the web app.  It's hard for me to interpret the stack trace.  It
> > > > looks like an xml parsing error, but the XML in the config file seems
> > > > fine.  The com.myrio.qa.qas.npvr.NPVRUI class is verified to be present
> > > > along with the other classes in the WEB-INF directory.  Here's the
> > > > velocity log from when the toolbox fails to load:
> > > >
> > > > Mon Jan 29 11:28:02 PST 2007   [info] Velocimacro : initialization
> > > > complete.
> > > > Mon Jan 29 11:28:02 PST 2007   [info] Velocity successfully started.
> > > > Mon Jan 29 11:28:02 PST 2007   [info] ServletToolboxManager: Using
> > > > config file '/conf/QAStoolbox.xml'
> > > > Mon Jan 29 11:28:02 PST 2007  [debug] XMLToolboxManager: Loading
> > > > toolbox...
> > > > Mon Jan 29 11:28:02 PST 2007  [error] Problem loading toolbox
> > > > '/conf/QAStoolbox.xml' : java.lang.NullPointerException
> > > > Mon Jan 29 11:28:02 PST 2007  [error] java.lang.NullPointerException
> > > >         at
> > > > 
org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
> > > >         at
> > > > 
org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
> > > >         at
> > > > org.apache.commons.digester.Digester.endElement(Digester.java:1061)
> > > >         at
> > > > 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
> > > >         at
> > > > 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1241)
> > > >         at
> > > > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
> > > > 
$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
> > > >         at
> > > > 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> > > >         at
> > > > 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> > > >         at
> > > > 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> > > >         at
> > > > 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> > > >         at
> > > > 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> > > >         at
> > > > org.apache.commons.digester.Digester.parse(Digester.java:1567)
> > > >         at
> > > > 
org.apache.velocity.tools.view.XMLToolboxManager.load(XMLToolboxManager.java:148)
> > > >         at
> > > > 
org.apache.velocity.tools.view.servlet.ServletToolboxManager.getInstance(ServletToolboxManager.java:172)
> > > >         at
> > > > 
org.apache.velocity.tools.view.servlet.VelocityViewServlet.initToolbox(VelocityViewServlet.java:231)
> > > >         at
> > > > 
org.apache.velocity.tools.view.servlet.VelocityViewServlet.init(VelocityViewServlet.java:174)
> > > >         at
> > > > 
org.apache.velocity.tools.view.servlet.VelocityLayoutServlet.init(VelocityLayoutServlet.java:147)
> > > >         at
> > > > com.myrio.qa.qas.setup.SetupServlet.init(SetupServlet.java:24)
> > > >         at
> > > > 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
> > > >         at
> > > > org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
> > > >         at
> > > > 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
> > > >         at
> > > > 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
> > > >         at
> > > > 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
> > > >         at
> > > > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
> > > >         at
> > > > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
> > > >         at
> > > > org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
> > > >         at
> > > > org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
> > > >         at
> > > > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
> > > >         at
> > > > org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
> > > >         at
> > > > 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
> > > >         at
> > > > 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> > > >         at
> > > > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
> > > >         at
> > > > org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
> > > >         at
> > > > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
> > > >         at
> > > > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
> > > >         at
> > > > org.apache.catalina.core.StandardService.start(StandardService.java:450)
> > > >         at
> > > > org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
> > > >         at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
> > > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > >         at
> > > > 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > >         at
> > > > 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > >         at java.lang.reflect.Method.invoke(Method.java:585)
> > > >         at
> > > > org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
> > > >         at
> > > > org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
> > > >
> > > >
> > > > Any suggestions appreciated.
> > > >
> > > >
> > > > Thanks!
> > > >
> > > >
> > > > -Travis
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > 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]
> > >
> > >
> > >
> > > _________________________________________________
> > > Scanned on 29 Jan 2007 20:34:53
> > > Scanned by Erado
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
>
> _________________________________________________
> Scanned on 29 Jan 2007 21:20:24
> Scanned by Erado

---------------------------------------------------------------------
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]

Reply via email to