문제

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