Make per-context JNDI variable available to Tomcat in Eclipse

前端 未结 2 1487
滥情空心
滥情空心 2021-01-18 13:05

I\'m using Tomcat 8.5.6 inside Eclipse 4.6.1. I have my web-app project/context foo, which has a JAX-RS (using RESTEasy 3.1.0.CR3) endpoint of bar,

2条回答
  •  醉酒成梦
    2021-01-18 14:05

    It appears that in order to get Eclipse+Tomcat to recognize the per-module context files, you have to go into the server configuration (double-click on the server) and turn on the Publish module contexts to separate XML files. This way Tomcat will use the specific context XML file you created. Otherwise it apparently puts them in conf/server.xml and ignores the context-specific file you created.

    There is still the problem that Eclipse regenerates this file each time you do a rebuild, destroying whatever JNDI variables you placed there. I'm trying to get the workaround in https://stackoverflow.com/a/22380248/421049 to work, but not yet succeeding. Anyone have any better ideas?

    At least I'm able to reproduce a production environment now --- albeit temporarily, until the next rebuild.

提交回复
热议问题