Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using classpath resources for PropertyConfigurer #20

Closed
eswdd opened this issue Oct 28, 2013 · 0 comments
Closed

Switch to using classpath resources for PropertyConfigurer #20

eswdd opened this issue Oct 28, 2013 · 0 comments

Comments

@eswdd
Copy link
Contributor

eswdd commented Oct 28, 2013

We have an issue with cougar platform and could use your assistance.

When running any of our (non-Cougar) applications, we need to override cougar’s com.betfair.cougar.util.configuration.PropertyConfigurer or the application will not run.

The problem we are facing is related to the defaultConfig setter (PropertyConfigurer.setDefaultConfig). This setter is used by Spring to inject the resource in four different xml files, in which the resource is contained in a sub-folder named “conf”. As the path is given as a String starting at the root of the jar (e.g. ), the path is resolved as a ServletContextResource (due to the ‘/’), instead of a ClassPathResource. In light of this, the application fails during startup as a FileNotFoundException is thrown (i.e. such ServletContextResource does not exist).

In order to fix this problem, we are overriding the class (PropertyConfigurer) and altering the setDefaultConfig method to take a String (instead of a Resource), resolving the String ourselves (i.e. this.defaultConfig = new DefaultResourceLoader().getResource(defaultConfig)). This solution does not require any changes in the xml files.

A different (possible) solution to this problem would be to include a “classpath:” prefix on the four xml files (in the defaultConfig property location):
(cougar-core-impl-2.9.6.jar) conf.core-config-cougar-core-impl.xml
(cougar-client-2.9.6.jar) conf.cougar-application-spring.xml
(cougar-marshalling-impl-2.9.6.jar) module-config-cougar-marshalling.xml
(cougar-standalone-ev-2.9.6.jar) module-config-cougar-standalone-ev.xml.

eswdd added a commit that referenced this issue Feb 6, 2014
…n PropertyConfigurer and ensure using conf/ folder on all of those.
@eswdd eswdd closed this as completed Feb 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant