Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

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.(MissingResourceException.java:50) at 
java.util.ResourceBundle.getObject(ResourceBundle.java:400) at 
java.util.ResourceBundle.getString(ResourceBundle.java:421) at 
lotus.notes.JavaString.getFormattedString(Unknown Source) at 
lotus.notes.AgentSecurityManager.checkMemberAccess(Unknown Source) at 
java.lang.Class.checkMemberAccess(Class.java:112) at 
java.lang.Class.getDeclaredMethods(Class.java:675) at 
org.apache.velocity.util.introspection.ClassMap.populateMethodCacheWith(ClassMap.java:167)
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.

Monday, June 27, 2011

IBM Domino Java: No trusted certificate found. Fail?

I've faced with quite major problem when use IBM Java (the one from Domino 8.5.2 FP2). Our Domino grabs data from some webservices via 'https' (webservice does not have authentication, its free to everybody). Using simple Java Agent in Domino we grabbed data and was very happy :), here is few lines what we do
 URL url = new URL("https://here url");  
 URLConnection connection = url.openConnection();  
 HttpsURLConnection httpConn = (HttpsURLConnection) connection;  
 httpConn.setRequestMethod("POST");  
 httpConn.setDoOutput(true);  
 httpConn.setDoInput(true);  
 byte[] bytes = msg.getBytes("UTF-8");  
 httpConn.setRequestProperty("Content-length", String.valueOf(bytes.length));  
 OutputStream out = httpConn.getOutputStream(); // and on this line we now have an error: "no trusted certificate found"  
It worked fine for years but their (webservice provide) certificate has expired and they generate new one using same official CA. After they did it, Domino refuse to use new certificate and we can't grab data anymore from Domino.

We did some tests and noticed that non Domino JVM works just fine (we did tests in Eclipse with Oracles JVM) with exactly same code and it worked fine.

Of course we tried much more thing i.e.: we tried to add new certificate to cacerts storage in Domino and it did not work, we also tried to replace cacerts on Domino and use the one from Oracle JVM and lot of more things without any luck. Also when we tried to add new cert to cacerts in Domino it started to report about another issue: certificate chaining error.

Maybe Domino or Domino's JVM has problem/issue or we need to do something we just do not know. Would be nice to get more details about it because we are stacked now, does anybody know why we get this problem and if it is really problem in IBM Java?
There is also post on IBM with exactly same problem with not trusted certificates.
Would be nice if somebody share his suggestions/opinions.

Related topics:
IBM Domino Java: No trusted certificate found. Fail?
Domino and No trusted certificate found
Disabling certificate validation in Java

Friday, September 10, 2010

Need to zip file with password in Lotus Notes?

I've task where we need to compress and protect attachments and some log files. I did not look in Lotus Script area at all (as I'm sure it would be not possible or to difficult to do such thing). So I started to look for free RAR/ZIP Java libraries that will have what I need (compress and password).
I was surprised a bit, RAR does not have such API at all, but ZIP has already built in Domino library that allow us to zip files but... not to set password (at least I did not find).

So after couple minutes in google I've found only one free Java library that could zip files with password: http://code.google.com/p/winzipaes/
There were no problems during implementation, library is well described.
Java, Java and Java :)