Create a document in a notes database using NCSO.jar

Hi,

I’m trying my first java class using the NCSO.jar library.

I activated DIIOP on the server side and it seems that i can connect using a valid user/password.

by doing the below line of code

Session s = NotesFactory.createSession(serverName+“:63148”,“XXXXXX”,“XXXX”);

Then i’m getting my database:

Database db = s.getDatabase(serverName, baseName);

no error

then i get my agent ( i want to run it)

Agent agent = db.getAgent(agentName);

And here i get the following error:

NotesException: Database “mydatabase.nsf” has not been opened yet
at lotus.domino.NotesExceptionHelper.read(Unknown Source)
at lotus.domino.NotesExceptionHolder._read(Unknown Source)
at lotus.priv.CORBA.iiop.RepImpl.invoke(Unknown Source)
at lotus.priv.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at lotus.domino.corba._IDatabaseStub.getAgent_U(Unknown Source)
at lotus.domino.cso.Database.getAgent(Unknown Source)

i tried to do an db.open() before but i get:

NotesException: File does not exist
at lotus.domino.NotesExceptionHelper.read(Unknown Source)
at lotus.domino.NotesExceptionHolder._read(Unknown Source)
at lotus.priv.CORBA.iiop.RepImpl.invoke(Unknown Source)
at lotus.priv.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at lotus.domino.corba._IDatabaseStub.open(Unknown Source)
at lotus.domino.cso.Database.open(Unknown Source)

however the database file exist.

If anyones has any idea please do tell.

If you know of an example of java class using the NCSO.jar and manupilating NotesDocument or executing agent please share.

Thanks

Subject: same error

hi,

i tried with teh hostname or the ipdadress but i got the same error when i get to the getAgent part

NotesException: Database 172.31.210.8!!“names.nsf” has not been opened yet
at lotus.domino.NotesExceptionHelper.read(Unknown Source)
at lotus.domino.NotesExceptionHolder._read(Unknown Source)
at lotus.priv.CORBA.iiop.RepImpl.invoke(Unknown Source)
at lotus.priv.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at lotus.domino.corba._IDatabaseStub.getAgent_U(Unknown Source)
at lotus.domino.cso.Database.getAgent(Unknown Source)

To clarify my issue, I’m writing code i a java class that i execute locally on my computer (using eclipse).

Subject: my Bad

hi,

i found my error. it’s a silly one. I’m getting my databasename from a properties file and i was putting " around it in the file. ( databaseName=“names.nsf”)

databaseName value was the “names.nsf” instead of a simple names.nsf that’s why .

i corrected my propertiesfile to databaseName=names.nsf

and with the correct serverName and the correct databaseName. Everything works fine .

Regards,

Subject: One thought …

in this line:
Database db = s.getDatabase(serverName, baseName);

for the serverName use the machine host hame (acme.org.com) and try running manually to make sure it works

if db is a database on another server and the agent is a scheduled agent, that other server’s server document must have the server this agent is running on as a Trusted Server