This one time, at band camp, tek1 said:
t>After struggling for what seems an eternity to get my web app working with t>StatelessSessionBeans, which in turn call Castor via the CastorJDO in JNDI, t>is CastorJDO the best approach in a J2EE app? t> t>In order to get everything working correctly, I had to put the: t> t> 1. project-entities.jar (POJOs that Castor uses) in server/default/lib, t> 2. database.xml in server/default/conf, and t> 3. mapping.xml in server/default/conf t> 4. project-ejb.ear in server/default/deploy t> 5. project-web.war in server/default/deploy t> --- t> 6. castorJdoMBean.jar in server/default/lib t> 7. castor-0.9.4.3.jar in server/default/lib t> t> t>Is this how it should be done? t> t>I envisioned simply having only #4 and #5 (with #4 containing #1-3), and t>dropping them in the server/default/deploy directory to run the application. t> t>Would a better approach be to just have #4 and #5, and within #4, have a t>static class that looks up the JDO instance in JNDI, and if it doesn't t>exist, create it and place it in JNDI (rather than have the CastorJDO MBean t>do it)? t> t>This approach would seem to allow for better app management and deployment. t> t>Any advice from the Castor+JBoss experts out there?
I am in agreement with you that you should be able to just use #4 and #5in the list above. The castorJdoMbean.jar should probably be the only thing that needs to reside in server/default/lib. I know that JBoss is distributed with an older version of Castor in one of the lib directories and that can just be removed. I may be wrong (it's been a while since I've used JBoss/Castor), but I think that the Castor jar can either be placed in the .ear/.war file or in server/default/lib. Because you're using a .war and a .ear, it would be a better idea to place it in server/default/lib because then both archives can use it from there - no duplicate jars.
About the castorJdoMBean.jar, this is a JMX MBean that places the Castor JDO instance in a JNDI ENC for you so that Castor is started up with JBoss. IMO, I would use it rather than trying to worry about putting the JDO instance in a JNDI ENC myself.
Bruce
Thanks for your feedback, Bruce.
I agree with keeping the castor-0.9.4.3.jar in server/default/lib. Perhaps the only concern would be different applications in server/default/deploy using different versions of Castor. However, keeping a single castor-x.x.x.x.jar in server/default/lib for encourage all applications using the latest version of Castor...
Regarding the CastorJDOMBean.jar, I like it, but it requires that the database.xml and mapping.xml for projects to go in server/default/conf and project-entities.jar in server/default/lib (because of JBoss' classloading mechanism). If database.xml, mapping.xml, and project-entities.jar are all placed in project-ejb.ear in /server/default/deploy, then the CastorJDOMBean can't access those 3 project-specific files...
Rather than using the CastorJDOMBean, what do you think about creating a CastorJDO (singleton), to be deployed inside project-ejb.ear, that performs the same lookup/register JNDI functions as CastorJDOMBean? That way the castor *.xml files and project-entities.jar can all be included in the project-ejb.ear.
However, I'm wondering under what situations would it be beneficial or absolutely necessary to be able to manage the JDO instance via the MBean/JMX console, and if it really matters if whether the MBean puts the JDO instance in JNDI or the project-application does it?
Thanks again.
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev