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]

Reply via email to