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

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

This topic contains 7 replies, has 4 voices, and was last updated by  Lincoln Baxter III 3 years, 12 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #18428

    Lynx6
    Participant

    Hello Linkoln, Christian, I was trying to use Rewrite in my JSF app, but for some reason Rewrite is not reading my /META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider file, my project structure is:

    web
    +META-INF
    +services
    org.ocpsoft.rewrite.config.ConfigurationProvider
    +WEB-INF
    +lib
    JSFCore.jar
    rewrite-servlet-1.0.5.Final.jar

    I put the same code inside of JSFCore to test, but this worked when I modified the file path “META-INF/services” to “../../META-INF/services” in ‘ServiceLoader’, can you explain me this?

    I’m using:

    Netbeans

    JSF 2.1

    Rewrite 1.0.5

    CDI, Primefaces

    #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. :)

    #22592

    Lynx6
    Participant

    wow… your explaining was useful. I going to use the CDI integration module, so easy… Thank you Christian… =)

    #23930

    Wim
    Participant

    Can you correct the documentation on this? I’ve fallen into the same trap because http://ocpsoft.org/rewrite/ mention the path is /META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider instead of /WEB-INF/classes/META-INF/services/org.ocpsoft.rewrite.config.ConfigurationProvider.

    Mentioning that you don’t need explicit ConfigurationProvider registration when you have CDI would also be a great help.

    Thank you

    #23934

    I’ve updated the documentation. Thanks for pointing out that this is confusing! Do you find the new language clearer?

    #23935

    Hey,

    thanks for the feedback. The quickstart guide on http://ocpsoft.org/rewrite/ already mentions this issue. Perhaps it has been added recently? I don’t know.

    We are currently working on the Rewrite documentation, which will be available here:

    http://ocpsoft.org/rewrite/docs/

    But this is still work in progress. 🙂

    #23936

    Ups. Concurrent posts. 🙂

    #23937

    Yep 😛 I just updated it. Hehe.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

Comments are closed.