Question

I'm working on a mavenized webapp that runs fine with tomcat7. I want to use the tomcat-tomcat-plugin to speed up and simplify deploy and development times.

But exists some constraints on the webapp, I.e: grant register permission for javax.management.MBeanTrustPermission, in where tomcat plugin fails to load the catalina.policy file. This is a known bug (http://jira.codehaus.org/browse/MTOMCAT-59) but I still need to get things running.

The only solution I see is to switch to some other tool like jetty or cargo (although I would prefer to stick with tomcat plugin).

I would like to know some advice or workaround to have the tomcat plugin working with registered permission.

Was it helpful?

Solution

The plugin provides the tag additionalConfigFilesDir:

<additionalConfigFilesDir>${tomcatConfigFolder}</additionalConfigFilesDir>

There you can put your policies file as well other config files.

In the maven-tomcat-plugin source code I found that the configuration files are being copied as expected to your target/tomcat/conf directory but the plugin can't use it because policies are specified as a VM argument and your VM had started when this takes place.

So the inmediate solution is to specify in your MAVEN_OPTS variable:

export MAVEN_OPTS = "$MAVEN_OPTS -java.security.policy=pathToTheTomcatConfig/catalina.policy"

I hope this helps.

OTHER TIPS

Usually a good idea to have it fixed is to provide a patch. (yup that's open source so you can help :-) ).

Fix that and attach a patch here: https://issues.apache.org/jira/browse/MTOMCAT-59

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top