Spring application with embedded jetty can't find webdefault.xml if running from jar

前端 未结 6 607
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 15:19

I have spring application which uses embedded Jetty instance.

project
   | src
      | controller
      | webapps
          | jsp
          | WEB-INF
                    


        
6条回答
  •  既然无缘
    2021-02-03 15:56

    It seems that jetty's trying to parse the web.xml (descriptor) file, but thinks its in

    .../...../...../webdefault.xml
    

    or something like that.

    You should explicitly set the web.xml path:

    context.setDescriptor("WEB-INF/web.xml"); `
    

    or, assuming that your jar really does include the aformentioned 'project' dir (which isn't standard jar intrernal layout):

    context.setDescriptor("project/src/webapps/WEB-INF/web.xml");
    

提交回复
热议问题