Ok thanks for the hint ... I just forgot to copy the necessary bsf libs into the lib directory.
Once again, thanks for your quick help! Greets Markus > -----Original Message----- > From: Nathan Bubna [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 03, 2007 9:48 PM > To: Velocity Users List > Subject: Re: VVS & BSF & tomcat > > Hmm. Our ant scripts are pretty tailored to our example apps. Still, > i assume that means you are deploying the app as a WAR. If you open > up the WAR that is created, you should be able to look in the > WEB-INF/lib and/or WEB-INF/classes directories in order to ensure that > the necessary dependencies (i.e. BSF libs and the Guestbook class) are > available to Tomcat. > > On 1/3/07, Markus Auchmann <[EMAIL PROTECTED]> wrote: > > I deploy the webapp using the ant script provided in your examples. The > > (funny) thing is when I replace the BSF code with whatever I want > everything > > works out fine. So normally when the newEntry method prints the values > the > > guestbook class is visible to tomcat. > > > > > -----Original Message----- > > > From: Nathan Bubna [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, January 03, 2007 5:05 PM > > > To: Velocity Users List > > > Subject: Re: VVS & BSF & tomcat > > > > > > This doesn't appear to have anything to do with BSF. It just looks > > > like your "Guestbook" class is not visible to the application when > > > running in Tomcat. > > > > > > How are you deploying the app to Tomcat? Is your Guestbook class in a > > > jar? If so, is that jar getting put in the webapp's WEB-INF/lib > > > folder? > > > > > > On 1/3/07, Markus Auchmann <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > > > > > I have a problem when I try to invoke BSF from java using the > velocity > > > view > > > > servlet. When I compile my java file everything works fine and when > I > > > try to > > > > invoke BSF from velocity without the use of the servlet it also > works. > > > > > > > > But when I add this code (using VVS & tomcat) I get an error when > > > starting > > > > tomcat. > > > > > > > > Code: > > > > ############################# > > > > public void newEntry(String name, String mail, String homepage, > String > > > text) > > > > throws IOException { > > > > try { > > > > BSFManager mgr = new BSFManager (); > > > > BSFEngine rexxViaBSF = mgr.loadScriptingEngine("rexx"); > > > > > > > > Vector vArgs = new Vector(); > > > > > > > > vArgs.addElement( new String(name)); > > > > vArgs.addElement( new String(homepage)); > > > > vArgs.addElement( new String(mail)); > > > > vArgs.addElement( new String(text)); > > > > > > > > String script = new String(); > > > > > > > > try { > > > > FileReader in = new FileReader ("insert.rex"); > > > > script = IOUtils.getStringFromReader (in); > > > > > > > > } catch (IOException x) { > > > > System.out.println("Error: "+x); > > > > } > > > > > > > > rexxViaBSF.apply (null, 0, 0, script, null, vArgs); > > > > } > > > > catch (BSFException e) > > > > { > > > > e.printStackTrace(); > > > > } > > > > } > > > > ############################# > > > > > > > > Error from Tomcat: > > > > ############################# > > > > Problem loading toolbox '/WEB-INF/toolbox.xml' : > > > > java.lang.reflect.InvocationTargetException > > > > > > > > org.apache.velocity.tools.view.servlet.ServletToolboxManager > getInstance > > > > > > > > [...] > > > > > > > > SCHWERWIEGEND: End event threw exception > > > > java.lang.reflect.InvocationTargetException > > > > > > > > [...] > > > > > > > > SCHWERWIEGEND: Problem loading toolbox '/WEB-INF/toolbox.xml' : > > > > java.lang.ClassNOtFoundException: Guestbook > > > > ############################# > > > > > > > > My toolbox.xml looks like this: > > > > ############################# > > > > <?xml version="1.0"?> > > > > <toolbox> > > > > <xhtml>true</xhtml> > > > > <tool> > > > > <key>guestbook</key> > > > > <scope>request</scope> > > > > <class>Guestbook</class> > > > > </tool> > > > > <tool> > > > > <key>params</key> > > > > <scope>request</scope> > > > > > <class>org.apache.velocity.tools.view.tools.ParameterParser</class> > > > > </tool> > > > > <data type="string"> > > > > <key>welcome</key> > > > > <value>Willkommen Velbook</value> > > > > </data> > > > > <tool> > > > > <key>date</key> > > > > <scope>application</scope> > > > > <class>org.apache.velocity.tools.generic.DateTool</class> > > > > </tool> > > > > </toolbox> > > > > ############################# > > > > > > > > As I said, when I delete this code tomcat starts up fine and the > servlet > > > is > > > > working. Do I have to add something to my toolbox, as tomcat says > that > > > he > > > > has problems with it. > > > > > > > > Thanks for any help! > > > > > > > > Greets, > > > > Markus > > > > > > > > > > > > -------------------------------------------------------------------- > - > > > > 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] > > > > > > --------------------------------------------------------------------- > 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]
