Bug #48

Configuration read error under Eclipse/Windows

Added by Clément Oudot about 1 year ago. Updated about 1 year ago.

Status:Closed Start:04/05/2009
Priority:High Due date:
Assigned to:Clément Oudot % Done:

100%

Category:Core
Target version:1.1.0
Problem in version:

Description

Hello,

after an update of maven dependencies, I have this pb:

lsc::synchronize:
     [java] log4j:ERROR Could not read configuration file from URL [file:/C:/Documents%2520and%2520Settings/p0075/workspace/lsc-xxx-ad2openldap/target/classes/log4j.properties].
     [java] java.io.FileNotFoundException: C:\Documents%20and%20Settings\p0075\workspace\lsc-xxx-ad2openldap\target\classes\log4j.properties (Le chemin d'accès spécifié est introuvable)
     [java]     at java.io.FileInputStream.open(Native Method)

The pb is '%20'...

Can you help me?


Related issues

related to Feature #40: [ibatis] Extract XML file used by IBATIS from LSC jar Closed 31/03/2009

Associated revisions

Revision 220
Added by Jonathan Clarke about 1 year ago

Add configuration directory debugging. References #48.

Revision 230
Added by Jonathan Clarke about 1 year ago

Fixes #48. Corrects double-encoding of URLs that occurs it path contains spaces, for example

History

Updated by Jonathan Clarke about 1 year ago

  • Category set to Core
  • Status changed from New to Assigned
  • Assigned to set to Jonathan Clarke

Hmmm. I note in the URL that the "%20" has become "%2520"... looks like a double-URL encoding. We changed the code for this recently.

Can you tell me:
1) What version of lsc-core you're using? Is it the latest?
2) How you launch LSC? Do you use a -f option?
3) If you don't already, can you try using a -f option?

Thanks,
Jonathan

Updated by Clément Oudot about 1 year ago

Jonathan Clarke wrote:

Hmmm. I note in the URL that the "%20" has become "%2520"... looks like a double-URL encoding. We changed the code for this recently.

Can you tell me: 1) What version of lsc-core you're using? Is it the latest?

My connector is developped under Eclipse with maven support. It should have dowloaded the latest snapshot in my .m2 folder. Is there a way to know which real version I use?

I also checked out the SVN trunk of lsc-core. But when making :

mvn -Dmaven.test.skip=true install

I still have windows path pbs:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Ldap Synchronization Connector
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Not compiling test sources
[INFO] [antrun:run {execution: startLdapServer}]
[INFO] Executing tasks

startLdapServer:
     [echo] Starting OpenDS embedded server from C:\Documents and Settings\p0075\workspace\lsc-core/target/test-classes
     [java] 0    [main] ERROR  org.lsc.utils.LdapServer.main(LdapServer.java:113)   - java.io.FileNotFoundException: Source 'C:\Documents%20and%20Settings\p0075\workspace\lsc-core\target\test-classes\org\lsc\opends\config' does not exist
     [java] java.io.FileNotFoundException: Source 'C:\Documents%20and%20Settings\p0075\workspace\lsc-core\target\test-classes\org\lsc\opends\config' does not exist
     [java]     at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:668)
     [java]     at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:636)
     [java]     at org.lsc.opends.EmbeddedOpenDS.initOpendsDirectory(EmbeddedOpenDS.java:240)
     [java]     at org.lsc.opends.EmbeddedOpenDS.startServer(EmbeddedOpenDS.java:140)
     [java]     at org.lsc.utils.LdapServer.start(LdapServer.java:79)
     [java]     at org.lsc.utils.LdapServer.usage(LdapServer.java:140)
     [java]     at org.lsc.utils.LdapServer.main(LdapServer.java:103)
     [java] Java Result: 1

2) How you launch LSC? Do you use a -f option?

No but it does not seem to change anything. See below.

3) If you don't already, can you try using a -f option?

So I run:

ant lsc::synchronize  -Dsynchronize.parameters="-c all -s all -n -f target/classes/

And the result:

Buildfile: build.xml

lsc::init:

lsc::prepare-env:
     [echo] Copying xml and properties files

lsc::compile-resources:
     [echo] Compiling resources

lsc::compile-app:

lsc::synchronize:
     [java] log4j:ERROR Could not read configuration file from URL [file:/C:/Documents%2520and%2520Settings/p0075/workspace/lsc-sample/target/classes/log4j.properties].
     [java] java.io.FileNotFoundException: C:\Documents%20and%20Settings\p0075\workspace\lsc-sample\target\classes\log4j.properties (Le chemin d'accès spécifié est introuvable)
     [java]     at java.io.FileInputStream.open(Native Method)
     [java]     at java.io.FileInputStream.<init>(FileInputStream.java:106)
     [java]     at java.io.FileInputStream.<init>(FileInputStream.java:66)
     [java]     at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
     [java]     at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
     [java]     at java.net.URL.openStream(URL.java:1007)
     [java]     at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:433)
     [java]     at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:336)
     [java]     at org.lsc.Launcher.run(Launcher.java:125)
     [java]     at org.lsc.Launcher.main(Launcher.java:111)
     [java] log4j:ERROR Ignoring configuration file [file:/C:/Documents%2520and%2520Settings/p0075/workspace/lsc-sample/target/classes/log4j.properties].
     [java] 0    [main] ERROR  org.lsc.Configuration.getConfiguration(Configuration.java:303)   - org.apache.commons.configuration.ConfigurationException: C:\Documents%20and%20Settings\p0075\workspace\lsc-sample\target\classes\lsc.properties (Le chemin d'accès spécifié est introuvable)
     [java] Exception in thread "main" java.lang.ExceptionInInitializerError: Unable to find 'file:/C:/Documents%2520and%2520Settings/p0075/workspace/lsc-sample/target/classes/lsc.properties' file. (org.apache.commons.configuration.ConfigurationException: C:\Documents%20and%20Settings\p0075\workspace\lsc-sample\target\classes\lsc.properties (Le chemin d'accès spécifié est introuvable))
     [java]     at org.lsc.Configuration.getConfiguration(Configuration.java:304)
     [java] org.apache.commons.configuration.ConfigurationException: C:\Documents%20and%20Settings\p0075\workspace\lsc-sample\target\classes\lsc.properties (Le chemin d'accès spécifié est introuvable)
     [java]     at org.lsc.Configuration.getAsProperties(Configuration.java:168)
     [java]     at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:288)
     [java]     at org.lsc.SimpleSynchronize.launch(SimpleSynchronize.java:123)
     [java]     at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:186)
     [java]     at org.lsc.Launcher.run(Launcher.java:128)
     [java]     at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:174)
     [java]     at org.lsc.Launcher.main(Launcher.java:111)
     [java]     at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:252)
     [java]     at org.lsc.Configuration.setConfiguration(Configuration.java:343)
     [java]     at org.lsc.Configuration.getConfiguration(Configuration.java:281)
     [java]     at org.lsc.Configuration.getAsProperties(Configuration.java:168)
     [java]     at org.lsc.SimpleSynchronize.launch(SimpleSynchronize.java:123)
     [java]     at org.lsc.Launcher.run(Launcher.java:128)
     [java]     at org.lsc.Launcher.main(Launcher.java:111)
     [java] Caused by: java.io.FileNotFoundException: C:\Documents%20and%20Settings\p0075\workspace\lsc-sample\target\classes\lsc.properties (Le chemin d'accès spécifié est introuvable)
     [java]     at java.io.FileInputStream.open(Native Method)
     [java]     at java.io.FileInputStream.<init>(FileInputStream.java:106)
     [java]     at java.io.FileInputStream.<init>(FileInputStream.java:66)
     [java]     at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
     [java]     at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
     [java]     at java.net.URL.openStream(URL.java:1007)
     [java]     at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:279)
     [java]     ... 9 more
     [java] Java Result: 1

BUILD SUCCESSFUL
Total time: 1 second

Hope this can light a bulb ;)

Updated by Jonathan Clarke about 1 year ago

  • Status changed from Assigned to Feedback
  • % Done changed from 0 to 100

Applied in changeset r230.

Updated by Jonathan Clarke about 1 year ago

  • Assigned to changed from Jonathan Clarke to Clément Oudot

I reproduced this on my laptop - it is not related to Windows, just any path with spaces in. My last commit seems to fix it here.

Clément, can you test this and close the bug if it's OK? Thanks.

Updated by Jonathan Clarke about 1 year ago

  • Target version set to 1.1.0

Updated by Clément Oudot about 1 year ago

Works for me (tm). I let you close the issue.

Clément.

Updated by Jonathan Clarke about 1 year ago

  • Status changed from Feedback to Closed

Thanks Clément !

Also available in: Atom PDF