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

include classpath() not respected in Windows #38

Closed
silbermm opened this issue Sep 11, 2012 · 4 comments
Closed

include classpath() not respected in Windows #38

silbermm opened this issue Sep 11, 2012 · 4 comments

Comments

@silbermm
Copy link

When I have an external config file on my Linux box which has an include classpath('application') everything works as expected, but when I run the same program on a Windows 7 machine, I get a flurry of exceptions saying that I can't use an unquoted string in the include statement. Any thoughts?

@havocp
Copy link
Collaborator

havocp commented Sep 11, 2012

Are you really using single quotes like that or is that just a typo? It has to be double quotes just as in JSON.
However, if that's the problem, I have NO idea why it works on Linux.

If there's a chance you could cut this down to a test case I could run myself that might be helpful. I don't have a Windows setup but I could at least examine the behavior on Linux and we could discuss things to try on Windows.

Posting the exact exceptions on Windows with stack trace may (or may not) reveal some hints, too.

@silbermm
Copy link
Author

The single quotes was a typo, I am using double quotes. The exceptions that are being thrown are shown below...

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'printDao' defined in class silbersoft.uprint.app.AppContext: Instantiation of bean fa
iled; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public silbersoft.uprint.dao.PrinterDao silbersoft.uprint.app.AppContext.printDao()] threw exc
eption; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in class silbersoft.uprint.app.AppContext: Instantiation of bean fai
led; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public com.typesafe.config.Config silbersoft.uprint.app.AppContext.config()] threw exception; n
ested exception is com.typesafe.config.ConfigException$Parse: application.conf: include statements nested more than 50 times, you probably have a cycle in your includes. Trace: [ParseableResources(app
lication.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.c
onf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), Pars
eableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResou
rces(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(appli
cation.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.con
f), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), Parsea
bleResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResourc
es(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(applica
tion.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf), ParseableResources(application.conf)
, ParseableResources(application.conf), ParseableResources(application.conf)]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.(AnnotationConfigApplicationContext.java:73)
at silbersoft.uprint.app.Main.main(Main.java:36)

As you can see I am using spring as well. I will try to test this without using spring if you feel that may be a problem. But as I said this works perfectly on my linux box (using Java 6 Update 24) , just throws this exception on Windows. Very strange...

@silbermm
Copy link
Author

I just realized that if I use a name other than 'application' as my external file i.e. -Dconfig.file=app.conf -- everything works as expected.

@havocp
Copy link
Collaborator

havocp commented Sep 11, 2012

The problem looks like "include statements nested more than 50 times, you probably have a cycle in your includes."

If you name your file application then include a file called application from there, that would cause it for example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants