The following comment has been added to this issue:

     Author: Hes Siemelink
    Created: Wed, 11 Aug 2004 3:52 AM
       Body:
I did some investigations and found a possible bug in Phoenix.

First a recap.

James 2.2.0 does not run with the default configuration file if installed in a 
directory path that contains spaces, like "C:\Program Files".

Steve Brewin explained why:

> According to RFC 2396 "Uniform Resource Identifiers (URI): Generic 
> Syntax", section 2.4.3 "Excluded ASCII Characters", "The space character is 
> excluded". Elsewhere it explains how a relative path, such as 
> "../conf/james-fetchmail.xml" is resolved by deducing the absolute path, 
> which will include the excluded space character and therefore constitutes 
> a Malformed URI and hence a Malformed URL. Thus, the thrown 
> MalformedURLException is correct.

[...]

> It is true that a URL can use %20 to escape spaces, thus a fully qualified 
> URL such as "file:///c:/Program%20Files/whatever%20%you%20want" will 
> work.

So the question remains, why the absolute path of the file 'config.xml' is interpreted 
as an URI without being properly encoded.

I dug into the Phoenix source and found the following. The class 
org.apache.avalon.phoenix.components.deployer.installer.Installer takes care of 
loading config.xml.

(SVN link: 
http://svn.apache.org/repos/asf/avalon/tags/Phoenix_4_0_3/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer/Installer.java)

To get the URI of the filename, the following call is used:

            final String config = getURLAsString( new File( directory, FS_CONFIG_XML ) 
);

Installer.java contains the method getURLAsString():

    /**
     * Utility method to extract URL from file in safe manner.
     *
     * @param file the file
     * @return the URL representation of file
     */
    private String getURLAsString( final File file )
    {
        try
        {
            return file.toURL().toExternalForm();
        }
        catch( final MalformedURLException mue )
        {
            return null;
            //should never occur
        }
    }

This method uses the File.toURL(). The JDK 1.4 javadoc of this method states:

----
public URL toURL()
          throws MalformedURLException

    Converts this abstract pathname into a file: URL. The exact form of the URL is 
system-dependent. If it can be determined that the file denoted by this abstract 
pathname is a directory, then the resulting URL will end with a slash.

    Usage note: This method does not automatically escape characters that are illegal 
in URLs. It is recommended that new code convert an abstract pathname into a URL by 
first converting it into a URI, via the toURI method, and then converting the URI into 
a URL via the URI.toURL method.
----

I think this explains the behavior! I haven't been able to test it properly yet, but 
it sounds plausible to toURI() should be used and not toURL(). (Note that this method 
is JDK 1.4 only)

---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/JAMES-307?page=comments#action_37166

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/JAMES-307

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JAMES-307
    Summary: james 2.2.0 run.bat Error building configuration
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: WON'T FIX

    Project: James
   Versions:
             2.2.0

   Assignee: 
   Reporter: Michael Cook

    Created: Sat, 17 Jul 2004 10:50 PM
    Updated: Wed, 11 Aug 2004 3:52 AM
Environment: Windows XP Home SP1 with JSDK version "1.4.1_02" and James 2.2.0.

Description:
First time thru and subsequently run.bat results in:
====================================================

Using PHOENIX_HOME:   C:\Program Files\james-2.2.0
Using PHOENIX_TMPDIR: 'C:\Program Files\james-2.2.0\bin\Files\james-2.2.0\temp'
Using JAVA_HOME:      c:\Program Files\j2sdk1.4.1_01

Phoenix 4.0.1

There was an uncaught exception:
---------------------------------------------------------
--- Message ---
Error building configuration from file:/C:/Program Files/james-2.2.0/apps/james/
SAR-INF/config.xml.
--- Stack Trace ---
org.apache.avalon.phoenix.interfaces.DeploymentException: Error building configu
ration from file:/C:/Program Files/james-2.2.0/apps/james/SAR-INF/config.xml.
        at org.apache.avalon.phoenix.components.deployer.DefaultDeployer.getConf
igurationFor(DefaultDeployer.java:499)
        at org.apache.avalon.phoenix.components.deployer.DefaultDeployer.deploy(
DefaultDeployer.java:325)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployF
ile(DefaultEmbeddor.java:498)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployF
ile(DefaultEmbeddor.java:491)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployF
iles(DefaultEmbeddor.java:476)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployD
efaultApplications(DefaultEmbeddor.java:466)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute
(DefaultEmbeddor.java:224)
        at org.apache.avalon.phoenix.frontends.CLIMain.run(CLIMain.java:158)
        at org.apache.avalon.phoenix.frontends.CLIMain.execute(CLIMain.java:144)

        at org.apache.avalon.phoenix.frontends.CLIMain.main(CLIMain.java:102)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.avalon.phoenix.launcher.Main.startup(Main.java:94)
        at org.apache.avalon.phoenix.launcher.Main.main(Main.java:46)
Caused by: java.net.MalformedURLException: no protocol: ../conf/james-fetchmail.
xml
        at java.net.URL.<init>(URL.java:579)
        at java.net.URL.<init>(URL.java:476)
        at java.net.URL.<init>(URL.java:425)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.
java:796)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.
java:725)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityRefer
ence(XMLDocumentFragmentScannerImpl.java:1073)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1489)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:333)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:524)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:580)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1169)
        at org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder.bu
ild(ConfigurationBuilder.java:129)
        at org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder.bu
ild(ConfigurationBuilder.java:116)
        at org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder.bu
ild(ConfigurationBuilder.java:97)
        at org.apache.avalon.phoenix.components.deployer.DefaultDeployer.getConf
igurationFor(DefaultDeployer.java:493)
        ... 15 more
rethrown from
java.net.MalformedURLException: no protocol: ../conf/james-fetchmail.xml
        at java.net.URL.<init>(URL.java:579)
        at java.net.URL.<init>(URL.java:476)
        at java.net.URL.<init>(URL.java:425)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.
java:796)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.
java:725)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityRefer
ence(XMLDocumentFragmentScannerImpl.java:1073)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1489)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:333)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:524)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:580)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1169)
        at org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder.bu
ild(ConfigurationBuilder.java:129)
        at org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder.bu
ild(ConfigurationBuilder.java:116)
        at org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder.bu
ild(ConfigurationBuilder.java:97)
        at org.apache.avalon.phoenix.components.deployer.DefaultDeployer.getConf
igurationFor(DefaultDeployer.java:493)
        at org.apache.avalon.phoenix.components.deployer.DefaultDeployer.deploy(
DefaultDeployer.java:325)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployF
ile(DefaultEmbeddor.java:498)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployF
ile(DefaultEmbeddor.java:491)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployF
iles(DefaultEmbeddor.java:476)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.deployD
efaultApplications(DefaultEmbeddor.java:466)
        at org.apache.avalon.phoenix.components.embeddor.DefaultEmbeddor.execute
(DefaultEmbeddor.java:224)
        at org.apache.avalon.phoenix.frontends.CLIMain.run(CLIMain.java:158)
        at org.apache.avalon.phoenix.frontends.CLIMain.execute(CLIMain.java:144)

        at org.apache.avalon.phoenix.frontends.CLIMain.main(CLIMain.java:102)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.avalon.phoenix.launcher.Main.startup(Main.java:94)
        at org.apache.avalon.phoenix.launcher.Main.main(Main.java:46)

---------------------------------------------------------
The log file may contain further details of error.
Please check the configuration files and restart Phoenix.
If the problem persists, contact the Avalon project.  See
http://jakarta.apache.org/avalon for more information.
Shutting down Phoenix.
Press any key to continue . . .

Phoenix.log contains:
=====================
INFO    2004-07-18 00:30:09.859 [Phoenix ] (): Logger started
WARN    2004-07-18 00:30:09.937 [Phoenix ] (): Phoenix was not started by the daemon 
thus it will not be possible to restart the JVM via the Management interface.
INFO    2004-07-18 00:30:10.078 [Phoenix.] (): Work directory does not exist, 
attempting to create directory C:\Program Files\james-2.2.0\work.
INFO    2004-07-18 00:30:10.140 [Phoenix.] (): Installing Sar located at 
file:/C:/Program Files/james-2.2.0/apps/james.sar.
ERROR   2004-07-18 00:30:10.812 [Phoenix.] (): Error building configuration from 
file:/C:/Program Files/james-2.2.0/apps/james/SAR-INF/config.xml.
java.net.MalformedURLException: no protocol: ../conf/james-fetchmail.xml
        at java.net.URL.<init>(URL.java:579)
        at java.net.URL.<init>(URL.java:476)
        at java.net.URL.<init>(URL.java:425)
        at 
org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:796)
        at 
org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:725)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1073)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1489)


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to