-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jeff Turner wrote: <snip> | | I think you can typecast your context into a BlockContext, and then use | getBaseDirectory(). |
Thanks that's what I was looking for. | | I used RMI, and the app used Cornerstone's rmification block to register | itself. 'twas pretty easy. | Yup, but the java startup time is main speed factor - If I've written Java client it'd be again slowed by Java startup time - so why bother ? Just run Ant standalone :-) I've chosen Python because of it's simplicity (writing client took me just few minutes), and portability (I'm *nix animal, so this was the safest choice for me to assure Win* compatibility - or at least minimum tweaking if something went wrong). | |>I'd like to be able to define ant home directory in configuration file |>(SAR-INF/config.xml), then build appropriate class loader to include |>all <ant-home>/lib/*.jar archives, and run special ant wrapper (because |>'org.apache.tools.ant.Main' class is not suitable for this purpose - it |>uses System.exit()). | | | I gave up trying to embed Ant and set a security manager to catch the | System.exit(). There's one in Ant, | /src/main/org/apache/tools/ant/util/optional/NoExitSecurityManager, and | at [1]. | I've considered this solution, but decided it's not very elegant. However it'll probably go this way... | |>However I can't simply include wrapper in my app library |>(SAR/lib/anserver.jar), because Phoenix class loader can't find any Ant |>classes directly referenced by my wrapper (so CNFE is thrown). |>So I want to package wrapper inside different JAR archive, placed |>outside of SAR-INF/lib directory and construct new classloader that |>would include this new jar + all ant libraries - this way I'd be able |>to use my wrapper (inside ConnectionHandler) without CNFE, and without |>including all ant libraries inside SAR file. | | | What's wrong with just dumping the wrapper, plus everthing from | $ANT_HOME/lib into SAR-INF/lib? That's what I did. | | If you want Ant jars outside of the .sar, then your sar won't be | portable. If you want Ant jars inside the .sar, what's wrong with | SAR-INF/lib? | | You're probably right. I've wanted to make Ant location configurable (so ~ user could just point to already configured, production Ant installation and use it). This way you can have multiple (different) ant installations and just switch between them by changing signle config entry. But I'm starting to think it's probably overdesign. Now, assuming that I *want* to make Ant location configurable and *not* ~ include it's libraries in SAR-INF/lib, here's classloading situation inside ConnectionHandler: [Primodial] <- ... <- [Phoenix:SAR-INF/lib/*.jar] As you can see Ant's libraries are not accessible. So if I put my wrapper in SAR-INF/lib it'll be loaded thru phoenix classloader, and so will all classes that it references (here Ant's classes). And because they are inaccessible CNFE is thrown. So what's the resolution ? Of course we build our own classloader :-): [Primodial]<-...<-[Phoenix:SAR-INF/lib/*.jar]<-[Ant:/ant/home/lib/*.jar] But this does not solve the problem - if wrapper is loaded thru phoenix class loader it still won't see Ant's libraries - so it have to be loaded thru the same classloader that Ant libraries are. No problem with packing wrapper in different archive, no problem with constructing appropriate URLClassLoader - problem is (was) how to acces arbitrary file placed in arbitrary location of SAR archive. But thanks to Peter Donald's info now I know that Phoenix unpacks everything to 'context.getBaseDirectory()' so it's trivial to access once you obtain base directory :-) Sorry for a bit too long off-topic explanation, but I just wanted to make it clear. Thx for your help and for your time. Scooter. BTW. Would Avalon team be interested in including such app in jakarta-avalon-apps repository ? - -- Tomasz Skutnik, R&D Director, www.e-point.pl tel +48 (22) 853 48 30, mob +48 501 555 705, fax +48 (22) 853 48 30 e-point S.A., ul. Filona 16, 02-658 Warsaw, Poland PGP/GPG public key: http://scooter.ext.e-point.pl/tomasz.skutnik.gpg -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE9Y5MRKoVCme/JcTgRAkM0AJ9AKRLUGaBMWdztL1BG108YZnQVowCdEyii jNv+wuZJkya0BFxqxQV0T1s= =9LMG -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>