What is the structure of the sar? Does it contain
just the jboss-service.xml
descriptor along with the resource
files?
xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology
Officer JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx
----- Original Message -----
Sent: Sunday, May 19, 2002 4:33 PM
Subject: [JBoss-dev] Castor MBean in a
JBoss 3.0 .sar
I've been trying to update some of my app design and code from
JBoss 2.4.x to 3.0 and the new .sar approach. I need to specify the
Castor MBean inside a .sar. One issue that I've run into is the need to
convert the relative path of the CastorJDOImpl MBean's Configuration attribute
("file:./META-INF/database.xml") to a fully
specified, non-relative path (URI). This appears to be a design
limitation of Xerces. So the idea is to use the class loader for the
MBean which should be [???] created to reference the location of the expanded
.sar, no? The following was inserted into the CastorJDOImpl.java
MBean:
URL confUrl =
Thread.currentThread().getContextClassLoader().getResource( _dbConf
);
Where _dbConf is a String containing the Configuration
attribute with a value of "file:./META-INF/database.xml". Unfortunately, the
resource is never found. getSystemResource() also does not work.
Any suggestions or comments? Help, please.
As an aside, I found
that the castor-jdo-plugin.jar build was commented out with a note that it
needed to be a .sar. That is not necessarily a requirement. To
support independent deployable application archives that would have different
tables and objects they were mapped to, Castor requires a separate
database.xml and mapping.xml for each one. So the thought is a Castor
MBean, along with a database.xml and mapping.xml file would be bundled in a
.sar along with any EJBs and their respective .jars. The
castor-jdo-plugin.jar would be copied into the jboss/lib directory along with
castor.jar. Then the jboss-service.xml could specify both (as depicted
below) to reference the required archives, and initialize an instance of the
CastorJDOImpl MBean with a different database.xml and mapping.xml for
each. Now I don't know if there are any other weird issues preventing
this, but I looked at the Castor code last year and it seemed to support
multiple databases.
<server>
<classpath
codebase="lib" archives="castor.jar, castor-jdo-plugin.jar, jboss-system.jar,
jboss-jmx.jar, jndi.jar, xercesImpl.jar"/>
<mbean
code="org.jboss.jdo.castor.CastorJDOImpl"
name="DefaultDomain:service=CastorJDO,name=AIAB-Common">
<attribute name="Configuration">file:META-INF/database.xml</attribute>
<attribute
name="JndiName">jdo/aiabcommon</attribute>
<attribute
name="LockTimeout">10000</attribute>
<attribute
name="LoggingEnabled">true</attribute>
<attribute
name="CommonClassPath">false</attribute> <attribute
name="AutoStore">false</attribute>
</mbean>
</server>
Oleg Nitz is the author of
the Castor MBean, and if he and no one else minds, and if I can figure out how
to get it to work, I'd like to make the modifications. Any
thoughts? Thank you again for the help.
Fred.
|