Peter,
Since I try to change a couple of things to make it more robust this may
be a good idea for improving the user friendliness. I will keep it in
mind and try to include this additional check (not exactly the way you
suggested).
\Daniel
PS: let me guess - you use Windows ;-)
> Peter Henderson wrote:
>
> Hi all.
>
> I have just chased my tail for 30min trying to figure out why me stuff
> wouldnt deploy...
> It turns out that i had a 'META_INF/ejb_jar.xml' instead of
> 'META-INF/ejb-jar.xml'
>
> Is adding something like the following to j2eeDeployer worth doing?
> (I dont have cvs write and i dont think you wanna give me write !! as
> i have never used CVS before this month...)
>
>
> in J2eeDeployer.java line approx 400
>
> added something like....
>
>
> // determine the file type by trying to access one of its
> possible descriptors
> Element root = null;
> URLClassLoader cl = new URLClassLoader (new URL[] {localCopy});
> String[] files = {"META-INF/ejb-jar.xml",
> "META-INF/application.xml", "WEB-INF/web.xml"};
>
> for (int i = 0; i < files.length && root == null; ++i)
> {
> try {
> root = XmlFileLoader.getDocument (cl.getResourceAsStream
> (files[i])).getDocumentElement ();
> } catch (Exception _e) {}
> }
>
> // dont need it anymore...
> cl = null;
> try
> {
> URLWizzard.deleteTree(localCopy);
> }
> catch (IOException _ioe)
> {
> // dont abort just give a note...
> log.log ("Could not delete temporary file:
> "+localCopy.getFile ());
> }
>
> if (root == null)
> {
> /********************* NEW CODE SUGGESTION
> ***************************************
> // be helpful and see it they made a typo..
> String[] incorrect_files = {"META_INF/ejb_jar.xml",
> "meta_inf/ejb-jar.xml" /* etc */ };
> for (int i = 0; i < incorrect_files.length && root == null;
> ++i) {
> try {
> root = XmlFileLoader.getDocument
> (cl.getResourceAsStream (incorrect_files[i])).getDocumentElement ();
> } catch (Exception _e) {}
> }
>
> if ( root != null ) {
> System.out.println("Found incorrect deployment descriptor
> '" + incorrect_file[i-1] + " should be (case sensitive!)
> 'META-INF/ejb-jar.xml' 'META-INF/application.xml' 'WEB-INF/web.xml'"
> );
> }
> ******************* END OF NEW CODE SUGGESTION *****************/
>
> // no descriptor was found...
> throw new J2eeDeploymentException ("No valid deployment
> descriptor was found within this URL: "+
> _downloadUrl.toString ()+
> "\nMake sure it points to a valid j2ee package
> (ejb.jar/web.war/app.ear)!");
> ....
>