Attempt to retrieve Java agent attachments failed

Hi there,

I’ve created an agent to start in den Notes Client containing this code:

package com.esg.print.pdf;

import lotus.domino.*;

import com.ibm.notes.java.ui.documents.NotesUIDocument;

import com.ibm.notes.java.ui.documents.NotesUIField;

public class PDFPrinter extends AgentBase {

public void NotesMain() {



	try {

		Session session = getSession();

		AgentContext agentContext = session.getAgentContext();

		NotesUIWorkspace ws = new NotesUIWorkspace();

	    

	    NotesUIDocument uidoc = ws.getCurrentDocument();

	    

	    if (uidoc != null){

	    	NotesUIField field = uidoc.getField("function");

	    	if (field != null)

	    		field.setText("Hallo Welt!");

	    }

	    



	} catch (Exception e) {

System.err.println(e.getClass().getName() + ": " + e.getMessage());

	}

}

}

I always get this error:

ERROR: JVM: Attempt to retrieve Java agent attachments failed.

But why? I’ve just marked one document. Please help!

Thanks,

Mathias