Link to home
Start Free TrialLog in
Avatar of ITDharam
ITDharamFlag for United States of America

asked on

Problem with agent which crashes server

I have a manual agent that when run crashes my server.

This agent was created for a website running R5 Domino, I moved the site, and the agent, to a R6.5.3 server and ever since then it crashes my server.  I could use some help, I'm hoping it is as simple as code needing to be updated.

Here is the existing code from the agent.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub Initialize
 '-----------------------------------------------------------------------------------------------------
 ' Declare variables
 '-----------------------------------------------------------------------------------------------------
      On Error Goto HandleError
      
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim contextDoc As NotesDocument
      Dim item As NotesItem
      Dim donorNumber As String, actionFlag As String
      Dim userName As String
      Dim kind As String
      
'-----------------------------------------------------------------------------------------------------
'      Get username
'-----------------------------------------------------------------------------------------------------
      Set contextDoc = s.DocumentContext
      Set db = s.CurrentDatabase
      Set item = contextDoc.GetFirstItem( "Remote_User" )
      If Not ( item Is Nothing ) Then
            userName = Trim( item.Text )
      End If
      
'-----------------------------------------------------------------------------------------------------
' Create Notes Doc
'-----------------------------------------------------------------------------------------------------
      Set item = contextDoc.GetFirstItem( "Kind" )
      If Not ( item Is Nothing ) Then
            kind = Cstr( item.Text )
            
            Select Case kind
            Case "Web T-Shirt"
                  donorNumber = GenerateNotesTShritDoc( db, contextDoc,userName )
                  
            Case "Web Donation Form"
                  donorNumber = GenerateNotesDonation( db, contextDoc, userName)
                  
            End Select
            
      End If
      
      
      
      Exit Sub
HandleError:
      Print "Submit Web Order::Initialize "
      Print      "Error " & Err() & " at line " & Erl() & ": " & Error()
      Exit Sub
End Sub

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Avatar of qwaletee
qwaletee

I've got to believe that the problem occurs in the GenerateNotes***** functions.  You could also hep debug this with some msgbox statments (which print to server console), or print statemnets (which show results in the browser -- make sure to add <BR> to the end of every print).
Avatar of ITDharam

ASKER

When I opened up the Agent I didn't realize it had actually found an error.

"Submit Web Donation: (Options): 4: Error loading USE or USELX module: WebRoutines"

I looked up USE and it calls a script, I believe.  So I looked in scripts and and there is a script in the DB called WebRoutines.  It is signed with the same ID, Server ID, as everything else in the DB.

qwaletee, thanks for the input, I'm not familiar with the print statements...and I'm actually not very familiar with this DB either, I just inherited it.  If it isn't too much trouble, could you spell out how I would integrate that?  Or is the information I've just provided enough to get you going?

Thanks,
Something like this and let us know what and all is printed

Sub Initialize
 '-----------------------------------------------------------------------------------------------------
 ' Declare variables
 '-----------------------------------------------------------------------------------------------------
     On Error Goto HandleError
     
     Dim s As New NotesSession
     Dim db As NotesDatabase
     Dim contextDoc As NotesDocument
     Dim item As NotesItem
     Dim donorNumber As String, actionFlag As String
     Dim userName As String
     Dim kind As String
     Print "entering uptil here 1"
'-----------------------------------------------------------------------------------------------------
'     Get username
'-----------------------------------------------------------------------------------------------------
     Set contextDoc = s.DocumentContext
     Set db = s.CurrentDatabase
     Set item = contextDoc.GetFirstItem( "Remote_User" )
     If Not ( item Is Nothing ) Then
          userName = Trim( item.Text )
     End If
     Print "uptil here 2"
'-----------------------------------------------------------------------------------------------------
' Create Notes Doc
'-----------------------------------------------------------------------------------------------------
     Set item = contextDoc.GetFirstItem( "Kind" )
     If Not ( item Is Nothing ) Then
          kind = Cstr( item.Text )
          Print "uptil here 3"
          Select Case kind
          Case "Web T-Shirt"
               donorNumber = GenerateNotesTShritDoc( db, contextDoc,userName )
               Print "uptil here 4"
          Case "Web Donation Form"
               donorNumber = GenerateNotesDonation( db, contextDoc, userName)
               Print uptil here 4 second case"
          End Select
         
     End If
     
     Print "out of code"
     
     Exit Sub
HandleError:
     Print "Submit Web Order::Initialize "
     Print     "Error " & Err() & " at line " & Erl() & ": " & Error()
     Exit Sub
End Sub

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I can't modify the agent because it is saying "Data not saved due to script error'.

In the options tab there is a  (Use "WebRoutines") that is red
it may be that LSS file is misssing do one thing: Comment Generate function and check whether it works smoothly

partha
When you changed Domino versions, did you also change the OS?  WIndows is not case-sensitive about USE statments, while all other versions of DOmino are case-sensitive.

WebROutines should eb a Script Library containing several LotusScript functions, including the two we discussed earlier.
qwaletee  I'm not positive what the original OS was, but now it is W2K.

p partha, I don't understand what you want me to do.  Please expand.

Thanks guys,
SOLUTION
Avatar of p_partha
p_partha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Partha, after commenting out both the lines like so...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Create Notes Doc
'-----------------------------------------------------------------------------------------------------
      Set item = contextDoc.GetFirstItem( "Kind" )
      If Not ( item Is Nothing ) Then
            kind = Cstr( item.Text )
            
            Select Case kind
            Case "Web T-Shirt"
      '            donorNumber = GenerateNotesTShritDoc( db, contextDoc,userName )
                  
            Case "Web Donation Form"
      '            donorNumber = GenerateNotesDonation( db, contextDoc, userName)
                  
            End Select
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I still cannot save getting the same cannot load USE....
YOu have to comment the Lss also..

Partha
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sjef Bosman
Some questions:
-> the function "GenerateNotesTShritDoc": is the name spelled correctly? Or is it just a typo?
-> if you have an error handler, you should ALWAYS have a RESUME in it; modify your code like this:
    exitsub:
         Exit Sub
    HandleError:
         Print "Submit Web Order::Initialize "
         Print "Error " & Err & " at line " & Erl & ": " & Error$
         Resume exitsub

Most likely it is the typo...
I noticed the tshritdoc typo as well, but that is how it was programmed...no typo on my part.

qwaletee, I'll try your suggestion and try again.

bosman, again, if I can't save the agent, see earlier in question, then I can't add the resume.  But I certainly will once I get this thing going again.  As far as the shrit typo, I think it must be programmed in, but I'm not sure how to validate this, some more guidance would be appreciated.
OK,

qwaletee, I create a new agent and under 'options' I put USE "WebRoutines"  and it errored out.

When I open WebRoutines which is a Script Library it has under options

Use "CreditCardRoutines"
Use "DonorRoutines"

When I add a comment and save,  the "CreditCardRoutines" goes red.

When I open CreditCardRoutines it has the following under options
Uselsx "*Commerce"
Use "DonorRoutines"

When I add a comment and save, I get  "CreditCardRoutins: (Options): 4: Error loading USE or USELSX module: *Commerce"

and that is where I lose the trail.  Commerce is not an agent or a script library, and it is the first Uselsx

....I should have added this in the beginning, but I just remembered.  I had to load commerce accelerator when this website was installed.  An individual from another company 'verified' that it was working.
and that is Proposion Commerce Accelerator
Try to recompile all LS code in the database. In designer's menu: Tools-> Recompile All Lotusscript.
Alexey,

When I run that I get a bunch of errors saying invalid syntax for a lot of the agents, scripts and some forms too.
All I can say is: start with the first error and get it fixed. The Recompile All will first build a tree of function dependencies. Compilation will start with the libraries that are being used by others but don't use other libraries themselves. The first errors you get are therefore most likely the ones that are essential to your problem. You can dump some lines here with the accompanying error message if you want some more advice.

A parallel path you can walk: find out how on earth the application could have been save in the first place, when you get that many errors now. Who touched it in the past, and when? The names and dates are in the design, so you can ask them why. Ah, they left...
The script library CreditCardRoutines is referring to an lsx (Uselsx "*Commerce"). Do you have the lsx installed on your machine? You'll need it in order to recompile the librairy. The name of the lsx is Commerce and * will tell Notes to find the lsx according to entries in the registry (in contrast to specifiying the path yourself). LSx are Lotus Script Extensions that enable you to use new objects that do not exist in the default domino object model. Exempke of an lsx would be the Oracle LSX wich will enable a developper to work with an Orcale DB (read, write, commit, etc). Lsx will normally take the form of a DLL file. So find the lsx and you should be able to compile. If you can find it then look on the computer of the developper of the Notes DB (or a backup).

Hope it helps Marc-Antoine Pomerleau
Pomster, you're on the right track.

I looked at the uselsx module and this site is using something called commerce accelerator.

there is a commerceaccelerator.dll and a registry entry that points to it under lotus script extensions and the .dll points to commerce.

Still don't know why it doesn't work.

I created a new lotus script with only uselsx "commerce" and same problems.

Thanks for the efforts guys.  Points doubled to the person who fixes.
The error probably isn't in the commerce-dll at all. Probably is is a product you bought (years ago?), so you should have the documentation. If you have the DLL-vieweron your system, you can seen the exported hooks by double-clicking the dll in the Explorer (or File Manager). Only those names are recognized. Check if and where these names are used, and whether it's done properly.

Btw, doubling the points is not allowed.
bosman, didn't know about the point thing.  I thought I had seen this done many times in past.  

Offer retracted on points.

As far as the DLL, I don't really know what a 'hook' is, I could see it's dependencies though, and they are wsock32.dll and kernel32.dll

As far as documentation...I have the text file that came with it, it didn't come with much.
What I meant with "hooks" are the function and variable names that are exported from the DLL. These names can be used from LotusScript.

Did you try to recompile everything? Then click on the very first error you get and click OK. The module in question will be opened. My method is usually to go to the Options section and change one of the lines a little, then change it back, otherwise the Designer won't see that it has to recompile the lot. Do so, then try to save the module. Then you'll see some errors at the bottom, there might be more. These need to be resolved. You can share them with us if you like... ;)

The 500 point maximum was imposed a few months ago, probably donating points was done many times in the past as you said. It's somewhere in the Help, I don't know where.
ITDharam, when you wrote new empty agent with UseLSX, you reffered to Lsx lib by name.
Try reffer to it by path. I.e. UseLsx "C:\Some_folder\commerceaccelerator.dll"
If you will have an error again, than this dll is damaged, may be virus, or something.
If you do a search on commerceaccelerator on Google, you get 45 results, all pointing to IBM WebSphere related pages. Probably you can find the original dll in WebSphere if it is indeed damaged or so.

Someone successfully used it, see:
http://www.proposion.com/site/Discussion.nsf/0/4ae4c15c3fc92f4085256c8b0002e2ad?opendocument
Alexey.

Major difference is that I'm opening the agent in the database off a server, and I'm opening, and trying to recompile the agent from my machine.  I mapped the server drive and created a new script library use "Z:\lotus\domino\commerceaccelerator.dll" and it compiled just fine.

So then this makes me think that this whole test of trying to recompile the agent will not work because the paths are relative to the server, and not my client.

bosman, it appears that the dll is not corrupt as I was able to create a new script library AFTER I mapped the server drive with the existing DLL locally.  I don't know how to read what the 'hooks' are from the DLL itself, but I did read the documentation and I found that 'commerce' is the correct call.

I did notice that in the original agent it says uselsx "*commerce"   any idea what the * is for?

And if I can't compile this code from my client, how do I save changes to it?  Would I just throw this DLL into my program directory?  btw, I'm installing commerce accelerator locally to see if I can get my machine to recognize 'commerce'
I just rebooted, after installing commerce accelerator, then recompiled and it worked.

So then the question is, how can I verify that commerce is a valid lsx on the server?
"*commerce" - In this string, * means that path to the dll is taking from windows registry.
So when you have installed commerce accelerator locally, the istallator just wrote right values in registry for dll.

> So then the question is, how can I verify that commerce is a valid lsx on the server?
Heh, answer to you question is very simple :) Try to run your agent on server. If server dont crashes, then all is OK :)
Nice test there, but it won't fly.  This is a production server serving mail and DBs to a hundred people.  How about an alternative test, although I do like yoursl
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You might just pull it off when you copy the commerce*.dll to your \Lotus\Notes directory. Usually, an install is not required.
I mean, to compile everything, you copy it to your system. Don't run the agent locally, just compile everything and run it on the server.
Alexey,

As best I can tell, the call is correct.  I did look in the registry, and commerce is referenced for the commerceaccelerator.dll  When I copy that same dll to the same path on my machine, and register it, then I can compile

bosman, by moving DLL to my machine I was able to compile but still having problems.

BTW, through the web client where people generally submit this form which then runs these agents/scripts, sometimes the page doesn't load properly, and from what I've read this can be caused by the calls the form makes when it is loading, not just when the submit button is pressed.

I apologize for the delay in my response, I've been busy, sick, and soon going out of town...but the problem persists.

Thank you,
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think I know why they call you Bossman!

This may seem like a cop out but I'm going to have to close this question.  I've run out of time to work on this, the person who owns this site has moved it back to their original host who are also the creators of the package that runs this credit auth.

Thanks guys, I really appreciate your time, I wish I had more time to fix this because I think I'd learn a lot.  Unfortunately, or fortunately, Notes Dev is just a very small fraction of what I do.

Thanks again.
You'd have to talk to my ancestors, but there have been more who thought the name was more or less appropriate. I totally disagree of course! It's a pity we'll never know the answer. Stealing a project away from you... How can they!! Not fair. At all.

Thanks for the points.

Sjef "I'm not hiding behind some alias" Bosman
Sjef,

You think I am?
ITDharam,

Please give any of my points back to Pomster.  He really found the crux of the matter.  Or Alexey, since he sugegsted how to get it to work on your server.

- qwaletee
Qwaletee,

That's your interpretation. Mine is just the statement.
The real marque of qwaletee is Dovid Eliezer ben Yakov ben-Zion. That's just the statement.  Interpret it if you can.

he he
:) I will. Not easy for a goy, though...