Wow. This could be a major bummer. Castor was only one of several
MBean(s) where I was going to use this technique. I have other MBeans that
also needed to read their own XML files out of the .sar. I was
accomplishing this before (JBoss 2.4.x) with my DeploymentNotification
extension. I am aware of the idea that a .sar might not have any code in
it. But isn't the purpose of the:
<classpath codebase="lib" archives="castor.jar, castor-jdo-plugin.jar,
jboss-system.jar, jboss-jmx.jar, jndi.jar, xercesImpl.jar"/>
XML element to define a ClassLoader for the archive? The MBean was not
loading due to missing classes until all the appropriate .jar(s) were
listed in the above statement. I thought it would be creating a
ClassLoader for the MBean(s) and contained .jar(s). Why would it not add a
classpath to the root directory of where the .sar was expanded? Then any
resources could be loaded out of the archive.
Also, it appears I seemed to have missed a big architectural change. Where
is the directory where the .war(s), .ear(s), etc, are unpacked? Do they no
longer need to be expanded? I thought I saw code in the deployer where
they were still be unzipped? Help!! <panic setting in> Because I was
using the Deployment Info to determine the actual temporary directory the
archive was being unpacked in. From that, I was able to find the required
XML resource files for my dynamic MBeans.
Fred.
At 08:44 PM 5/19/2002, you wrote:
>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. 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
> > ("<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>")
> > 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:<br>
> > <br>
> > <font face="Courier New, Courier"> URL confUrl =
> > Thread.currentThread().getContextClassLoader().getResource( _dbConf
> > );<br>
> > <br>
> > </font>Where _dbConf is a String containing the Configuration attribute
> > with a value of
> > "<a href="file:META-INF\database.xml"
> > eudora="autourl">file:./META-INF/database.xml</a>".
> > Unfortunately, the resource is never found. <b>getSystemResource()</b>
> > also does not work. Any suggestions or comments? 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. 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.<br>
> > <br>
> > <font face="Courier New, Courier"><server><br>
> > <br>
> > <classpath codebase="lib" archives="castor.jar,
> > castor-jdo-plugin.jar, jboss-system.jar, jboss-jmx.jar, jndi.jar,
> > xercesImpl.jar"/><br>
> > <br>
> > <mbean
> > code="org.jboss.jdo.castor.CastorJDOImpl"
> > name="DefaultDomain:service=CastorJDO,name=AIAB-Common"><br>
> > <attribute
> > name="Configuration"><a href="file:META-INF\database.xml"
> > eudora="autourl">file:META-INF/database.xml</a></attribute><br>
> > <attribute
> > name="JndiName">jdo/aiabcommon</attribute><br>
> > <attribute
> > name="LockTimeout">10000</attribute><br>
> > <attribute
> > name="LoggingEnabled">true</attribute><br>
> > <attribute
> > name="CommonClassPath">false</attribute><br>
> >
> <x-tab> </x-tab><attribute
> > name="AutoStore">false</attribute><br>
> > </mbean><br>
> > <br>
> > </server><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. Any thoughts? 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
_______________________________________________________________
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