tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walend, David" <>
Subject Re: typesafe-config reference.conf file not found in a .jar in WEB_INF/lib
Date Wed, 06 May 2015 14:22:32 GMT

Thanks for the reply. Response interlaced:

On 5/5/15, 4:35 PM, "Christopher Schultz" <>

> Which exact version of Tomcat are you using?

Server version:        Apache Tomcat/7.0.59

>On 5/5/15 4:30 PM, Walend, David wrote:
>> typesafe config's loader isn't picking up my subproject's
>> reference.conf from within a .jar file inside a .war file's
>> WEB_INF/lib/ .
>> typesafe config finds the reference.conf in the .jar file outside of
>>tomcat. It works
>> fine from the .war file's WEB_INF/classes (my hacky fix).
>> Typesafe config is finding the reference.conf files in other .jar
>> files, like
>> Loading config from URL
>> jar:file:/opt/shrine/tomcat/webapps/shrine/WEB-INF/lib/akka-actor_2.11
>- -2.3.
>8.jar!/reference.conf from class loader WebappClassLoader
>So your WAR file looks like this:
>(plus other stuff)
>Then, akka-actor.2.11-2.8.8.jar contains:
>(plus other stuff)
>Do I have that right?

Exactly so. 

My custom .jar follows the same pattern with its own reference.conf. It
finds the four reference.conf files from akka and spray, but not mine.

I don¹t think the problem is one reference.conf masking another because
typesafe config reports finding four of them:

0> grep reference /opt/shrine/tomcat/logs/localhost.2015-05-05.log

Loading config from URL
8.jar!/reference.conf from class loader WebappClassLoader
Loading config from URL
.jar!/reference.conf from class loader WebappClassLoader
Loading config from URL
jar!/reference.conf from class loader WebappClassLoader
Loading config from URL
2.jar!/reference.conf from class loader WebappClassLoader

I¹m out of ideas to run down.

>Is the URL you have above being used directly from within the web
>application itself? That is, do you have complete control over the
>URL, or is it built dynamically or something like that?

I think I can get control over the class loader it uses, but am using
typesafe config¹s ConfigFactory.load(³custom") method currently. In the
type safe config code, it eventually gets reference.conf from a call to

loader.getResources(resource) where resource is ³resource.conf² .

>From ~line 227 of

        protected AbstractConfigObject rawParseValue(ConfigOrigin origin,
                ConfigParseOptions finalOptions) throws IOException {
            ClassLoader loader = finalOptions.getClassLoader();
            if (loader == null)
                throw new ConfigException.BugOrBroken(
                        "null class loader; pass in a class loader or use
            Enumeration<URL> e = loader.getResources(resource);
            if (!e.hasMoreElements()) {
                if (ConfigImpl.traceLoadsEnabled())
                    trace("Loading config from class loader " + loader
                            + " but there were no resources called " +
                throw new IOException("resource not found on classpath: "
+ resource);
            AbstractConfigObject merged = SimpleConfigObject.empty(origin);
            while (e.hasMoreElements()) {
                URL url = e.nextElement();

                if (ConfigImpl.traceLoadsEnabled())
                    trace("Loading config from URL " +
url.toExternalForm() + " from class loader "
                            + loader);

                ConfigOrigin elementOrigin = ((SimpleConfigOrigin)

                AbstractConfigValue v;

                // it's tempting to use ParseableURL here but it would be
                // because the wrong relativeTo() would be used for
                InputStream stream = url.openStream();

Thanks again,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message