0

I have got problem while working with Java agent in Notes client. I need to upload the file from particular path in Notes client memo form. I am using Java agent. It uses Alfresco's API to upload file to alfresco server. It works fine in standalone Java application. It is working fine for the first time in Lotus Notes also. But when I want to update for the second time or if I run any Java agent which has JAR files imported for the second time, it throws the following error:

Notes Error : JVM : Attempt to retrieve java agent attachments failed.

I added necessary jar files in the server's jvm/lib/ext path. After restarting server, it works for first time, then it fails for second time. Any solutions would be appreciated.

Naveen
  • 6,786
  • 10
  • 37
  • 85
Vijayakumar
  • 85
  • 16

2 Answers2

2

The 'Attempt to retrieve java agent attachments failed' error on the second run is almost certainly caused by memory exhaustion. That means that on the first run, your agent is grabbing a lot of memory and failing to free it.

This can happen if your code is accessing a large number of objects in the lotus.domino.* classes and failing to call their recycle() method. (Each such object allocates some non-JVM memory, which is not freed by the JVM's garbage collector. It is essential that you call the recycle() method to free that memory. Usually, the finally clause is a good place to do this.)

I don't know anything about the Alfresco API, but it may also leak memory if it is not used properly.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
  • :- I have done recycle also. I just created a test java agent. There i included one console print . It is printing . After i included the 14Jar files(Alfresco APIs), It throws Out of memory Error – Vijayakumar Mar 20 '13 at 08:34
  • How big are those jars? I once saw a similar problem when one of the jars was huge because the developer had done the build wrong and had been including previous versions of the jar file nested inside each other! Also, what version of Domino are you using and do you have a JavaMaxHeapSize setting in the server's notes.ini file? – Richard Schwartz Mar 20 '13 at 15:17
  • Hi Richard , Sorry for the delay. I have achieved this using batch file running from lotus script. I am using 8.5.2 domino version. All jars Memory is 17 Mb. JavaMaxHeapSize=201326592 JavaMinHeapSize=134217728. Thanks for the understanding. – Vijayakumar Apr 01 '13 at 13:38
1

It is known issue with memory leak if Java agent or Java script library contains JAR files. The bigger the sooner your server/amgr crashes. Not fixed since beginning of Java agents :-(.

Common workaround is to put all JARs into jvm/lib/ext folder, as @Simon O'Doherty mentioned.

Modern approach is to use XAgents or servlet.

Frantisek Kossuth
  • 3,524
  • 2
  • 23
  • 42