Cargo

Datasource definition containing backslashes causes problems in server.xml generation

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.3.1-maven2
  • Fix Version/s: 1.0
  • Component/s: Tomcat
  • Labels:
    None
  • Environment:
    Windows
  • Complexity:
    Intermediate
  • Tested on JDKs:
    1.5, 1.6
  • Number of attachments :
    0

Description

I am using Cargo to set up Tomcat with a JDBC connection to a HSQLDB file-based database in a multi-module project.

For a number of reasons, we need to use ${project.build.directory} in the JDBC URL string. However, putting this in the pom...

<cargo.datasource.datasource>
    cargo.datasource.url=jdbc:hsqldb:file:${project.build.directory}/database/db|
     ... other properties ...
</cargo.datasource.datasource>

... does not generate a valid conf/server.xml file under Windows. Imagine my project's target directory is C:\foo\bar\baz\target - this is the result...

Server.xml
<Resource url='jdbc:hsqldb:file:C:foobarbaz    arget/database/db'
                     ...other attrs.../>

This will obviously cause an error on container startup - the backslashes are not being escaped correctly and so the database cannot be found. There are no workarounds for us as far as I know.

One solution might be to escape the backslashes in the string, similar to how the Maven Resources plugin works: http://maven.apache.org/plugins/maven-resources-plugin/xref/org/apache/maven/plugin/resources/ReflectionProperties.html#62.

Activity

Hide
Adrian Cole added a comment -

thanks for specifying the issue so clearly. this is now covered by unit tests

Show
Adrian Cole added a comment - thanks for specifying the issue so clearly. this is now covered by unit tests
Hide
Philip Peitsch added a comment -

Has this been fixed yet? What release version should I be looking for to avoid this issue?

Show
Philip Peitsch added a comment - Has this been fixed yet? What release version should I be looking for to avoid this issue?
Hide
Adrian Cole added a comment -

this is available in the current beta, or 1.0-SNAPSHOT

Show
Adrian Cole added a comment - this is available in the current beta, or 1.0-SNAPSHOT
Hide
Philip Peitsch added a comment -

Hello again. I was just wondering where can I download the current snapshot from? The current beta (1.0-beta-2) was released early December sometime and does not appear to fix the issue.

Show
Philip Peitsch added a comment - Hello again. I was just wondering where can I download the current snapshot from? The current beta (1.0-beta-2) was released early December sometime and does not appear to fix the issue.
Hide
Matt Wringe added a comment -

http://snapshots.repository.codehaus.org/

I guestion like this should have been asked on one of the mailing lists instead of in the jira.

Show
Matt Wringe added a comment - http://snapshots.repository.codehaus.org/ I guestion like this should have been asked on one of the mailing lists instead of in the jira.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: