Wrox Programmer Forums
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 22nd, 2005, 03:43 AM
Registered User
Join Date: Nov 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Castor & Tomcat

I can get Castor to work with jdk1.5.0 & Tomcat4.1.24, but not with Tomcat5.5.9. I have included the commons-logging.jar in my context, but to no avail. The behaviour is to exit the try block without completing it, but not entering the catch block. I am using castor0.9.6-xml.jar. Any ideas?

The run() method of the following class works when called within Tomcat4.1.24, but not Tomcat5.5.9.

 * Has the following on the classpath
 * castor-0.9.6-xml.jar
 * commons-logging.jar;
import java.io.*;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.mapping.Mapping;
import org.exolab.castor.mapping.MappingException;
import org.exolab.castor.tools.MappingTool;
import org.xml.sax.InputSource;

public class Test
  private String field1 = "value of field1";
  private String field2 = "another value";

  public Test()

  public static void run()
      String mapName = "C:" + File.separator + "TestMap.xml";
      Mapping mapping = new Mapping();

        System.out.println("About to create new MappingTool()");
        MappingTool mt = new MappingTool();
        System.out.println("About to addClass()");
        mt.addClass(Test.class, true);
        System.out.println("About to write()");
        mt.write(new FileWriter(mapName));
      catch (Exception e)
        System.out.println("Error writing map file: " + mapName);

  public static void main(String[] args)
    System.out.println("Pre run()");
    System.out.println("post run()");

  public void setField1(String field1)
    this.field1 = field1;

  public void setField2(String field2)
    this.field2 = field2;
  public String getField1()
    return (this.field1);

  public String getField2()
    return (this.field2);

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat & Static IP saeedmoradpour Apache Tomcat 2 January 23rd, 2009 04:20 PM
jsp & tomcat aruna_k_2006 JSP Basics 1 March 23rd, 2007 07:16 AM
Tomcat & SSL emctcs Apache Tomcat 0 February 13th, 2007 08:59 AM
Clustering Apache 2 & Tomcat 5 with mod_jk2 blaufenberg BOOK: Professional Apache Tomcat 0 November 23rd, 2004 06:23 PM
J2EE & tomcat,how do I set it up? 12345dela J2EE 1 January 2nd, 2004 06:18 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.