Re: Rewrite doesn't read org.ocpsoft.rewrite.config.ConfigurationProvider

Splash Forums Rewrite Users Rewrite doesn't read org.ocpsoft.rewrite.config.ConfigurationProvider Re: Rewrite doesn't read org.ocpsoft.rewrite.config.ConfigurationProvider

#22591

You have put the services file at the wrong location. It must be located at:

WEB-INF/classes/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider

I know the location of META-INF for webapps is a bit confusing. You are right that there is usually also a META-INF directory in the root of the webapp archive, but that’s a location where containers expect custom configuration files or other stuff. The META-INF folder in WEB-INF/classes instead is accessible from the classpath just like the corresponding files in JAR files. And ServiceLoader mechanism Rewrite uses requires the files to be on the classpath.

BTW: If you are using CDI for you webapp, you won’t have to add the services file at all for Rewrite to find your ConfigurationProvider. Just include the CDI integration module of Rewrite and Rewrite will automatically find ConfigurationProvider implementations which are managed by the CDI container. :)