Вопрос

I have a web-app that i run through Maven Jetty plugin.

I configure it using a jetty.xml file. My problem comes when i want to set a custom authenticator that i have created in the WebAppContext. The XML config looks like below:

<New id="webAppContext" class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/</Set>
    <Set name="copyWebDir">true</Set>
    <Set name="extractWAR">false</Set>
    </Set>
    <Get name="securityHandler">
        <Set name="authenticator">
            <New class="MY_CUSTOM_AUTHENTICATOR">
            </New>
        </Set>
    </Get>
</New>

When i run the above i get a ClassNotFoundException for "MY_CUSTOM_AUTHENTICATOR" class. I have to add that the class exists in the same maven project that i launch Jetty from.

Is there an "import" statement that i have to do in order for Jetty to load my class?

Thank you.

Это было полезно?

Решение

You most likely need to have your authenticator in an artifact that is then declared as a dependency of the jetty maven plugin itself. With classloader isolation in play the authenticator is probably in your webapp where the security handler does not have visibility.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top