Monday, December 12, 2011

Using Velocity in Domino

We are using velocity framework to solve our task with html templates and when we started to work with velocity we faced up with problem below
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key member_access_not_allowed at
java.util.MissingResourceException.( at 
java.util.ResourceBundle.getObject( at 
java.util.ResourceBundle.getString( at 
lotus.notes.JavaString.getFormattedString(Unknown Source) at 
lotus.notes.AgentSecurityManager.checkMemberAccess(Unknown Source) at 
java.lang.Class.checkMemberAccess( at 
java.lang.Class.getDeclaredMethods( at 
We have found the issue in velocity's source (well it is an issue only for Domino).
org.apache.velocity.util.introspection.ClassMap.populateMethodCacheWith(MethodCache, Class)
that line we have to change to get only Public methods but not all declared as it requires more access then Domino gives by default (we are not able to to get all private methods into Domino for security reason), so we just changed getDeclaredMethods to getMethods and problem has gone.


Anonymous said...

There is also an option to add grant directive to java.policy file to allow reflection. But this can be seen as security hole so do this only if You must.

Andriy Kuba said...

java.policy have one more negative - you need to change it on the OS file system on all servers that will use your database.

Christian Gravgaard said...

You have to change the agents security. Look at this:

This will make it work - right.