1 Reply Latest reply on Oct 15, 2002 4:59 PM by Michael Zach

    How to setup castor in JBoss?

    Carfield Yim Newbie

      I have done some web-search and read the example at http://www.jboss.org/developers/projects/jboss/castor.jsp

      However, seem most example and build on jboss 2.x and config the file jboss.jcml. How can I setup castor at jboss 3.0?

        • 1. Re: How to setup castor in JBoss?
          Michael Zach Newbie

          Carfield,

          I am a novice to jboss AND castor I must tell you in the very beginning. But as I am trying to get JBoss 3.0.3 and CastorJDO running, I was hacking around and also read the whole 2.4.X crap concerning Castor. I then did the way described below, but now I am halted by an IllegalAccessError thrown by the classloader when I use the most recent castor jar , and a MappingException when I use the castor.jar JBoss comes with.

          But maybe I can give you some hint to get at least as far as I did up till now:

          1) copy castor.jar and castor-jdo-plugin.jar into the server/default/lib directory

          2) copy castor-jdo-service.xml into server/default/deploy

          my castor-jdo-service.xml looks like this:

          <?xml version="1.0" encoding="UTF-8"?>
          <!-- The service configuration for the embedded CastorJDO -->


          <!-- database.xml file path must be relative to jboss/bin ??? -->
          ../server/default/conf/castor-jdo-database.xml
          jdo/maudb
          0
          false
          false
          false
          true



          3) use the two castor files database.xml and mapping.xml and put them into server/default/conf

          I have renamed these two files giving them a "castor-jdo-" prefix :

          my castor-jdo-database.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <!-- CastorJDO configuration , database.xml -->





          my castor-jdo-mapping.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <!-- CastorJDO mapping file , mapping.xml -->
          <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.exolab.org/mapping.dtd">


          test
          <map-to table="test" xml="test" />






          4) now you should be able to access the JDO as java:/jdo/maudb exactly the way as described in the JBoss 2.4.x stuff .

          Well as I already said I then get one of these two Errors, and I cannot guarantee if this is from my (dirty)hack or a problem of the jboss/castojdo integration.

          What I also did not fully understand was if it is possible to have the castor configuration individually with each deployment included in the ear file, or if there may only be one global configuration as I did it.

          I hope what I was writing here is not total sh*t , please don't flame me should this be the case, just tell me (and the others) how to do it better ;-)

          Michael