I worked around this problem with my database.xml and mappings.xml by setting up an initializer servlet that loads first in my servlet context that uses the servletContext.getResource() method to pass out a URL. In Tomcat this resolves to something like "jndi:/WEB-INF/classes", but it should work with any application server to provide a URL object to the proper files, when you can then call .toExternalForm() on when initializing castor.

As to access control exceptions, you should look at the security context your servlet engine is running in. Generally Tomcat 4.1.X and WebLogic 6+ (that I know about) reset the security context for each application to only have access to it's deployment directory. Any attempt to read or write outside of that will throw and access exception no matter what the user-level permission on the folder are.

Robert Kent wrote:
I have discovered some details of the problem; I was finally able to get exceptions and stacktraces printing correctly.
Originally, the problem was that the mapping.xml file wasn't found, so I supplied an absolute path and that eliminated that error. Is there a better way to do this, a standard place in the directory structure where mapping.xml and database.xml can be placed?
Now, I'm having a similar problem with castor.properties. The bean wants this file to be located in the java lib directory, specifically
/usr/java/j2sdk1.4.0_02/jre/lib/castor.properties . So I placed it there, turned a+r on , and it still throws an AccessControlException ("access denied") trying to read the file.
I realize that java's read permissions are beyond the purview of the Castor-dev list, but I'm wondering if there's not a more standardized setup I should be following.

Thanks for any help,
Rob Kent

Robert Kent writes:


I'm having trouble getting Castor to work in a JSP environment. I built a class that ran acceptably from the command line (ShopTest), and modified it, primarily by eliminating the main() method, and renamed to ShopBean. I then moved the associated files into my web applications directory, in thsi case /var/www/ora. Here's my setup: /var/www/ora/WEB-INF
- contains the database.xml and mapping.xml /var/www/ora/WEB-INF/classes
- contains the ShopBean.class and com/rjkcomm
tree containing my package (of 1 more class). /var/www/ora/rob/
- contains shop.jsp, which is as follows: shop.jsp:
<%@ page import = "ShopBean" %>
<jsp:useBean id="shop" class="ShopBean" scope="page">
<jsp:SetProperty name="shop" property="*"/>
</jsp:useBean>
<!-- the only references to this bean below this point are
jsp:getProperty actions --> The XML files and non-bean class (just the bean + a main function) work fine, so it doesn't seem like there'd be anything wrong with them. But I can post them if that info would help. The error thrown is very general; it's the HandlePageException at the bottom of the generated shop$jsp.java file. No Castor-specific info is shown in the stack trace. I think what I need is some general help on integrating Castor with a JSP setup. Oh! I'm also not sure about where the castor JAR file needs to go; I tried copying it to the $CATALINA_HOME/common/lib directory in case the jdk classpath wasn't enough, but that didn't help. Incidentally, I'd be glad to put up a page describing how to do this "easy" stuff if I get it working correctly, since there doesn't seem to be a collection of Castor + JSP information readily available. Of course, I'm quite new to Castor, so take that for what it's worth.
Thanks for any help,
_________________________________ Robert Kent - (617) 413-3510
http://www.rjk-comm.com/
_________________________________ ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev



_________________________________
Robert Kent - (617) 413-3510
http://www.rjk-comm.com/
_________________________________
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
--
 : cooper
 : temple of the screaming penguin
 : source does matter
 : aim: kebernet msn:[EMAIL PROTECTED]
 : yahoo: kebernet icq: 5244128
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.0 (MingW32)

mQGiBD2vXB0RBACfIUtHRmGAYcE+2fCG5buthGlwQEr1lwgZc5S8kxshaUEQdyzU
+J+uGwrYX2mdnmTqfO7nw7uTN408qnBdQCLrjEI2mTX+WwsGl/j4Ann4CkGS8Xua
sW/lmzOatcfRuNy0NMsVuPOeW95PErCmvI74OQhxCkXyhUAPqMTMgj213wCg6RHh
oSzKueO1OvV1N53BXiEP5xcD/1aboRWaMSAdistCRQ8Jv2Bey2Vs8d0NKInfOtxI
TRskg/eO0ndK8Or3Yws/CS+tMY7sab+F6aVZFfJ0PpyCFyQxFFPTbY94tc5t6NZO
EAqHY6ExoxI/bOGcLyuH2trd2s48ev8WJTYBBOD6x8DiWIdUXR1k07NMCzaZT1xL
EuJ6BACPtrgbEHbLpCzA/udH7i7QuGNa9rme4T+0eS0Q13ueU3IZrJQmjTlG+lB2
yK1F6LyJXugxoqcz9OqD+RZS8sEBtdal7+IRzUwU6TvqqCl6z2JMUBrZS9AcioNv
FgYol6CBIhhV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