0

I'm developing an application in which much of the work interacts with aws S3. Initial situation: Domino: Release 9.0.1FP6. Application on xpages with aws utilities working perfectly with the typical functionalities of readBucket, downloadFile, createBucket etc. For application needs, due to its weight, I need to separate the logic of the same and try three methods for their separation.

  1. In another database, an agent receives a docID from the main application and executes the order of the requested operations for S3. The mechanism works perfectly, but the memory consumption is unacceptable so it is discarded.
  2. In another new database with the same libraries and classes needed to focus with XAgent based on How to schedule an Xagent from a Domino Java agent? Agent but with the access not ssl that points Per Henrik Lausten. It works fine, but if we load s3 it gives errors.

Console Java:

  • Starting http://localhost/proves\s3.nsf/demo.xsp

  • java.lang.NullPointerException --> at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:727)

Console Domino

  • HTTP JVM: demo.xsp --> beforePageLoad ---> Hello Word
  • HTTP JVM: CLFAD0211E: Exception thrown. please consult error-log-0.xml

Error-log-0.xml

  • Exception occurred servicing request for: /proves/s3.nsf/demo.xsp - HTTP Code: 500

IBM_TECHNICAL_SUPPORT\ xpages_exc.log

  • java.lang.NoClassDefFoundError: com.amazonaws.auth.AWSCredentials

I think the problem may be in using this mechanism because it is not secure, if it is accessed from the browser to demo.xsp it will be running the entire load of aws xon the default credentials.

  1. I test with another SSL-based xagent according to Devin Olson's blog post, Scheduled Xagents, but throw error:

Console Java:

  • Exception:javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.j: No trusted certificate found

Is the separation approach of the logic of the application correct? Any suggestions as to why the third procedure for SSL is failing?

Thanks in advance


Edit: Hello, the code XAgent (Agent properties security tab=3)

import java.io.BufferedReader; 
import java.io.BufferedWriter; 
import java.io.InputStreamReader; 
import java.io.OutputStreamWriter; 
import java.net.Socket; 
import javax.net.ssl.SSLSocketFactory; 
import lotus.domino.AgentBase; 

public class JavaAgent extends AgentBase { 
    // Change these settings below to your setup as required. 
    static final String hostName = "localhost"; 
    static final String urlFilepath = "/proves/s3.nsf/demo.xsp"; 
    static final int sslPort = 443; 


    public void NotesMain() { 
        try { 
            final SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault(); 
            final Socket socket = factory.createSocket(JavaAgent.hostName, JavaAgent.sslPort); 

            final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); 
            final BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); 

            final StringBuilder sb = new StringBuilder(); 
            sb.append("GET "); 
            sb.append(JavaAgent.urlFilepath); 
            sb.append(" HTTP/1.1\n"); 
            final String command = sb.toString(); 

            sb.setLength(0); 
            sb.append("Host: "); 
            sb.append(JavaAgent.hostName); 
            sb.append("\n\n"); 
            final String hostinfo = sb.toString(); 

            out.write(command); 
            out.write(hostinfo); 
            out.flush(); 

            in.close(); 
            out.close(); 
            socket.close(); 

        } catch (final Exception e) { 
            // YOUR_EXCEPTION_HANDLING_CODE
            System.out.println("Exception:" + e); 
        } 
    } 
} 

Code demo.xsp

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:this.beforePageLoad><![CDATA[#{javascript:
        print("demo.xsp --> beforePageLoad ---> Hello Word");
        var a = new Array();
        a[0] = "mybucket-proves";
        a[1] = @UserName(); 
        var s3 = new  S3(); 
        var vector:java.util.Vector = s3.mainReadBucket(a); 
        var i=0;
        for ( i = 0; i < vector.size(); i++) {
            print("Value:" + vector.get(i));
        }
    }]]></xp:this.beforePageLoad>
    <xp:label value="Demo" id="label1"></xp:label>
</xp:view>

New test: Although the two bd's reside on the same server, I have an SSL Certificate Authority in the JVM in case this is the fault, but it still gives the same error. SSLHandshakeException: com.ibm.jsse2.util.j: No trusted certificate.

Note: I have tested in the main application, where the aws libraries work properly, this agent and demo.xsp page and follow the same error.

Thank you

Community
  • 1
  • 1
  • You need to show the failing code. I would use a plugin – stwissel Feb 28 '17 at 17:52
  • Hi stwissel, what kind of plugin do you suggest? Thank you – Jesus Alejandre Feb 28 '17 at 23:04
  • A Domino OSGi plugin. Not too hard to build in Eclipse. Start here: https://www.slideshare.net/fiorep/domino-osgi-development – stwissel Mar 01 '17 at 04:01
  • Hello, Thanks for the advice, I have opened a great world. Although for a beginner, as in my case, the development is slow. I have created a plugin in dots and it works perfect. Now I have to find the way that can be executed using xots, which is not easy for me at the moment. Although that would be part of another question. Regards – Jesus Alejandre Mar 20 '17 at 07:28

0 Answers0