gpt4 book ai didi

java - 在 Notes 客户端中运行时 Domino 代理程序问题 - 在服务器上运行良好

转载 作者:行者123 更新时间:2023-11-29 05:14:15 26 4
gpt4 key购买 nike

我有一个使用 jsoup 发出 http 请求的 java 代理,当我从服务器控制台手动触发它时,这个代理工作正常。但是当我在客户端运行它时会报错,(右键单击代理并运行)

  • 代理设置为选项 2。允许受限操作,并设置为“操作菜单选择”和目标“数据库中的所有文档”
  • 我在服务器和客户端的 java.policy 文件中设置了相同的安全设置。我还尝试在具有“标准”java.policy 文件的服务器上运行我的代理,这也有效,因此问题似乎与 java.policy 文件无关。

这是我在 Notes 客户端 (v9.0.1) 中运行代理时在 Java 调试控制台中遇到的错误

java.lang.NullPointerException
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:727)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:654)
at COM.ibm.JEmpower.applet.http.HttpURLConnection.getInputStream(HttpURLConnection.java:411)
at COM.ibm.JEmpower.applet.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:703)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:399)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:453)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:434)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:181)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:170)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)

这是我在 Notes 客户端(以及一些服务器上)使用的 java.policy 设置

grant { permission java.util.PropertyPermission "http.keepAlive", "read, write"; };

grant { permission java.security.AllPermission; }

这是代理代码

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Database db = session.getCurrentDatabase();
lotus.domino.Document d = db.getView("inbox").getFirstDocument();

String url = d.getItemValueString("Subject");
Document x = Jsoup.connect(url).userAgent("Mozilla").get();
Elements p = x.select("p");
RichTextItem rt = (RichTextItem) d.getFirstItem("Body");
rt.appendText(p.text());
d.replaceItemValue("Processed", "1");
d.save();

} catch(Exception e) {
e.printStackTrace();
}

}

如何让代理在我的本地 Notes 客户端上运行?

最佳答案

阅读:Java Agent HTTP Connection Errors
这解决了我的问题。

After many restarts and toggled settings, and much pulling of hair, I was able to find a set of steps that would either cause the problem or prevent it. To make the code work:

  1. Open the Notes client
  2. Run the Java agent
  3. HTTP connection works

To get the error:

  1. Open the Notes client
  2. Open the Java Debug Console
  3. Run the Java agent
  4. HTTP connection fails

There's something about opening the Java Debug Console before running the agent that causes Notes to use a COM.ibm.JEmpower.applet.http.HttpURLConnection to make the connection instead of a sun.net.www.protocol.http.HttpURLConnection, and the JEmpower version of the class is the one that's broken (per experimentation and the APAR mentioned previously).

Oddly, if I run the agent and then open the debug console and then run the agent again, everything is fine. It's opening the debug console before I do anything that causes problems.

关于java - 在 Notes 客户端中运行时 Domino 代理程序问题 - 在服务器上运行良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27149890/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com