• Script interpreter error, line=1, col=84: [ReferenceError] 'com' not found

    By Patrick Kwintensson 8 years ago

    I have follwed the three steps to implement the openlog logger in an NSF:

    1)
    Add the src/com.paulwithers.openLog package to the WebContent/WEB-INF folder.

    • Here I copied the files from the openlogjava.nsf into the WebContent/WEB-INF folder

    2) Add the XML for the Phase Listener and Managed Bean to your database's facesconfig.xml, also in the WebContent/WEB-INF folder. Ensure it is outside the
    AUTOGEN section. Anything within that section gets removed when the NSF is
    built.


    - Done this



    3)
    Ensure the WebContent/src folder is added as a source folder, by right-clicking and
    selecting Build Path > Use as source folder.


    - Done this


    Then I copied the ccLayout… xsp and the ErrorOnClick.xsp to my db and clicked the button. Then the following error appears:

    Unexpected runtime error

    The runtime has encountered an unexpected error.

    Error source

    Page Name:/ErrorOnClick.xsp
    Control Id: button1
    Property: onclick

    Exception

    Error while executing JavaScript action expression
    Script interpreter error, line=1, col=84: [ReferenceError] 'com' not found

    JavaScript code

       1: com.paulwithers.openLog.OpenLogItem.logEvent(null,com.paulwithers.util.OpenLogItem.getXspProperty(“xsp.openlog.filepath”,““),null,null);

    • By Paul S Withers 8 years ago

      Are there any build errors? It looks like it's not picking up src as a source folder. In Package Explorer, it should be showing as a fiolder with a package icon on it, with the name WebContent/WEB-INF/src, like this. I've just tested that XPage in the demo database myself and it's logging as expected.

      • By Patrick Kwintensson 8 years ago

        yes it is there

    • By Paul S Withers 8 years ago

      It's correct that that code throws an error, that's what the error page is designed to do - throw an uncaught error. To log an event from SSJS, use openLogBean.logEvent() methods.
      To catch the uncaught error, you'll need a custom error page in your database. Uncaught errors get passed to requestScope, but without an XPage error page, there will not be a Render Response phase to write to the OpenLog database.
      If you add an error page, it will write an error log to your OpenLog database, as in the demo database.