I don't think you are going to be able to use a classloader to try to find
something in the "same" deployment unit as a mbean config snippet. For
instance, the mbean could be created in code rather than from a .sar, or
created in a standalone xml file.

I think you will either have to provide another means of locating the
database.xml etc such as naming the deployment unit it is in or incorporate
the contents into your mbean configuration directly as xml element valued
attributes.

Another possibility might be to make a CastorDeployer that could deploy
.jar files containing META-INF/database.xml and mapping.xml files.

In a somewhat different direction, Matthew Baird was working on jca-ifying
the OJB project, and seemed to have gotten pretty far.  This might provide
an alternate deployment mechanism.  He had several posts on the jca forum.

david jencks

On 2002.05.19 19:33:34 -0400 Frederick N. Brier wrote:
> 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.
> <html>
> 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.&nbsp; I need to specify the
> Castor MBean inside a .sar.&nbsp; One issue that I've run into is the
> need to convert the relative path of the CastorJDOImpl MBean's
> Configuration attribute
> (&quot;<a href="file:META-INF\database.xml"
> eudora="autourl">file:./META-INF/database.</a><a
> href="file:META-INF\database.xml" eudora="autourl">xml</a>&quot;)
> to a fully specified, non-relative path (URI).&nbsp; This appears to be a
> design limitation of Xerces.&nbsp; 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?&nbsp; The following was inserted into the
> CastorJDOImpl.java MBean:<br>
> <br>
> <font face="Courier New, Courier">&nbsp;&nbsp; URL confUrl =
> Thread.currentThread().getContextClassLoader().getResource( _dbConf
> );<br>
> <br>
> </font>Where _dbConf is a String containing the Configuration attribute
> with a value of
> &quot;<a href="file:META-INF\database.xml"
> eudora="autourl">file:./META-INF/database.xml</a>&quot;.&nbsp;
> Unfortunately, the resource is never found. <b>getSystemResource()</b>
> also does not work.&nbsp; Any suggestions or comments?&nbsp; Help,
> please.<br>
> <br>
> 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.&nbsp; That is not
> necessarily a requirement.&nbsp; 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.&nbsp; 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.&nbsp; The castor-jdo-plugin.jar
> would be copied into the jboss/lib directory along with castor.jar.&nbsp;
> 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.&nbsp; 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.<br>
> <br>
> <font face="Courier New, Courier">&lt;server&gt;<br>
> <br>
> &nbsp; &lt;classpath codebase=&quot;lib&quot; archives=&quot;castor.jar,
> castor-jdo-plugin.jar, jboss-system.jar, jboss-jmx.jar, jndi.jar,
> xercesImpl.jar&quot;/&gt;<br>
> <br>
> &nbsp; &lt;mbean
> code=&quot;org.jboss.jdo.castor.CastorJDOImpl&quot;&nbsp;
> name=&quot;DefaultDomain:service=CastorJDO,name=AIAB-Common&quot;&gt;<br>
> &nbsp;&nbsp;&nbsp; &lt;attribute
> name=&quot;Configuration&quot;&gt;<a href="file:META-INF\database.xml"
> eudora="autourl">file:META-INF/database.xml</a>&lt;/attribute&gt;<br>
> &nbsp;&nbsp;&nbsp; &lt;attribute
> name=&quot;JndiName&quot;&gt;jdo/aiabcommon&lt;/attribute&gt;<br>
> &nbsp;&nbsp;&nbsp; &lt;attribute
> name=&quot;LockTimeout&quot;&gt;10000&lt;/attribute&gt;<br>
> &nbsp;&nbsp;&nbsp; &lt;attribute
> name=&quot;LoggingEnabled&quot;&gt;true&lt;/attribute&gt;<br>
> &nbsp;&nbsp;&nbsp; &lt;attribute
> name=&quot;CommonClassPath&quot;&gt;false&lt;/attribute&gt;<br>
> <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&lt;attribute
> name=&quot;AutoStore&quot;&gt;false&lt;/attribute&gt;<br>
> &nbsp; &lt;/mbean&gt;<br>
> <br>
> &lt;/server&gt;<br>
> <br>
> </font>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.&nbsp; Any thoughts?&nbsp; Thank you again for the
> help.<br>
> <br>
> Fred.</html>
> 

_______________________________________________________________
Hundreds of nodes, one monster rendering program.
Now that's a super model! Visit http://clustering.foundries.sf.net/

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to